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 METHOD_COOL_DOWN_STATUS "GetCoolDownStatus"
22 #define METHOD_COOL_DOWN_CHANGED "CoolDownChanged"
23 static int get_status(void)
30 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
32 DEVICED_INTERFACE_SYSNOTI,
33 METHOD_COOL_DOWN_STATUS, NULL, NULL);
35 _E("fail : %s %s %s %s",
36 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
37 METHOD_COOL_DOWN_STATUS);
41 dbus_error_init(&err);
43 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &str,
46 _E("no message : [%s:%s]", err.name, err.message);
50 _R("[NG] ---- %s", __func__);
52 _R("[OK] ---- %s : V(%s)", __func__, str);
53 dbus_message_unref(msg);
54 dbus_error_free(&err);
58 static int cool_down(char *name, char *status)
65 param[0] = METHOD_SET_DEVICE;
70 msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
72 DEVICED_INTERFACE_SYSNOTI,
73 METHOD_COOL_DOWN_CHANGED, "siss", param);
75 _E("fail : %s %s %s %s",
76 DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI, DEVICED_INTERFACE_SYSNOTI,
81 dbus_error_init(&err);
83 ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID);
85 _E("no message : [%s:%s]", err.name, err.message);
86 dbus_error_free(&err);
89 _I("%s %s", name, status);
91 _R("[NG] ---- %s", __func__);
93 _R("[OK] ---- %s : V(%s %s)",
94 __func__, name, status);
95 dbus_message_unref(msg);
96 dbus_error_free(&err);
100 static void unit(char *unit, char *status)
104 cool_down(unit, status);
108 static void cool_down_init(void *data)
112 static void cool_down_exit(void *data)
116 static int cool_down_unit(int argc, char **argv)
125 unit(argv[2], argv[3]);
130 static const struct test_ops cool_down_test_ops = {
131 .priority = TEST_PRIORITY_NORMAL,
133 .init = cool_down_init,
134 .exit = cool_down_exit,
135 .unit = cool_down_unit,
138 TEST_OPS_REGISTER(&cool_down_test_ops)