4 * Copyright (c) 2012 - 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.
23 #include "core/devices.h"
24 #include "core/edbus-handler.h"
25 #include "core/launch.h"
27 static DBusMessage *edbus_testmode_launch(E_DBus_Object *obj, DBusMessage *msg)
38 dbus_error_init(&err);
40 if (!dbus_message_get_args(msg, &err,
41 DBUS_TYPE_STRING, &argv, DBUS_TYPE_INVALID)) {
42 _E("there is no message");
46 sprintf(param, "%s", argv);
47 _D("param %s", param);
49 launch_evenif_exist("/usr/bin/testmode-env.sh", param);
51 reply = dbus_message_new_method_return(msg);
52 dbus_message_iter_init_append(reply, &iter);
53 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
58 static DBusMessage *edbus_factory_15_launch(E_DBus_Object *obj, DBusMessage *msg)
69 dbus_error_init(&err);
71 if (!dbus_message_get_args(msg, &err,
72 DBUS_TYPE_STRING, &argv, DBUS_TYPE_INVALID)) {
73 _E("there is no message");
77 sprintf(param, "%s", argv);
78 _D("param %s", param);
80 launch_evenif_exist("/usr/bin/factory-15-env.sh", param);
82 reply = dbus_message_new_method_return(msg);
83 dbus_message_iter_init_append(reply, &iter);
84 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
90 static const struct edbus_method edbus_methods[] = {
91 { "Launch", "s", "i", edbus_testmode_launch },
92 { "factory15", "s", "i", edbus_factory_15_launch },
93 /* Add methods here */
96 /* battery ops init funcion */
97 static void testmode_init(void *data)
101 /* init dbus interface */
102 ret = register_edbus_method(DEVICED_PATH_TESTMODE,
103 edbus_methods, ARRAY_SIZE(edbus_methods));
105 _E("fail to init edbus method(%d)", ret);
108 /* battery ops exit funcion */
109 static void testmode_exit(void *data)
113 static const struct device_ops battery_device_ops = {
114 .priority = DEVICE_PRIORITY_NORMAL,
116 .init = testmode_init,
117 .exit = testmode_exit,
120 DEVICE_OPS_REGISTER(&battery_device_ops)