enum connman_service_type type;
char *path;
GSList *device_list;
- int enabled;
+ connman_bool_t enabled;
char *regdom;
connman_bool_t connected;
{
DBusMessageIter dict;
const char *str;
- connman_bool_t powered;
connman_dbus_dict_open(iter, &dict);
DBUS_TYPE_STRING, &str);
__sync_synchronize();
- if (technology->enabled > 0)
- powered = TRUE;
- else
- powered = FALSE;
connman_dbus_dict_append_basic(&dict, "Powered",
- DBUS_TYPE_BOOLEAN, &powered);
+ DBUS_TYPE_BOOLEAN,
+ &technology->enabled);
connman_dbus_dict_append_basic(&dict, "Connected",
DBUS_TYPE_BOOLEAN,
if (technology->tethering_ident != NULL)
connman_dbus_dict_append_basic(&dict, "TetheringIdentifier",
- DBUS_TYPE_STRING,
- &technology->tethering_ident);
+ DBUS_TYPE_STRING,
+ &technology->tethering_ident);
if (technology->tethering_passphrase != NULL)
connman_dbus_dict_append_basic(&dict, "TetheringPassphrase",
- DBUS_TYPE_STRING,
- &technology->tethering_passphrase);
+ DBUS_TYPE_STRING,
+ &technology->tethering_passphrase);
connman_dbus_dict_close(iter, &dict);
}
DBG("technology %p enable", technology);
__sync_synchronize();
- if (technology->enabled > 0)
+ if (technology->enabled == TRUE)
return -EALREADY;
if (technology->pending_reply != NULL)
DBG("technology %p disable", technology);
__sync_synchronize();
- if (technology->enabled == 0)
+ if (technology->enabled == FALSE)
return -EALREADY;
if (technology->pending_reply != NULL)
static void powered_changed(struct connman_technology *technology)
{
- connman_bool_t powered;
-
- __sync_synchronize();
- if (technology->enabled > 0)
- powered = TRUE;
- else
- powered = FALSE;
-
if (technology->pending_reply != NULL) {
g_dbus_send_reply(connection,
technology->pending_reply, DBUS_TYPE_INVALID);
technology->pending_timeout = 0;
}
+ __sync_synchronize();
connman_dbus_property_changed_basic(technology->path,
CONNMAN_TECHNOLOGY_INTERFACE, "Powered",
- DBUS_TYPE_BOOLEAN, &powered);
+ DBUS_TYPE_BOOLEAN, &technology->enabled);
}
static int technology_enabled(struct connman_technology *technology)
{
- if (__sync_fetch_and_add(&technology->enabled, 1) != 0)
+ __sync_synchronize();
+ if (technology->enabled == TRUE)
return -EALREADY;
+ technology->enabled = TRUE;
+
powered_changed(technology);
return 0;
static int technology_disabled(struct connman_technology *technology)
{
- if (__sync_fetch_and_sub(&technology->enabled, 1) != 1)
- return -EINPROGRESS;
+ __sync_synchronize();
+ if (technology->enabled == FALSE)
+ return -EALREADY;
+
+ technology->enabled = FALSE;
powered_changed(technology);