int connman_iface_update(struct connman_iface *iface,
enum connman_iface_state state)
{
- const char *str = NULL;
+ const char *str;
+
+ iface->state = state;
+
+ str = __connman_iface_state2string(iface->state);
+
+ g_dbus_emit_signal(connection, iface->path,
+ CONNMAN_IFACE_INTERFACE, "StateChanged",
+ DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID);
switch (state) {
case CONNMAN_IFACE_STATE_OFF:
- str = "off";
+ __connman_dhcp_release(iface);
break;
case CONNMAN_IFACE_STATE_ENABLED:
- str = "enabled";
if (iface->type == CONNMAN_IFACE_TYPE_80211) {
if (iface->driver->connect)
iface->driver->connect(iface, NULL);
break;
case CONNMAN_IFACE_STATE_CARRIER:
- str = "carrier";
__connman_dhcp_request(iface);
break;
- case CONNMAN_IFACE_STATE_READY:
- str = "ready";
- break;
-
case CONNMAN_IFACE_STATE_SHUTDOWN:
- str = "shutdown";
__connman_dhcp_release(iface);
if (iface->driver->shutdown)
iface->driver->shutdown(iface);
break;
}
- iface->state = state;
-
- if (str != NULL) {
- g_dbus_emit_signal(connection, iface->path,
- CONNMAN_IFACE_INTERFACE, "StateChanged",
- DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID);
- }
-
return 0;
}
struct connman_iface *iface = data;
DBusMessage *reply;
enum connman_iface_policy new_policy;
- const char *path, *policy;
+ const char *policy;
DBG("conn %p", conn);
dbus_message_append_args(reply, DBUS_TYPE_INVALID);
if (iface->policy != new_policy) {
- path = dbus_message_get_path(msg);
-
iface->policy = new_policy;
__connman_iface_store(iface);
connman_iface_update(iface,
CONNMAN_IFACE_STATE_SHUTDOWN);
- g_dbus_emit_signal(conn, path, CONNMAN_IFACE_INTERFACE,
+ policy = __connman_iface_policy2string(new_policy);
+
+ g_dbus_emit_signal(conn, iface->path, CONNMAN_IFACE_INTERFACE,
"PolicyChanged", DBUS_TYPE_STRING, &policy,
DBUS_TYPE_INVALID);
}
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
- if (iface->network.essid != NULL)
- append_entry(&dict, "ESSID",
+ switch (iface->type) {
+ case CONNMAN_IFACE_TYPE_80211:
+ if (iface->network.essid != NULL)
+ append_entry(&dict, "ESSID",
DBUS_TYPE_STRING, &iface->network.essid);
-
- if (secrets == TRUE && iface->network.psk != NULL)
- append_entry(&dict, "PSK",
+ if (secrets == TRUE && iface->network.psk != NULL)
+ append_entry(&dict, "PSK",
DBUS_TYPE_STRING, &iface->network.psk);
+ break;
+ default:
+ break;
+ }
dbus_message_iter_close_container(&array, &dict);
}
dbus_message_append_args(reply, DBUS_TYPE_INVALID);
if (changed == TRUE) {
- const char *path = dbus_message_get_path(msg);
-
__connman_iface_store(iface);
- signal = dbus_message_new_signal(path,
+ signal = dbus_message_new_signal(iface->path,
CONNMAN_IFACE_INTERFACE, "NetworkChanged");
if (signal != NULL) {
append_network(signal, iface, FALSE);
dbus_message_append_args(reply, DBUS_TYPE_INVALID);
if (changed == TRUE) {
- const char *path = dbus_message_get_path(msg);
-
__connman_iface_store(iface);
- signal = dbus_message_new_signal(path,
+ signal = dbus_message_new_signal(iface->path,
CONNMAN_IFACE_INTERFACE, "IPv4Changed");
if (signal != NULL) {
append_ipv4(signal, iface);