The ebus
library provides an Erlang binding for the canonical
libdbus IPC mechanism.
- A native binding to libdbus
- A callback based service implemenatation scaffold to make it easy to implement a dbus service
- A proxy object to make it easy to call a dbus service
Add ebus
to your deps
section in rebar.config
:
{deps, [ebus]}.
Here's an example of talking to connman to get the current list of connectivity related technologies:
Eshell V10.1 (abort with ^G)E
1> {ok, B} = ebus:start(system).
{ok,<0.221.0>}
2> {ok, P} = ebus_proxy:start(B, "net.connman", "/", []).
{ok,<0.224.0>}
3> ebus_proxy:call(P, "net.connman.Manager.GetTechnologies").
{ok,[[{"/net/connman/technology/p2p",
#{"Connected" => false,"Name" => "P2P","Powered" => false,
"Tethering" => false,"Type" => "p2p"}},
{"/net/connman/technology/ethernet",
#{"Connected" => false,"Name" => "Wired","Powered" => true,
"Tethering" => false,"Type" => "ethernet"}},
{"/net/connman/technology/wifi",
#{"Connected" => true,"Name" => "WiFi","Powered" => true,
"Tethering" => false,"Type" => "wifi"}},
{"/net/connman/technology/bluetooth",
#{"Connected" => false,"Name" => "Bluetooth",
"Powered" => false,"Tethering" => false,
"Type" => "bluetooth"}}]]}
Fork the repo and simply use make
to build the library. You will
need the libdbus
development libraries and headers installed on your
system.
To run the tests run make test
.