diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-11-23 13:54:41 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-11-23 13:54:41 +0100 |
commit | 20bcc97150c2f5e338aed4d442f623e5f07e9867 (patch) | |
tree | dcd4e59e358e244d430ee03c7a8dc4979d964ded | |
parent | 987f2dbc1f6bd78a1d86ceddba997506d3786322 (diff) | |
download | connman-20bcc97150c2f5e338aed4d442f623e5f07e9867.tar.gz connman-20bcc97150c2f5e338aed4d442f623e5f07e9867.tar.bz2 connman-20bcc97150c2f5e338aed4d442f623e5f07e9867.zip |
Add Network interface to network elements
-rw-r--r-- | src/element.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/element.c b/src/element.c index d66c81b9..bfb21b56 100644 --- a/src/element.c +++ b/src/element.c @@ -429,8 +429,10 @@ static GDBusMethodTable device_methods[] = { { }, }; -static GDBusSignalTable device_signals[] = { - { "PropertyChanged", "sv" }, +static GDBusMethodTable network_methods[] = { + { "GetProperties", "", "a{sv}", get_properties }, + { "SetProperty", "sv", "", set_property }, + { "ClearProperty", "s", "", clear_property }, { }, }; @@ -1283,12 +1285,21 @@ static void register_element(gpointer data, gpointer user_data) if (element->type == CONNMAN_ELEMENT_TYPE_DEVICE) { if (g_dbus_register_interface(connection, element->path, CONNMAN_DEVICE_INTERFACE, - device_methods, device_signals, + device_methods, element_signals, NULL, element, NULL) == FALSE) connman_error("Failed to register %s device", element->path); } + if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK) { + if (g_dbus_register_interface(connection, element->path, + CONNMAN_NETWORK_INTERFACE, + network_methods, element_signals, + NULL, element, NULL) == FALSE) + connman_error("Failed to register %s network", + element->path); + } + g_dbus_emit_signal(connection, CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, "ElementAdded", DBUS_TYPE_OBJECT_PATH, &element->path, @@ -1348,6 +1359,10 @@ static gboolean remove_element(GNode *node, gpointer user_data) DBUS_TYPE_OBJECT_PATH, &element->path, DBUS_TYPE_INVALID); + if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK) + g_dbus_unregister_interface(connection, element->path, + CONNMAN_NETWORK_INTERFACE); + if (element->type == CONNMAN_ELEMENT_TYPE_DEVICE) g_dbus_unregister_interface(connection, element->path, CONNMAN_DEVICE_INTERFACE); |