4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #define TIME_CHANGE_SIGNAL "STimeChanged"
23 static E_DBus_Signal_Handler *edbus_handler;
24 static E_DBus_Connection *edbus_conn;
26 static void unregister_edbus_signal_handler(void)
28 e_dbus_signal_handler_del(edbus_conn, edbus_handler);
29 e_dbus_connection_close(edbus_conn);
33 static void time_changed(void *data, DBusMessage *msg)
39 _I("edbus signal Received");
41 r = dbus_message_is_signal(msg, DEVICED_INTERFACE_TIME, TIME_CHANGE_SIGNAL);
43 _E("dbus_message_is_signal error");
47 _I("%s - %s", DEVICED_INTERFACE_TIME, TIME_CHANGE_SIGNAL);
49 unregister_edbus_signal_handler();
53 static int register_edbus_signal_handler(void)
59 edbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
62 goto edbus_handler_out;
65 edbus_handler = e_dbus_signal_handler_add(edbus_conn, NULL, DEVICED_PATH_TIME,
66 DEVICED_INTERFACE_TIME, TIME_CHANGE_SIGNAL, time_changed, NULL);
67 if (!(edbus_handler)) {
69 goto edbus_handler_connection_out;
73 edbus_handler_connection_out:
74 e_dbus_connection_close(edbus_conn);
80 static void test_signal(void)
83 register_edbus_signal_handler();
84 ecore_main_loop_begin();
87 static void time_init(void *data)
91 static void time_exit(void *data)
95 static int time_unit(int argc, char **argv)
101 if (strcmp("wait", argv[2]) == 0)
106 static const struct test_ops power_test_ops = {
107 .priority = TEST_PRIORITY_NORMAL,
114 TEST_OPS_REGISTER(&power_test_ops)