void __connman_notifier_offlinemode(connman_bool_t enabled);
void __connman_notifier_default_changed(struct connman_service *service);
+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);
else
return __connman_error_invalid_arguments(msg);
+ if (__connman_notifier_is_registered(type) == FALSE)
+ return __connman_error_not_registered(msg);
+
if (__connman_notifier_is_enabled(type) == TRUE)
return __connman_error_already_enabled(msg);
else
return __connman_error_invalid_arguments(msg);
+ if (__connman_notifier_is_registered(type) == FALSE)
+ return __connman_error_not_registered(msg);
+
if (__connman_notifier_is_enabled(type) == FALSE)
return __connman_error_already_disabled(msg);
}
}
-connman_bool_t __connman_notifier_is_enabled(enum connman_service_type type)
+static connman_bool_t technology_supported(enum connman_service_type type)
{
- DBG("type %d", type);
-
switch (type) {
case CONNMAN_SERVICE_TYPE_UNKNOWN:
case CONNMAN_SERVICE_TYPE_SYSTEM:
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;
+
+ if (g_atomic_int_get(®istered[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;
+
if (g_atomic_int_get(&enabled[type]) > 0)
return TRUE;