#include "connman.h"
+enum {
+ NM_STATE_UNKNOWN = 0,
+ NM_STATE_ASLEEP,
+ NM_STATE_CONNECTING,
+ NM_STATE_CONNECTED,
+ NM_STATE_DISCONNECTED
+};
+
+static gboolean nm_compat = FALSE;
+
static DBusMessage *get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
technology_reply(0);
}
+static void nm_send_signal(const char *name, dbus_uint32_t state)
+{
+ DBusMessage *signal;
+
+ signal = dbus_message_new_signal(NM_PATH, NM_INTERFACE, name);
+ if (signal == NULL)
+ return;
+
+ dbus_message_append_args(signal, DBUS_TYPE_UINT32, &state,
+ DBUS_TYPE_INVALID);
+
+ g_dbus_send_message(connection, signal);
+}
+
+static void default_changed(struct connman_service *service)
+{
+ dbus_uint32_t state;
+
+ if (!nm_compat)
+ return;
+
+ if (service != NULL)
+ state = NM_STATE_CONNECTED;
+ else
+ state = NM_STATE_DISCONNECTED;
+
+ DBG("%p %d", service, state);
+
+ /* older deprecated signal, in case applications still use this */
+ nm_send_signal("StateChange", state);
+
+ /* the preferred current signal */
+ nm_send_signal("StateChanged", state);
+}
+
static struct connman_notifier technology_notifier = {
.name = "manager",
.priority = CONNMAN_NOTIFIER_PRIORITY_HIGH,
.service_enabled= technology_notify,
+ .default_changed= default_changed,
};
static DBusMessage *enable_technology(DBusConnection *conn,
return reply;
}
-enum {
- NM_STATE_UNKNOWN = 0,
- NM_STATE_ASLEEP,
- NM_STATE_CONNECTING,
- NM_STATE_CONNECTED,
- NM_STATE_DISCONNECTED
-};
-
static DBusMessage *nm_state(DBusConnection *conn,
DBusMessage *msg, void *data)
{
{ },
};
-static gboolean nm_compat = FALSE;
-
int __connman_manager_init(gboolean compat)
{
DBG("");