int __connman_technology_add_device(struct connman_device *device);
int __connman_technology_remove_device(struct connman_device *device);
-int __connman_technology_enable_device(struct connman_device *device);
-int __connman_technology_disable_device(struct connman_device *device);
+int __connman_technology_enable(enum connman_service_type type);
+int __connman_technology_disable(enum connman_service_type type);
int __connman_technology_add_rfkill(unsigned int index,
enum connman_service_type type,
connman_bool_t softblock,
int __connman_device_enable(struct connman_device *device)
{
int err;
+ enum connman_service_type type;
DBG("device %p %d", device, device->blocked);
if (__connman_profile_get_offlinemode() == TRUE)
__connman_profile_set_offlinemode(FALSE, FALSE);
- __connman_technology_enable_device(device);
+ type = __connman_device_get_service_type(device);
+ __connman_technology_enable(type);
return 0;
}
int __connman_device_disable(struct connman_device *device)
{
int err;
+ enum connman_service_type type;
DBG("device %p", device);
device->powered_pending = FALSE;
device->powered = FALSE;
- __connman_technology_disable_device(device);
+ type = __connman_device_get_service_type(device);
+ __connman_technology_disable(type);
return 0;
}
connman_bool_t powered)
{
int err;
+ enum connman_service_type type;
DBG("driver %p powered %d", device, powered);
device->powered = powered;
device->powered_pending = powered;
+ type = __connman_device_get_service_type(device);
+
if (device->powered == TRUE)
- __connman_technology_enable_device(device);
+ __connman_technology_enable(type);
else
- __connman_technology_disable_device(device);
+ __connman_technology_disable(type);
if (device->offlinemode == TRUE && powered == TRUE)
return connman_device_set_powered(device, FALSE);
return 0;
}
-int __connman_technology_enable_device(struct connman_device *device)
+int __connman_technology_enable(enum connman_service_type type)
{
struct connman_technology *technology;
- enum connman_service_type type;
-
- DBG("device %p", device);
- technology = g_hash_table_lookup(device_table, device);
+ technology = technology_find(type);
if (technology == NULL)
return -ENXIO;
if (g_atomic_int_get(&technology->blocked))
return -ERFKILL;
- type = __connman_device_get_service_type(device);
__connman_notifier_enable(type);
if (g_atomic_int_exchange_and_add(&technology->enabled, 1) == 0) {
return 0;
}
-int __connman_technology_disable_device(struct connman_device *device)
+int __connman_technology_disable(enum connman_service_type type)
{
struct connman_technology *technology;
- enum connman_service_type type;
GSList *list;
- DBG("device %p", device);
-
- type = __connman_device_get_service_type(device);
- __connman_notifier_disable(type);
-
- technology = g_hash_table_lookup(device_table, device);
+ technology = technology_find(type);
if (technology == NULL)
return -ENXIO;
if (g_atomic_int_dec_and_test(&technology->enabled) == TRUE) {
+ __connman_notifier_disable(type);
+
technology->state = CONNMAN_TECHNOLOGY_STATE_AVAILABLE;
state_changed(technology);
}