static void pan_create(GDBusProxy *network_proxy) { const char *path = g_dbus_proxy_get_path(network_proxy); struct bluetooth_pan *pan; pan = g_try_new0(struct bluetooth_pan, 1); if (!pan) { connman_error("Out of memory creating PAN NAP"); return; } g_hash_table_replace(networks, g_strdup(path), pan); pan->btnetwork_proxy = g_dbus_proxy_ref(network_proxy); pan->btdevice_proxy = g_dbus_proxy_new(client, path, "org.bluez.Device1"); if (!pan->btdevice_proxy) { connman_error("Cannot create BT PAN watcher %s", path); g_hash_table_remove(networks, path); return; } g_dbus_proxy_set_property_watch(pan->btnetwork_proxy, btnetwork_property_change, NULL); g_dbus_proxy_set_property_watch(pan->btdevice_proxy, btdevice_property_change, NULL); DBG("pan %p %s role %s", pan, path, proxy_get_role(pan->btdevice_proxy)); pan_create_nap(pan); }
static void modem_register_from_proxy(GDBusProxy *proxy, const char *path) { const char *alias, *remote; DBusMessageIter iter; dbus_bool_t paired; struct ofono_modem *modem; if (g_dbus_proxy_get_property(proxy, "Paired", &iter) == FALSE) return; dbus_message_iter_get_basic(&iter, &paired); if (paired == FALSE) return; if (g_dbus_proxy_get_property(proxy, "UUIDs", &iter) == FALSE) return; if (has_hfp_ag_uuid(&iter) == FALSE) return; if (g_dbus_proxy_get_property(proxy, "Alias", &iter) == FALSE) return; dbus_message_iter_get_basic(&iter, &alias); if (g_dbus_proxy_get_property(proxy, "Address", &iter) == FALSE) return; dbus_message_iter_get_basic(&iter, &remote); modem = modem_register(path, remote, alias); g_dbus_proxy_set_property_watch(proxy, alias_changed, modem); g_dbus_proxy_set_removed_watch(proxy, modem_removed, modem); }
static void device_create(GDBusProxy *proxy) { struct connman_device *device = NULL; const char *path = g_dbus_proxy_get_path(proxy); const char *address; char ident[BLUETOOTH_ADDR_LEN * 2 + 1]; bool powered; address = proxy_get_string(proxy, "Address"); if (!address) return; address2ident(address, ident); device = connman_device_create("bluetooth", CONNMAN_DEVICE_TYPE_BLUETOOTH); if (!device) return; connman_device_set_data(device, g_dbus_proxy_ref(proxy)); connman_device_set_ident(device, ident); g_hash_table_replace(devices, g_strdup(path), device); DBG("device %p %s device powered %d adapter powered %d", device, path, connman_device_get_powered(device), proxy_get_bool(proxy, "Powered")); if (connman_device_register(device) < 0) { g_hash_table_remove(devices, device); return; } g_dbus_proxy_set_property_watch(proxy, adapter_property_change, NULL); powered = proxy_get_bool(proxy, "Powered"); connman_device_set_powered(device, powered); if (proxy_get_role(proxy) && !bluetooth_tethering) tethering_create(path, NULL, NULL, false); }