4 * Copyright (c) 2016 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.
24 #include "dbus_util.h"
27 #define CONTEXT_ORIENTATION_SIGNAL "orientation"
29 class injector_context_orientation : public injector {
31 injector_context_orientation(sensor_type_t sensor_type, const char *event_name);
32 virtual ~injector_context_orientation() {}
34 bool inject(int argc, char *argv[]);
37 injector_context_orientation::injector_context_orientation(sensor_type_t sensor_type, const char *event_name)
38 : injector(sensor_type, event_name)
42 bool injector_context_orientation::inject(int argc, char *argv[])
46 RETVM_IF(argc <= INJECTOR_ARGC, false, "Invalid argument\n");
48 variant = make_variant_int(argc - INJECTOR_ARGC, &argv[INJECTOR_ARGC]);
49 RETVM_IF(!variant, false, "Cannot make variant\n");
51 dbus_emit_signal(NULL,
52 (gchar *)SENSORD_OBJ_PATH,
53 (gchar *)SENSORD_INTERFACE_NAME,
54 (gchar *)CONTEXT_ORIENTATION_SIGNAL,
58 _I("Set up options to wristup:");
59 for (int i = 0; i < argc - INJECTOR_ARGC; ++i)
60 _I("option %d: %s\n", i, argv[i]);
65 REGISTER_INJECTOR(CONTEXT_SENSOR, CONTEXT_ORIENTATION_SIGNAL, injector_context_orientation)