*
* Connection Manager
*
- * Copyright (C) 2007-2009 Intel Corporation. All rights reserved.
+ * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
return g_string_free(str, FALSE);
}
-void connman_dbus_property_append_variant(DBusMessageIter *iter,
+void connman_dbus_property_append_basic(DBusMessageIter *iter,
const char *key, int type, void *val)
{
DBusMessageIter value;
case DBUS_TYPE_INT32:
signature = DBUS_TYPE_INT32_AS_STRING;
break;
+ case DBUS_TYPE_UINT64:
+ signature = DBUS_TYPE_UINT64_AS_STRING;
+ break;
+ case DBUS_TYPE_INT64:
+ signature = DBUS_TYPE_INT64_AS_STRING;
+ break;
case DBUS_TYPE_OBJECT_PATH:
signature = DBUS_TYPE_OBJECT_PATH_AS_STRING;
break;
connman_dbus_dict_open(&value, &dict);
if (function)
- function(&dict);
+ function(&dict, user_data);
connman_dbus_dict_close(&value, &dict);
dbus_message_iter_close_container(iter, &value);
dbus_message_iter_close_container(iter, &value);
}
-void connman_dbus_property_append_variable_array(DBusMessageIter *iter,
- const char *key, int type, connman_dbus_append_cb_t function)
+void connman_dbus_property_append_array(DBusMessageIter *iter,
+ const char *key, int type,
+ connman_dbus_append_cb_t function, void *user_data)
{
DBusMessageIter value, array;
const char *variant_sig, *array_sig;
dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY,
array_sig, &array);
if (function)
- function(&array);
+ function(&array, user_data);
dbus_message_iter_close_container(&value, &array);
dbus_message_iter_close_container(iter, &value);
return FALSE;
dbus_message_iter_init_append(signal, &iter);
- connman_dbus_property_append_variant(&iter, key, type, val);
+ connman_dbus_property_append_basic(&iter, key, type, val);
g_dbus_send_message(connection, signal);
return TRUE;
}
+dbus_bool_t connman_dbus_property_changed_array(const char *path,
+ const char *interface, const char *key, int type,
+ connman_dbus_append_cb_t function, void *user_data)
+{
+ DBusMessage *signal;
+ DBusMessageIter iter;
+
+ if (path == NULL)
+ return FALSE;
+
+ signal = dbus_message_new_signal(path, interface, "PropertyChanged");
+ if (signal == NULL)
+ return FALSE;
+
+ dbus_message_iter_init_append(signal, &iter);
+ connman_dbus_property_append_array(&iter, key, type,
+ function, user_data);
+
+ g_dbus_send_message(connection, signal);
+
+ return TRUE;
+}
+
+dbus_bool_t connman_dbus_setting_changed_basic(const char *owner,
+ const char *path, const char *key,
+ int type, void *val)
+{
+ DBusMessage *msg;
+ DBusMessageIter array, dict;
+
+ if (owner == NULL || path == NULL)
+ return FALSE;
+
+ msg = dbus_message_new_method_call(owner, path,
+ CONNMAN_NOTIFICATION_INTERFACE,
+ "Update");
+ if (msg == NULL)
+ return FALSE;
+
+ dbus_message_iter_init_append(msg, &array);
+ connman_dbus_dict_open(&array, &dict);
+
+ connman_dbus_dict_append_basic(&dict, key, type, val);
+
+ connman_dbus_dict_close(&array, &dict);
+
+ g_dbus_send_message(connection, msg);
+
+ return TRUE;
+}
+
+dbus_bool_t connman_dbus_setting_changed_dict(const char *owner,
+ const char *path, const char *key,
+ connman_dbus_append_cb_t function,
+ void *user_data)
+{
+ DBusMessage *msg;
+ DBusMessageIter array, dict;
+
+ if (owner == NULL || path == NULL)
+ return FALSE;
+
+ msg = dbus_message_new_method_call(owner, path,
+ CONNMAN_NOTIFICATION_INTERFACE,
+ "Update");
+ if (msg == NULL)
+ return FALSE;
+
+ dbus_message_iter_init_append(msg, &array);
+ connman_dbus_dict_open(&array, &dict);
+
+ connman_dbus_dict_append_dict(&dict, key, function, user_data);
+
+ connman_dbus_dict_close(&array, &dict);
+
+ g_dbus_send_message(connection, msg);
+
+ return TRUE;
+}
+
+dbus_bool_t connman_dbus_setting_changed_array(const char *owner,
+ const char *path, const char *key, int type,
+ connman_dbus_append_cb_t function,
+ void *user_data)
+{
+ DBusMessage *msg;
+ DBusMessageIter array, dict;
+
+ if (owner == NULL || path == NULL)
+ return FALSE;
+
+ msg = dbus_message_new_method_call(owner, path,
+ CONNMAN_NOTIFICATION_INTERFACE,
+ "Update");
+ if (msg == NULL)
+ return FALSE;
+
+ dbus_message_iter_init_append(msg, &array);
+ connman_dbus_dict_open(&array, &dict);
+
+ connman_dbus_dict_append_array(&dict, key, type, function, user_data);
+
+ connman_dbus_dict_close(&array, &dict);
+
+ g_dbus_send_message(connection, msg);
+
+ return TRUE;
+}
+
+dbus_bool_t __connman_dbus_append_objpath_dict_array(DBusMessage *msg,
+ connman_dbus_append_cb_t function, void *user_data)
+{
+ DBusMessageIter iter, array;
+
+ if (msg == NULL || function == NULL)
+ return FALSE;
+
+ dbus_message_iter_init_append(msg, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_STRUCT_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_OBJECT_PATH_AS_STRING
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING
+ DBUS_STRUCT_END_CHAR_AS_STRING, &array);
+
+ function(&array, user_data);
+
+ dbus_message_iter_close_container(&iter, &array);
+
+ return TRUE;
+}
+
DBusConnection *connman_dbus_get_connection(void)
{
if (connection == NULL)
int __connman_dbus_init(DBusConnection *conn)
{
+ DBG("");
+
connection = conn;
return 0;
void __connman_dbus_cleanup(void)
{
+ DBG("");
+
connection = NULL;
}