mixing phosphor-dbus-interfaces and intel-dbus-interfaces

James Feist james.feist at linux.intel.com
Thu Aug 15 07:17:49 AEST 2019


On 8/14/19 2:09 PM, Patrick Venture wrote:
> I was curious how you guys mixed your dbus-interfaces repos.  it looks
> like at least in dbus-sensors that you approach the use of them
> differently.  So there's no incompatibility -- for instance, between
> the two sensor value interfaces?
> 

sdbusplus asio doesn't require any yaml files, it lets you create the 
interface on the fly.

Examples are here:
https://github.com/openbmc/sdbusplus/blob/4212292bcf136d04b38ba5116aa568b0fa312798/example/asio-example.cpp#L206

So to create the sensor interface one just calls:

  auto server = sdbusplus::asio::object_server(conn);
   std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
      server.add_interface("/xyz/openbmc_project/Sensor/Value",
			    "xyz.openbmc_project.SomeType.SensorName");

Then if you want a double you call.

double value = 3;

iface->register_property("Value", value);

and it adds it to the vtable.

Then just call iface->initialize();


So for adc sensor it gets created on the fly here: 
https://github.com/openbmc/dbus-sensors/blob/7fa475d3f27ec6c37503ff7ec0496acc2215da29/src/ADCSensor.cpp#L57


and the double is added here:


https://github.com/openbmc/dbus-sensors/blob/7fa475d3f27ec6c37503ff7ec0496acc2215da29/include/sensor.hpp#L62


-James


> Patrick
> 


More information about the openbmc mailing list