dbus: Switch to using org.freedesktop.DBus.Properties

Use the org.freedesktop.DBus.Properties interfaces on objects with
properties and drop the old style GetProperty/SetProperty methods on
individual interfaces.  Agent and KnownNetworks have no properties at
this time so don't add org.freedesktop.DBus.Properties interfaces.
This commit is contained in:
Andrew Zaborowski 2016-09-21 18:51:55 +02:00 committed by Denis Kenzior
parent c6e38dacac
commit 0ffec2e481
5 changed files with 21 additions and 5 deletions

View File

@ -457,7 +457,7 @@ bool agent_init(struct l_dbus *dbus)
{
if (!l_dbus_register_interface(dbus, IWD_AGENT_MANAGER_INTERFACE,
setup_agent_interface,
NULL, true)) {
NULL, false)) {
l_info("Unable to register %s interface",
IWD_AGENT_MANAGER_INTERFACE);
return false;

View File

@ -1156,6 +1156,11 @@ struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
IWD_DEVICE_INTERFACE, device))
l_info("Unable to register %s interface", IWD_DEVICE_INTERFACE);
if (!l_dbus_object_add_interface(dbus, device_get_path(device),
L_DBUS_INTERFACE_PROPERTIES, device))
l_info("Unable to register %s interface",
L_DBUS_INTERFACE_PROPERTIES);
scan_ifindex_add(device->index);
device_netdev_notify(netdev, netdev_get_is_up(netdev) ?
@ -1218,7 +1223,7 @@ bool device_init(void)
if (!l_dbus_register_interface(dbus_get_bus(),
IWD_DEVICE_INTERFACE,
setup_device_interface,
NULL, true))
NULL, false))
return false;
watchlist_init(&device_watches);

View File

@ -142,7 +142,7 @@ bool known_networks_init(void)
if (!l_dbus_register_interface(dbus, IWD_KNOWN_NETWORKS_INTERFACE,
setup_known_networks_interface,
NULL, true)) {
NULL, false)) {
l_info("Unable to register %s interface",
IWD_KNOWN_NETWORKS_INTERFACE);
return false;

View File

@ -684,6 +684,11 @@ bool network_register(struct network *network, const char *path)
return false;
}
if (!l_dbus_object_add_interface(dbus_get_bus(), path,
L_DBUS_INTERFACE_PROPERTIES, network))
l_info("Unable to register %s interface",
L_DBUS_INTERFACE_PROPERTIES);
network->object_path = strdup(path);
return true;
@ -718,7 +723,7 @@ void network_remove(struct network *network, int reason)
void network_init()
{
if (!l_dbus_register_interface(dbus_get_bus(), IWD_NETWORK_INTERFACE,
setup_network_interface, NULL, true))
setup_network_interface, NULL, false))
l_error("Unable to register %s interface",
IWD_NETWORK_INTERFACE);

View File

@ -395,6 +395,12 @@ static void wiphy_register(struct wiphy *wiphy)
IWD_WIPHY_INTERFACE, wiphy))
l_info("Unable to add the %s interface to %s",
IWD_WIPHY_INTERFACE, wiphy_get_path(wiphy));
if (!l_dbus_object_add_interface(dbus, wiphy_get_path(wiphy),
L_DBUS_INTERFACE_PROPERTIES, NULL))
l_info("Unable to add the %s interface to %s",
L_DBUS_INTERFACE_PROPERTIES,
wiphy_get_path(wiphy));
}
static void wiphy_dump_done(void *user)
@ -724,7 +730,7 @@ bool wiphy_init(struct l_genl_family *in)
if (!l_dbus_register_interface(dbus_get_bus(),
IWD_WIPHY_INTERFACE,
setup_wiphy_interface,
NULL, true))
NULL, false))
l_error("Unable to register the %s interface",
IWD_WIPHY_INTERFACE);