touchscreen: Add device_touchscreen_set_off_bind_with_display() 25/321425/3 accepted/tizen/7.0/unified/20250324.150514
authorYunhee Seo <yuni.seo@samsung.com>
Fri, 21 Mar 2025 05:38:51 +0000 (14:38 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Fri, 21 Mar 2025 06:39:49 +0000 (15:39 +0900)
Supports touchscreen off operation policy as setter.
Combines touchscreen off operation with display off operation.
If sets touchscreen off mode value as true,
When the display state goes to off, touchscreen will be disabled(off state).
That means touchscreen always follows display off operation.
If touchscreen off mode value is set as false,
Then touchscreen will ignore display off state independently.

Change-Id: Ie5e5c600faf80f92cd5f14d11a9ec90a518293c4
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
include/touchscreen-internal.h
src/touchscreen-internal.c

index ceff76befdb736641811a4adbcbdd7a1d107425a..b8655db6c227f98a8310d2a991fe6b471ad0e798 100644 (file)
@@ -114,4 +114,39 @@ int device_touchscreen_enable(touchscreen_pending_cb cb);
  */
 int device_touchscreen_disable(touchscreen_pending_cb cb);
 
+/**
+ * @brief Combines the touchscreen off operation with the display off operation.
+ * @details This sets the option that follows the display off operation.
+ *          If the @a mode is true, the touchscreen will be turned off when the display is turned off.
+ *          If the @a mode is false, the touchscreen ignores off operation when the display is turned off.
+ *          After this set operation, the touchscreen off operation policy will be applied.
+ * @since_tizen 7.0
+ * @privilege %http://tizen.org/privilege/display
+ * @param[in] mode The value to set the touchscreen off operation policy.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @code
+ * #include <device/touchscreen-internal.h>
+ * ...
+ * int main(void)
+ * {
+ *     int ret = 0;
+ *     // This sets the touchscreen off operation policy to follow the display off operation.
+ *     ret = device_touchscreen_set_off_bind_with_display(true);
+ *     ...
+ *     // This sets the touchscreen off operation policy to ignore the display off operation.
+ *     ret = device_touchscreen_set_off_bind_with_display(false);
+ *     ...
+ *     return 0;
+ * }
+ * ...
+ * @endcode
+ * @see device_touchscreen_enable()
+ * @see device_touchscreen_disable()
+ */
+int device_touchscreen_set_off_bind_with_display(bool mode);
+
 #endif
index f5eabfcf7941336435c0df9d91e151fce977f0c8..8718ae491286027a7bc048aae6ea7188055a6c7a 100644 (file)
@@ -21,6 +21,7 @@
 
 #define METHOD_TOUCHSCREEN_ENABLE  "Enable"
 #define METHOD_TOUCHSCREEN_DISABLE "Disable"
+#define METHOD_TOUCHSCREEN_SET_OFF_MODE "StayTouchScreenOff"
 
 //LCOV_EXCL_START Not tested API
 int device_touchscreen_enable(dbus_pending_cb cb)
@@ -47,3 +48,17 @@ int device_touchscreen_disable(dbus_pending_cb cb)
        return errno_to_device_error(ret_dbus);
 }
 //LCOV_EXCL_STOP
+
+int device_touchscreen_set_off_bind_with_display(bool mode)
+{
+       int ret = 0;
+
+       ret = gdbus_call_sync_with_reply(DEVICED_BUS_NAME,
+                       DEVICED_PATH_DISPLAY,
+                       DEVICED_INTERFACE_DISPLAY,
+                       METHOD_TOUCHSCREEN_SET_OFF_MODE,
+                       g_variant_new("(i)", (int)mode),
+                       NULL);
+
+       return errno_to_device_error(ret);
+}
\ No newline at end of file