Add internal api for touchscreen control 71/222371/1
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 14 Jan 2020 05:31:22 +0000 (14:31 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 14 Jan 2020 05:39:42 +0000 (05:39 +0000)
Change-Id: Ibcbdebc9a4044588613b5c52c491a6b156ddffb8
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
(cherry picked from commit 72d5f78e37d71bafeeab11f77a8df76c3186851d)

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..d85de68
--- /dev/null
@@ -0,0 +1,11 @@
+#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 __TIZEN_SYSTEM_TOUCHSCREEN_INTERNAL_H__
index 8bea4e9..72ad857 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"
 
-/* Thermal service: operatioins about temperature */
+/* Thermal service: operations about temperature */
 #define DEVICED_PATH_TEMPERATURE                  DEVICED_OBJECT_PATH"/Temperature"
 #define DEVICED_INTERFACE_TEMPERATURE             DEVICED_INTERFACE_NAME".temperature"
 
+/* 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..081b4ad
--- /dev/null
@@ -0,0 +1,26 @@
+#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);
+}