Tizen Native API
9.0
|
Generate touch and key events.
Required Header
#include <efl_util.h>
Overview
The EFL UTIL API provides functions to initialize/deinitialize input devices and to generate touch / key events.
You can generate key input events that emulate various hardware key presses, touch input events that emulate screen touches, and point input events that emulate mouse moves or clicks.
Generating Key Input Events
To generate key input events, follow these steps: 1. Create the efl_util_inputgen_h structure and initialize the structure members with efl_util_input_initialize_generator(), efl_util_input_initialize_generator_with_name(), or efl_util_input_initialize_generator_with_sync(). 2. After setting the input device type, to generate key input events call efl_util_input_generate_key(). 3. When no longer needed, free the efl_util_inputgen_h structure with efl_util_input_deinitialize_generator().
Generating Touch Input Events
To generate touch input events, follow these steps: 1. Create the efl_util_inputgen_h structure and initialize the structure members with efl_util_input_initialize_generator (), efl_util_input_initialize_generator_with_name(), or efl_util_input_initialize_generator_with_sync(). 2. After setting the input device type, to generate touch input events call efl_util_input_generate_touch() or efl_util_input_generate_touch_axis(). 3. When no longer needed, free the efl_util_inputgen_h structure with efl_util_input_deinitialize_generator().
Generating Point Input Events
To generate point input events, follow these steps: 1. Create the efl_util_inputgen_h structure and initialize the structure members with efl_util_input_initialize_generator(), efl_util_input_initialize_generator_with_name(), or efl_util_input_initialize_generator_with_sync(). 2. After setting the input device type, to generate point input events call efl_util_input_generate_pointer(). 3. When no longer needed, free the efl_util_inputgen_h structure with efl_util_input_deinitialize_generator().
Functions | |
efl_util_inputgen_h | efl_util_input_initialize_generator (unsigned int dev_type) |
Initializes system and check input generate functions are supported, open devices generated events. | |
efl_util_inputgen_h | efl_util_input_initialize_generator_with_name (unsigned int dev_type, const char *name) |
Initializes system, check input generate functions are supported and then open events generator devices with given name. | |
efl_util_inputgen_h | efl_util_input_initialize_generator_with_sync (unsigned int dev_type, const char *name) |
Initializes the system, checks if input generated functions are supported and then open events generator devices synchronously. | |
int | efl_util_input_set_touch_count (int max_count) |
Requests to set the maximum touch count. | |
int | efl_util_input_deinitialize_generator (efl_util_inputgen_h inputgen_h) |
Deinitializes system and close opened devices. | |
int | efl_util_input_generate_key (efl_util_inputgen_h inputgen_h, const char *key_name, int pressed) |
Generates all of key events using a opened device. | |
int | efl_util_input_generate_touch (efl_util_inputgen_h inputgen_h, int idx, efl_util_input_touch_type_e touch_type, int x, int y) |
Generates a touch event using a opened device. | |
int | efl_util_input_generate_pointer (efl_util_inputgen_h inputgen_h, int buttons, efl_util_input_pointer_type_e pointer_type, int x, int y) |
Generates a pointer event using a opened device. | |
int | efl_util_input_generate_wheel (efl_util_inputgen_h inputgen_h, efl_util_input_pointer_wheel_type_e wheel_type, int value) |
Generates a wheel event using an opened device. | |
int | efl_util_input_generate_touch_axis (efl_util_inputgen_h inputgen_h, int idx, efl_util_input_touch_type_e touch_type, int x, int y, double radius_x, double radius_y, double pressure, double angle, double palm) |
Generates a touch event using an opened device. | |
Typedefs | |
typedef struct _efl_util_inputgen_h * | efl_util_inputgen_h |
Definition for the input generator handle. |
Typedef Documentation
typedef struct _efl_util_inputgen_h* efl_util_inputgen_h |
Definition for the input generator handle.
- Warning:
- This is not for use by third-party applications.
- Since :
- 2.4
Enumeration Type Documentation
Enumeration of device type generated events.
- Warning:
- This is not for use by third-party applications.
- Since :
- 2.4
- Enumerator:
Enumeration of touch event types.
- Warning:
- This is not for use by third-party applications.
- Since :
- 2.4
- Enumerator:
Function Documentation
int efl_util_input_deinitialize_generator | ( | efl_util_inputgen_h | inputgen_h | ) |
Deinitializes system and close opened devices.
- Warning:
- This is not for use by third-party applications.
- Since :
- 2.4
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/inputgenerator
- Parameters:
-
[in] inputgen_h The efl_util_inputgen_h handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to deinitialize input generator EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
int efl_util_input_generate_key | ( | efl_util_inputgen_h | inputgen_h, |
const char * | key_name, | ||
int | pressed | ||
) |
Generates all of key events using a opened device.
- Warning:
- This is not for use by third-party applications.
- Since :
- 2.4
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/inputgenerator
- Parameters:
-
[in] inputgen_h The efl_util_inputgen_h handle [in] key_name The key name want to generate [in] pressed The value that select key press or release (0: release, 1: press)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to generate key EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
int efl_util_input_generate_pointer | ( | efl_util_inputgen_h | inputgen_h, |
int | buttons, | ||
efl_util_input_pointer_type_e | pointer_type, | ||
int | x, | ||
int | y | ||
) |
Generates a pointer event using a opened device.
- Warning:
- This is not for use by third-party applications.
- Since :
- 3.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/inputgenerator
- Parameters:
-
[in] inputgen_h The efl_util_inputgen_h handle [in] buttons The number of button [in] pointer_type The pointer type (ex> #EFL_UTIL_INPUT_POINTER_BUTTON_PRESS, EFL_UTIL_INPUT_POINTER_BUTTON_UP, EFL_UTIL_INPUT_POINTER_MOVE) [in] x x coordination to move [in] y y coordination to move
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to generate pointer EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
int efl_util_input_generate_touch | ( | efl_util_inputgen_h | inputgen_h, |
int | idx, | ||
efl_util_input_touch_type_e | touch_type, | ||
int | x, | ||
int | y | ||
) |
Generates a touch event using a opened device.
- Warning:
- This is not for use by third-party applications.
- Since :
- 2.4
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/inputgenerator
- Parameters:
-
[in] inputgen_h The efl_util_inputgen_h handle [in] idx The index of touched finger [in] touch_type The touch type (ex> EFL_UTIL_INPUT_TOUCH_BEGIN, EFL_UTIL_INPUT_TOUCH_UPDATE, EFL_UTIL_INPUT_TOUCH_END) [in] x The x axis of touch point [in] y The y axis of touch point
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to generate touch EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
int efl_util_input_generate_touch_axis | ( | efl_util_inputgen_h | inputgen_h, |
int | idx, | ||
efl_util_input_touch_type_e | touch_type, | ||
int | x, | ||
int | y, | ||
double | radius_x, | ||
double | radius_y, | ||
double | pressure, | ||
double | angle, | ||
double | palm | ||
) |
Generates a touch event using an opened device.
- Warning:
- This is not for use by third-party applications.
Normally touch events are represented by a specific point (x, y). But there are many contact points between touchscreen and fingers. The coordinates (x, y) are the center of the contact area, and the area where the finger and the touchscreen come into contact is represented with an ellipse. To give information about the size of the touching cllipse, use radius_x and radius_y. The value of idx is touch index used in multi-touch. 0 means first touch, 1 means second touch and the index increases further. General devices support 10 touch indices(0 ~ 9), but this may differ depending on the device. Some devices may not support the palm value, and this value is closely dependent on device. The value of x, y, radius_x, radius_y, pressure and palm must be greater than 0. The angle is the angle between the vertical edge of the device and the y-axis of the ellipse. If the angle is 0, then the ellipse's y-axis is parallel to the device's vertical edge.
- Since :
- 5.5
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/inputgenerator
- Parameters:
-
[in] inputgen_h The efl_util_inputgen_h handle [in] idx The index of the touching finger, used in multi-touch [in] touch_type The touch type (ex> EFL_UTIL_INPUT_TOUCH_BEGIN, EFL_UTIL_INPUT_TOUCH_UPDATE, EFL_UTIL_INPUT_TOUCH_END) [in] x The x coordinate of the touch point [in] y The y coordinate of the touch point [in] radius_x The x-axis radius of the touching ellipse before rotation [in] radius_y The y-axis radius of the touching ellipse before rotation [in] pressure The pressure on the contact touch area [in] angle The rotation angle of the touching ellipse, in degrees [in] palm The palm area of the contact touch area
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_NOT_SUPPORTED Not supported EFL_UTIL_ERROR_PERMISSION_DENIED No permission to generate a touch event EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
int efl_util_input_generate_wheel | ( | efl_util_inputgen_h | inputgen_h, |
efl_util_input_pointer_wheel_type_e | wheel_type, | ||
int | value | ||
) |
Generates a wheel event using an opened device.
- Warning:
- This is not for use by third-party applications.
Commonly wheel events are generated with one of two orientations, vertical and horizontal. efl_util_input_pointer_wheel_type_e has enums for orientations. For each orientation there is a value which represents both size and direction. For EFL_UTIL_INPUT_POINTER_WHEEL_VERT, if the value is positive, the direction is "up", if it's negative, the direction is "down" For EFL_UTIL_INPUT_POINTER_WHEEL_HORZ, if the value is positive, the direction is "right", if it's negative, the direction is "left" General mouse devices generate wheel events with value 1 or -1, but some mouse devices have a smooth wheel which generates wheel events with value bigger than absolute 1.
- Since :
- 5.5
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/inputgenerator
- Parameters:
-
[in] inputgen_h The efl_util_inputgen_h handle [in] wheel_type The wheel type (ex> EFL_UTIL_INPUT_POINTER_WHEEL_VERT, EFL_UTIL_INPUT_POINTER_WHEEL_HORZ) [in] value The wheel value
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_NOT_SUPPORTED Not supported EFL_UTIL_ERROR_PERMISSION_DENIED No permission to generate a wheel event EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
efl_util_inputgen_h efl_util_input_initialize_generator | ( | unsigned int | dev_type | ) |
Initializes system and check input generate functions are supported, open devices generated events.
- Warning:
- This is not for use by third-party applications.
- Since :
- 2.4
- Privilege Level:
- 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.
- The dev_type is changed into the unsigned int to perform bitwise operations. (Since 3.0)
- The returned object should be released with efl_util_input_deinitialize_generator().
- Parameters:
-
[in] dev_type The device type want to generate events (ex> EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
- Returns:
- efl_util_inputgen_h on success, otherwise
NULL
- Exceptions:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to initialize input generator EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address EFL_UTIL_ERROR_INVALID_OPERATION Function not implemented EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
efl_util_inputgen_h efl_util_input_initialize_generator_with_name | ( | unsigned int | dev_type, |
const char * | name | ||
) |
Initializes system, check input generate functions are supported and then open events generator devices with given name.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- 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.
- The dev_type is changed into the unsigned int to perform bitwise operations.
- The returned object should be released with efl_util_input_deinitialize_generator().
- Parameters:
-
[in] dev_type The device type want to generate events (ex> EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD) [in] name The device name (maximum 31 characters)
- Returns:
- efl_util_inputgen_h on success, otherwise
NULL
- Exceptions:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to initialize input generator EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address EFL_UTIL_ERROR_INVALID_OPERATION Function not implemented EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
efl_util_inputgen_h efl_util_input_initialize_generator_with_sync | ( | unsigned int | dev_type, |
const char * | name | ||
) |
Initializes the system, checks if input generated functions are supported and then open events generator devices synchronously.
- Warning:
- This is not for use by third-party applications.
- Since :
- 5.0
- Privilege Level:
- 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.
- dev_type is changed into the unsigned int to perform bitwise operations.
- If the name is NULL, it will be set to "Input Generator"
- The returned object should be released with efl_util_input_deinitialize_generator().
- Parameters:
-
[in] dev_type The device type to generate events, values of efl_util_input_device_type_e combined with bitwise 'or'
Example: EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | EFL_UTIL_INPUT_DEVTYPE_KEYBOARD[in] name The device name (maximum 31 characters, can be NULL)
- Returns:
- efl_util_inputgen_h on success, otherwise
NULL
- Exceptions:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to initialize input generator EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address EFL_UTIL_ERROR_INVALID_OPERATION Function not implemented EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
int efl_util_input_set_touch_count | ( | int | max_count | ) |
Requests to set the maximum touch count.
- Warning:
- This is not for use by third-party applications.
- Since :
- 6.5
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/inputgenerator
- Remarks:
- If you would like to generate more touch count supported than the display server supports, you can use this API to increase the maximum touch count. Note that this API returns success only when there is no configuration enabled about maximum touch count in the display server.
- Parameters:
-
[in] max_count The maximum number of touches want to generate.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
EFL_UTIL_ERROR_NONE Successful EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to deinitialize input generator EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available