#include <vconf.h>
#include "connman-lib.h"
+#include "connman-manager.h"
#include "connman-technology.h"
/*#include "tethering-client-stub.h"
#include "marshal.h"*/
return err;
}
+*/
+static void set_connman_tethering_powered_changed_cb(tethering_type_e type, void *user_data)
+{
+ struct connman_technology *technology;
+
+ if (type == TETHERING_TYPE_ALL) {
+ /* TETHERING_TYPE_ALL */
+ technology = connman_get_technology(TECH_TYPE_GADGET);
+ if (technology != NULL)
+ connman_technology_set_property_changed_cb(technology,
+ TECH_PROP_TETHERING,
+ __handle_usb_tether_changed,
+ user_data);
+ technology = connman_get_technology(TECH_TYPE_WIFI);
+ if (technology != NULL)
+ connman_technology_set_property_changed_cb(technology,
+ TECH_PROP_TETHERING,
+ __handle_wifi_tether_changed,
+ user_data);
+ technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
+ if (technology != NULL)
+ connman_technology_set_property_changed_cb(technology,
+ TECH_PROP_TETHERING,
+ __handle_bt_tether_changed,
+ user_data);
+ return;
+ }
+ if (type == TETHERING_TYPE_USB) {
+ technology = connman_get_technology(TECH_TYPE_GADGET);
+ if (technology != NULL)
+ connman_technology_set_property_changed_cb(technology,
+ TECH_PROP_TETHERING,
+ __handle_usb_tether_changed,
+ user_data);
+ }
+ else if (type == TETHERING_TYPE_WIFI) {
+ technology = connman_get_technology(TECH_TYPE_WIFI);
+ if (technology != NULL)
+ connman_technology_set_property_changed_cb(technology,
+ TECH_PROP_TETHERING,
+ __handle_wifi_tether_changed,
+ user_data);
+ }
+ else if (type == TETHERING_TYPE_BT) {
+ technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
+ if (technology != NULL)
+ connman_technology_set_property_changed_cb(technology,
+ TECH_PROP_TETHERING,
+ __handle_bt_tether_changed,
+ user_data);
+ }
+}
+/*
static void __handle_dhcp(DBusGProxy *proxy, const char *member,
guint interface, const char *ip, const char *mac,
const char *name, guint timestamp, gpointer user_data)
return;
}
*/
+static void __handle_technology_added(struct connman_technology* technology, void* user_data)
+{
+ _retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
+
+ __tethering_h *th = (__tethering_h *)user_data;
+
+ tethering_type_e tethering_type = TETHERING_TYPE_ALL;
+
+ enum connman_technology_type type = connman_get_technology_type(technology);
+ if (type == TECH_TYPE_GADGET)
+ tethering_type = TETHERING_TYPE_USB;
+ else if (type == TECH_TYPE_WIFI)
+ tethering_type = TETHERING_TYPE_WIFI;
+ else if (type == TECH_TYPE_BLUETOOTH)
+ tethering_type = TETHERING_TYPE_BT;
+
+ if (th->enabled_cb[tethering_type] || th->disabled_cb[tethering_type])
+ {
+ g_print("=====set tethering powered changed callback=====\n");
+ set_connman_tethering_powered_changed_cb(tethering_type, user_data);
+ }
+ if (th->passphrase_changed_cb)
+ {
+ g_print("=====set tethering passphrase changed callback=====\n");
+ connman_technology_set_property_changed_cb(technology,
+ TECH_PROP_TETHERING_PASSPHRASE,
+ __handle_passphrase_changed,
+ user_data);
+ }
+}
+
static void __handle_wifi_tether_changed(struct connman_technology *technology, void* user_data)
{
bool tether = connman_get_technology_tethering(technology);
return;
}
*/
-static void set_connman_tethering_changed_cb(tethering_type_e type, void *user_data)
-{
- struct connman_technology *technology;
-
- if (type == TETHERING_TYPE_ALL) {
- /* TETHERING_TYPE_ALL */
- technology = connman_get_technology(TECH_TYPE_GADGET);
- if (technology != NULL)
- connman_technology_set_property_changed_cb(technology,
- TECH_PROP_TETHERING,
- __handle_usb_tether_changed,
- user_data);
- technology = connman_get_technology(TECH_TYPE_WIFI);
- if (technology != NULL)
- connman_technology_set_property_changed_cb(technology,
- TECH_PROP_TETHERING,
- __handle_wifi_tether_changed,
- user_data);
- technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
- if (technology != NULL)
- connman_technology_set_property_changed_cb(technology,
- TECH_PROP_TETHERING,
- __handle_bt_tether_changed,
- user_data);
- return;
- }
-
- if (type == TETHERING_TYPE_USB) {
- technology = connman_get_technology(TECH_TYPE_GADGET);
- if (technology != NULL)
- connman_technology_set_property_changed_cb(technology,
- TECH_PROP_TETHERING,
- __handle_usb_tether_changed,
- user_data);
- }
- else if (type == TETHERING_TYPE_WIFI) {
- technology = connman_get_technology(TECH_TYPE_WIFI);
- if (technology != NULL)
- connman_technology_set_property_changed_cb(technology,
- TECH_PROP_TETHERING,
- __handle_wifi_tether_changed,
- user_data);
- }
- else if (type == TETHERING_TYPE_BT) {
- technology = connman_get_technology(TECH_TYPE_BLUETOOTH);
- if (technology != NULL)
- connman_technology_set_property_changed_cb(technology,
- TECH_PROP_TETHERING,
- __handle_bt_tether_changed,
- user_data);
- }
-}
-
static void __handle_passphrase_changed(struct connman_technology* technology, void *user_data)
{
DBG("+\n");
connman_lib_init();
+ connman_set_technology_added_cb(__handle_technology_added, th);
+
return TETHERING_ERROR_NONE;
}
memset(th, 0x00, sizeof(__tethering_h));
free(th);
+ connman_unset_technology_added_cb();
+
return TETHERING_ERROR_NONE;
}
}
}
- set_connman_tethering_changed_cb(type, tethering);
+ set_connman_tethering_powered_changed_cb(type, tethering);
return TETHERING_ERROR_NONE;
}
}
}
- set_connman_tethering_changed_cb(type, tethering);
+ set_connman_tethering_powered_changed_cb(type, tethering);
return TETHERING_ERROR_NONE;
}