diff options
-rw-r--r-- | src/connman.h | 6 | ||||
-rw-r--r-- | src/notifier.c | 179 |
2 files changed, 0 insertions, 185 deletions
diff --git a/src/connman.h b/src/connman.h index f194cb54..c5803e11 100644 --- a/src/connman.h +++ b/src/connman.h @@ -615,13 +615,9 @@ void __connman_technology_cleanup(void); int __connman_notifier_init(void); void __connman_notifier_cleanup(void); -void __connman_notifier_register(enum connman_service_type type); -void __connman_notifier_unregister(enum connman_service_type type); void __connman_notifier_service_add(struct connman_service *service, const char *name); void __connman_notifier_service_remove(struct connman_service *service); -void __connman_notifier_enable(enum connman_service_type type); -void __connman_notifier_disable(enum connman_service_type type); void __connman_notifier_connect(enum connman_service_type type); void __connman_notifier_disconnect(enum connman_service_type type); void __connman_notifier_offlinemode(connman_bool_t enabled); @@ -632,8 +628,6 @@ void __connman_notifier_service_state_changed(struct connman_service *service, void __connman_notifier_ipconfig_changed(struct connman_service *service, struct connman_ipconfig *ipconfig); -connman_bool_t __connman_notifier_is_registered(enum connman_service_type type); -connman_bool_t __connman_notifier_is_enabled(enum connman_service_type type); unsigned int __connman_notifier_count_connected(void); const char *__connman_notifier_get_state(void); diff --git a/src/notifier.c b/src/notifier.c index c1346f20..cb6af859 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -73,31 +73,8 @@ void connman_notifier_unregister(struct connman_notifier *notifier) #define MAX_TECHNOLOGIES 10 -static volatile int registered[MAX_TECHNOLOGIES]; -static volatile int enabled[MAX_TECHNOLOGIES]; static volatile int connected[MAX_TECHNOLOGIES]; -static void technology_registered(enum connman_service_type type, - connman_bool_t registered) -{ - DBG("type %d registered %d", type, registered); -} - -static void technology_enabled(enum connman_service_type type, - connman_bool_t enabled) -{ - 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->service_enabled) - notifier->service_enabled(type, enabled); - } -} - unsigned int __connman_notifier_count_connected(void) { unsigned int i, count = 0; @@ -149,114 +126,6 @@ static void technology_connected(enum connman_service_type type, state_changed(connected); } -void __connman_notifier_register(enum connman_service_type type) -{ - DBG("type %d", type); - - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_GADGET: - return; - case CONNMAN_SERVICE_TYPE_ETHERNET: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_WIMAX: - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_CELLULAR: - break; - } - - if (__sync_fetch_and_add(®istered[type], 1) == 0) - technology_registered(type, TRUE); -} - -void __connman_notifier_unregister(enum connman_service_type type) -{ - DBG("type %d", type); - - __sync_synchronize(); - if (registered[type] == 0) { - connman_error("notifier unregister underflow"); - return; - } - - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_GADGET: - return; - case CONNMAN_SERVICE_TYPE_ETHERNET: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_WIMAX: - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_CELLULAR: - break; - } - - if (__sync_fetch_and_sub(®istered[type], 1) != 1) - return; - - technology_registered(type, FALSE); -} - -void __connman_notifier_enable(enum connman_service_type type) -{ - DBG("type %d", type); - - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_GADGET: - return; - case CONNMAN_SERVICE_TYPE_ETHERNET: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_WIMAX: - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_CELLULAR: - break; - } - - if (__sync_fetch_and_add(&enabled[type], 1) == 0) - technology_enabled(type, TRUE); -} - -void __connman_notifier_disable(enum connman_service_type type) -{ - DBG("type %d", type); - - __sync_synchronize(); - if (enabled[type] == 0) { - connman_error("notifier disable underflow"); - return; - } - - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_GADGET: - return; - case CONNMAN_SERVICE_TYPE_ETHERNET: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_WIMAX: - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_CELLULAR: - break; - } - - if (__sync_fetch_and_sub(&enabled[type], 1) != 1) - return; - - technology_enabled(type, FALSE); -} - void __connman_notifier_connect(enum connman_service_type type) { DBG("type %d", type); @@ -489,54 +358,6 @@ void __connman_notifier_ipconfig_changed(struct connman_service *service, } } -static connman_bool_t technology_supported(enum connman_service_type type) -{ - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - case CONNMAN_SERVICE_TYPE_SYSTEM: - case CONNMAN_SERVICE_TYPE_GPS: - case CONNMAN_SERVICE_TYPE_VPN: - case CONNMAN_SERVICE_TYPE_GADGET: - return FALSE; - case CONNMAN_SERVICE_TYPE_ETHERNET: - case CONNMAN_SERVICE_TYPE_WIFI: - case CONNMAN_SERVICE_TYPE_WIMAX: - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - case CONNMAN_SERVICE_TYPE_CELLULAR: - break; - } - - return TRUE; -} - -connman_bool_t __connman_notifier_is_registered(enum connman_service_type type) -{ - DBG("type %d", type); - - if (technology_supported(type) == FALSE) - return FALSE; - - __sync_synchronize(); - if (registered[type] > 0) - return TRUE; - - return FALSE; -} - -connman_bool_t __connman_notifier_is_enabled(enum connman_service_type type) -{ - DBG("type %d", type); - - if (technology_supported(type) == FALSE) - return FALSE; - - __sync_synchronize(); - if (enabled[type] > 0) - return TRUE; - - return FALSE; -} - int __connman_notifier_init(void) { DBG(""); |