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 ret = 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 _R("[NG] ---- %s", __func__);
51 _R("[OK] ---- %s", __func__);
52 unregister_edbus_signal_handler();
56 static int register_edbus_signal_handler(void)
62 edbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
65 goto edbus_handler_out;
68 edbus_handler = e_dbus_signal_handler_add(edbus_conn, NULL, DEVICED_PATH_TIME,
69 DEVICED_INTERFACE_TIME, TIME_CHANGE_SIGNAL, time_changed, NULL);
70 if (!(edbus_handler)) {
72 goto edbus_handler_connection_out;
76 edbus_handler_connection_out:
77 e_dbus_connection_close(edbus_conn);
83 static void test_signal(void)
86 register_edbus_signal_handler();
87 ecore_main_loop_begin();
90 static void time_init(void *data)
94 static void time_exit(void *data)
98 static int time_unit(int argc, char **argv)
104 if (strcmp("wait", argv[2]) == 0)
109 static const struct test_ops power_test_ops = {
110 .priority = TEST_PRIORITY_NORMAL,
117 TEST_OPS_REGISTER(&power_test_ops)