5 * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 static DBusMessage *get_properties(DBusConnection *conn,
31 DBusMessage *msg, void *data)
34 DBusMessageIter array, dict;
38 reply = dbus_message_new_method_return(msg);
42 dbus_message_iter_init_append(reply, &array);
44 connman_dbus_dict_open(&array, &dict);
46 connman_dbus_dict_close(&array, &dict);
51 static DBusMessage *set_property(DBusConnection *conn,
52 DBusMessage *msg, void *data)
54 DBusMessageIter iter, value;
60 if (dbus_message_iter_init(msg, &iter) == FALSE)
61 return __connman_error_invalid_arguments(msg);
63 dbus_message_iter_get_basic(&iter, &name);
64 dbus_message_iter_next(&iter);
65 dbus_message_iter_recurse(&iter, &value);
67 type = dbus_message_iter_get_arg_type(&value);
69 return __connman_error_invalid_property(msg);
72 static GDBusMethodTable clock_methods[] = {
73 { "GetProperties", "", "a{sv}", get_properties },
74 { "SetProperty", "sv", "", set_property },
78 static GDBusSignalTable clock_signals[] = {
79 { "PropertyChanged", "sv" },
83 static DBusConnection *connection = NULL;
85 int __connman_clock_init(void)
89 connection = connman_dbus_get_connection();
90 if (connection == NULL)
93 g_dbus_register_interface(connection, CONNMAN_MANAGER_PATH,
94 CONNMAN_CLOCK_INTERFACE,
95 clock_methods, clock_signals,
101 void __connman_clock_cleanup(void)
105 if (connection == NULL)
108 g_dbus_unregister_interface(connection, CONNMAN_MANAGER_PATH,
109 CONNMAN_CLOCK_INTERFACE);
111 dbus_connection_unref(connection);