Add internal api for touchscreen control 91/222791/2 accepted/tizen_4.0_unified tizen_4.0 accepted/tizen/4.0/unified/20200128.073727 submit/tizen_4.0/20200128.020239
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 20 Jan 2020 04:18:17 +0000 (13:18 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Wed, 22 Jan 2020 07:14:53 +0000 (16:14 +0900)
Change-Id: I3dc5d2d6cda301fcf7a627229275ce997b339cba
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
include/touchscreen-internal.h [new file with mode: 0644]
src/dbus.h
src/touchscreen-internal.c [new file with mode: 0644]

diff --git a/include/touchscreen-internal.h b/include/touchscreen-internal.h
new file mode 100644 (file)
index 0000000..6e2a7c2
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_SYSTEM_TOUCHSCREEN_INTERNAL_H__
+#define __TIZEN_SYSTEM_TOUCHSCREEN_INTERNAL_H__
+
+#include <gio/gio.h>
+
+typedef void (*dbus_pending_cb)(void *data, GVariant *result, GError *err);
+
+int device_touchscreen_enable(dbus_pending_cb cb);
+int device_touchscreen_disable(dbus_pending_cb cb);
+
+#endif
index 11d13ce9c88a76a9567f864e9f6be9911bfea461..51a40dba81ea86e34038a55f9819fdf5fda6395e 100644 (file)
@@ -34,7 +34,7 @@
 #define DEVICED_PATH_BATTERY                DEVICED_OBJECT_PATH"/Battery"
 #define DEVICED_INTERFACE_BATTERY           DEVICED_INTERFACE_NAME".Battery"
 
-/* Haptic service: operatioins about haptic */
+/* Haptic service: operations about haptic */
 #define VIBRATOR_BUS_NAME                   "org.tizen.system.vibrator"
 #define VIBRATOR_OBJECT_PATH                "/Org/Tizen/System/Vibrator"
 #define VIBRATOR_INTERFACE_NAME                    VIBRATOR_BUS_NAME
 #define DEVICED_PATH_IR                  DEVICED_OBJECT_PATH"/Ir"
 #define DEVICED_INTERFACE_IR             DEVICED_INTERFACE_NAME".ir"
 
+/* Touchscreen service: operations about touchscreen */
+#define DEVICED_PATH_TOUCH                        DEVICED_OBJECT_PATH"/Touch"
+#define DEVICED_INTERFACE_TOUCH                   DEVICED_INTERFACE_NAME".touch"
+
 struct dbus_int {
        int *list;
        int size;
diff --git a/src/touchscreen-internal.c b/src/touchscreen-internal.c
new file mode 100644 (file)
index 0000000..6160c8d
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "common.h"
+#include "dbus.h"
+#include "touchscreen-internal.h"
+
+#define METHOD_TOUCHSCREEN_ENABLE  "Enable"
+#define METHOD_TOUCHSCREEN_DISABLE "Disable"
+
+int device_touchscreen_enable(dbus_pending_cb cb)
+{
+       int ret;
+       ret = dbus_method_async_with_reply(DEVICED_BUS_NAME,
+                       DEVICED_PATH_TOUCH, DEVICED_INTERFACE_TOUCH,
+                       METHOD_TOUCHSCREEN_ENABLE, NULL, NULL, cb, -1, NULL);
+
+       return errno_to_device_error(ret);
+}
+
+int device_touchscreen_disable(dbus_pending_cb cb)
+{
+       int ret;
+       ret = dbus_method_async_with_reply(DEVICED_BUS_NAME,
+                       DEVICED_PATH_TOUCH, DEVICED_INTERFACE_TOUCH,
+                       METHOD_TOUCHSCREEN_DISABLE, NULL, NULL, cb, -1, NULL);
+
+       return errno_to_device_error(ret);
+}