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

Patrick Venture venture at google.com
Thu Aug 15 07:26:17 AEST 2019


On Wed, Aug 14, 2019 at 2:17 PM James Feist <james.feist at linux.intel.com> wrote:
>
> 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
>

Thanks! That's what I saw -- that you weren't leveraging the generated
objects in the libphosphor-dbus-interfaces, basically.  Neat.

In a mixed environment, one just has to check if the variant is
int64_t or double when reading - no big deal.

Fun times.

>
> -James
>
>
> > Patrick
> >


More information about the openbmc mailing list