const char *key, const char *value);
const char *connman_element_get_string(struct connman_element *element,
const char *key);
+int connman_element_set_bool(struct connman_element *element,
+ const char *key, connman_bool_t value);
+connman_bool_t connman_element_get_bool(struct connman_element *element,
+ const char *key);
int connman_element_set_uint8(struct connman_element *element,
const char *key, connman_uint8_t value);
connman_uint8_t connman_element_get_uint8(struct connman_element *element,
case DBUS_TYPE_STRING:
property->value = g_strdup(*((const char **) value));
break;
+ case DBUS_TYPE_BOOLEAN:
case DBUS_TYPE_BYTE:
property->value = g_try_malloc(1);
if (property->value != NULL)
*((char **) value) = property->value;
found = TRUE;
break;
+ case DBUS_TYPE_BOOLEAN:
case DBUS_TYPE_BYTE:
memcpy(value, property->value, 1);
found = TRUE;
}
/**
+ * connman_element_set_bool:
+ * @element: element structure
+ * @key: unique identifier
+ * @value: boolean value
+ *
+ * Set boolean value for specific key
+ */
+int connman_element_set_bool(struct connman_element *element,
+ const char *key, connman_bool_t value)
+{
+ return set_static_property(element, key, DBUS_TYPE_BOOLEAN, &value);
+}
+
+/**
+ * connman_element_get_bool:
+ * @element: element structure
+ * @key: unique identifier
+ *
+ * Get boolean value for specific key
+ */
+connman_bool_t connman_element_get_bool(struct connman_element *element,
+ const char *key)
+{
+ connman_bool_t value;
+
+ if (get_static_property(element, key, &value) == FALSE)
+ return FALSE;
+
+ return value;
+}
+
+/**
* connman_element_set_uint8:
* @element: element structure
* @key: unique identifier
int connman_element_set_uint8(struct connman_element *element,
const char *key, connman_uint8_t value)
{
- return set_static_property(element, key, DBUS_TYPE_BYTE, &value);
+ return set_static_property(element, key, DBUS_TYPE_BYTE, &value);
}
/**
connman_uint8_t value;
if (get_static_property(element, key, &value) == FALSE)
- return 0;
+ return 0;
return value;
}