the value "connected". This can only be seen if
previously no connection was present.
+ array{string} Technologies [readonly]
+
+ The list of available technologies. The strings
+ are the same as the ones from the service types.
+
+ array{string} EnabledTechnologies [readonly]
+
+ The list of enabled technologies. The strings
+ are the same as the ones from the service types.
+
boolean OfflineMode [readwrite]
The offline mode indicates the global setting for
int __connman_notifier_init(void);
void __connman_notifier_cleanup(void);
+void __connman_notifier_device_type_list(gboolean powered,
+ DBusMessageIter *iter);
+void __connman_notifier_device_type_register(enum connman_device_type type);
+void __connman_notifier_device_type_unregister(enum connman_device_type type);
void __connman_notifier_device_type_increase(enum connman_device_type type);
void __connman_notifier_device_type_decrease(enum connman_device_type type);
void __connman_notifier_offline_mode(connman_bool_t enabled);
break;
}
+ __connman_notifier_device_type_register(device->type);
+
return connman_element_register(&device->element, NULL);
}
{
__connman_storage_save_device(device);
+ __connman_notifier_device_type_unregister(device->type);
+
connman_element_unregister(&device->element);
}
dbus_message_iter_close_container(dict, &entry);
}
+static void append_technologies(gboolean powered, DBusMessageIter *dict)
+{
+ DBusMessageIter entry, value, iter;
+ const char *key;
+
+ if (powered)
+ key = "EnabledTechnologies";
+ else
+ key = "Technologies";
+
+ dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+ NULL, &entry);
+
+ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
+
+ dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT,
+ DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
+ &value);
+
+ dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING, &iter);
+ __connman_notifier_device_type_list(powered, &iter);
+ dbus_message_iter_close_container(&value, &iter);
+
+ dbus_message_iter_close_container(&entry, &value);
+
+ dbus_message_iter_close_container(dict, &entry);
+}
+
static DBusMessage *get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
connman_dbus_dict_append_variant(&dict, "OfflineMode",
DBUS_TYPE_BOOLEAN, &global_offlinemode);
+ append_technologies(FALSE, &dict);
+ append_technologies(TRUE, &dict);
+
dbus_message_iter_close_container(&array, &dict);
return reply;
{
GSList *list;
+ DBG("type %d enabled %d", type, enabled);
+
for (list = notifier_list; list; list = list->next) {
struct connman_notifier *notifier = list->data;
if (notifier->device_enabled)
notifier->device_enabled(type, enabled);
}
+}
+
+static void device_registered(enum connman_device_type type,
+ connman_bool_t registered)
+{
+ DBG("type %d registered %d", type, registered);
+}
+
+static const char *type2string(enum connman_device_type type)
+{
+ switch (type) {
+ case CONNMAN_DEVICE_TYPE_UNKNOWN:
+ case CONNMAN_DEVICE_TYPE_MBM:
+ case CONNMAN_DEVICE_TYPE_HSO:
+ case CONNMAN_DEVICE_TYPE_NOZOMI:
+ case CONNMAN_DEVICE_TYPE_HUAWEI:
+ case CONNMAN_DEVICE_TYPE_NOVATEL:
+ case CONNMAN_DEVICE_TYPE_VENDOR:
+ break;
+ case CONNMAN_DEVICE_TYPE_ETHERNET:
+ return "ethernet";
+ case CONNMAN_DEVICE_TYPE_WIFI:
+ return "wifi";
+ case CONNMAN_DEVICE_TYPE_WIMAX:
+ return "wimax";
+ case CONNMAN_DEVICE_TYPE_BLUETOOTH:
+ return "bluetooth";
+ case CONNMAN_DEVICE_TYPE_GPS:
+ return "gps";
+ }
+
+ return NULL;
+}
+
+static volatile gint registered[20];
+static volatile gint enabled[20];
+
+void __connman_notifier_device_type_list(gboolean powered,
+ DBusMessageIter *iter)
+{
+ int i;
+
+ for (i = 0; i < 10; i++) {
+ const char *type = type2string(i);
+ gint count;
+
+ if (type == NULL)
+ continue;
+
+ if (powered == TRUE)
+ count = g_atomic_int_get(&enabled[i]);
+ else
+ count = g_atomic_int_get(®istered[i]);
+
+ if (count > 0)
+ dbus_message_iter_append_basic(iter,
+ DBUS_TYPE_STRING, &type);
+ }
+}
+
+void __connman_notifier_device_type_register(enum connman_device_type type)
+{
+ DBG("type %d", type);
+ switch (type) {
+ case CONNMAN_DEVICE_TYPE_UNKNOWN:
+ case CONNMAN_DEVICE_TYPE_MBM:
+ case CONNMAN_DEVICE_TYPE_HSO:
+ case CONNMAN_DEVICE_TYPE_NOZOMI:
+ case CONNMAN_DEVICE_TYPE_HUAWEI:
+ case CONNMAN_DEVICE_TYPE_NOVATEL:
+ case CONNMAN_DEVICE_TYPE_VENDOR:
+ return;
+ case CONNMAN_DEVICE_TYPE_ETHERNET:
+ case CONNMAN_DEVICE_TYPE_WIFI:
+ case CONNMAN_DEVICE_TYPE_WIMAX:
+ case CONNMAN_DEVICE_TYPE_BLUETOOTH:
+ case CONNMAN_DEVICE_TYPE_GPS:
+ if (g_atomic_int_exchange_and_add(®istered[type], 1) == 0)
+ device_registered(type, TRUE);
+ break;
+ }
}
-static volatile gint enabled[10];
+void __connman_notifier_device_type_unregister(enum connman_device_type type)
+{
+ DBG("type %d", type);
+
+ switch (type) {
+ case CONNMAN_DEVICE_TYPE_UNKNOWN:
+ case CONNMAN_DEVICE_TYPE_MBM:
+ case CONNMAN_DEVICE_TYPE_HSO:
+ case CONNMAN_DEVICE_TYPE_NOZOMI:
+ case CONNMAN_DEVICE_TYPE_HUAWEI:
+ case CONNMAN_DEVICE_TYPE_NOVATEL:
+ case CONNMAN_DEVICE_TYPE_VENDOR:
+ return;
+ case CONNMAN_DEVICE_TYPE_ETHERNET:
+ case CONNMAN_DEVICE_TYPE_WIFI:
+ case CONNMAN_DEVICE_TYPE_WIMAX:
+ case CONNMAN_DEVICE_TYPE_BLUETOOTH:
+ case CONNMAN_DEVICE_TYPE_GPS:
+ if (g_atomic_int_dec_and_test(®istered[type]) == TRUE)
+ device_registered(type, FALSE);
+ break;
+ }
+}
void __connman_notifier_device_type_increase(enum connman_device_type type)
{
val = str(path)
list = list + val[val.rfind("/") + 1:] + " "
print " Services = [ %s]" % (list)
+ if "Technologies" in properties.keys():
+ list = ""
+ for val in properties["Technologies"]:
+ list = list + val + " "
+ print " Technologies = [ %s]" % (list)
for key in properties.keys():
if key in ["Profiles", "Devices", "Connections", "Services"]:
print_properties(key, properties[key])
+ elif key in ["Technologies", "EnabledTechnologies"]:
+ print "%s" % (key)
+ list = ""
+ for val in properties[key]:
+ list = list + val + " "
+ print " [ %s]" % (list)
elif key in ["OfflineMode"]:
print "%s" % (key)
if properties[key] == dbus.Boolean(1):