/**
* @platform
+ * @brief Initializes system, check input generate functions are supported and then open events generator devices with given name.
+ * @since_tizen 4.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/inputgenerator
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @remarks The dev_type is changed into the unsigned int to perform bitwise operations.
+ * @param[in] dev_type The device type want to generate events (ex> #EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | #EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
+ * @param[in] name The device name (maximum 31 characters)
+ * @return #efl_util_inputgen_h on success, otherwise @c NULL
+ * @retval #efl_util_inputgen_h The input generator handle
+ * @exception #EFL_UTIL_ERROR_NONE Successful
+ * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address
+ * @exception #EFL_UTIL_ERROR_INVALID_OPERATION Function not implemented
+ * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @see efl_util_input_deinitialize_generator()
+ */
+API efl_util_inputgen_h efl_util_input_initialize_generator_with_name(unsigned int dev_type, const char *name);
+
+/**
+ * @platform
* @brief Deinitializes system and close opened devices.
* @since_tizen $TZ_CFG_VER_24_OR_30$
* @privlevel platform
struct _efl_util_inputgen_h
{
unsigned int init_type;
+ char name[32];
};
static void
return NULL;
}
+API efl_util_inputgen_h
+efl_util_input_initialize_generator_with_name(unsigned int dev_type, const char *name)
+{
+ int ret = EFL_UTIL_ERROR_NONE;
+ efl_util_inputgen_h inputgen_h = NULL;
+ unsigned int clas = 0x0;
+
+ if (!dev_type ||
+ dev_type & ~(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN
+ | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD
+ | EFL_UTIL_INPUT_DEVTYPE_POINTER))
+ {
+ set_last_result(EFL_UTIL_ERROR_NO_SUCH_DEVICE);
+ goto out;
+ }
+
+ inputgen_h = (efl_util_inputgen_h)calloc(1, sizeof(struct _efl_util_inputgen_h));
+ if (!inputgen_h)
+ {
+ set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
+ goto out;
+ }
+
+ inputgen_h->init_type |= dev_type;
+ strncpy(inputgen_h->name, name, 31);
+
+ ret = _wl_init();
+ if (ret == (int)EINA_FALSE)
+ {
+ set_last_result(EFL_UTIL_ERROR_INVALID_PARAMETER);
+ goto out;
+ }
+
+ if (dev_type & EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN)
+ clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_TOUCHSCREEN;
+ if (dev_type & EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
+ clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_KEYBOARD;
+ if (dev_type & EFL_UTIL_INPUT_DEVTYPE_POINTER)
+ clas |= TIZEN_INPUT_DEVICE_MANAGER_CLAS_MOUSE;
+
+ while (!_eflutil.wl.devmgr.devicemgr)
+ wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+
+ tizen_input_device_manager_init_generator_with_name(_eflutil.wl.devmgr.devicemgr, clas, inputgen_h->name);
+
+ while (_eflutil.wl.devmgr.request_notified == -1)
+ wl_display_dispatch_queue(_eflutil.wl.dpy, _eflutil.wl.queue);
+
+ ret = _efl_util_input_convert_input_generator_error(_eflutil.wl.devmgr.request_notified);
+ _eflutil.wl.devmgr.request_notified = -1;
+
+ set_last_result(ret);
+ if (ret != TIZEN_INPUT_DEVICE_MANAGER_ERROR_NONE)
+ goto out;
+
+ return inputgen_h;
+
+out:
+ if (inputgen_h)
+ {
+ free(inputgen_h);
+ inputgen_h = NULL;
+ }
+ return NULL;
+}
+
+
API int
efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h)
{