2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 * @brief heade for input device
22 #include "ico_uxf_private.h"
23 #include "ico_input_mgr-client-protocol.h"
25 extern Ico_Uxf_Api_Mng gIco_Uxf_Api_Mng;
27 /*--------------------------------------------------------------------------*/
29 * @brief ico_uxf_inputdev_attribute_get: get input device attribute
31 * @param[in] devidx input device index (0-)
33 * @retval !=NULL success(input device attribute address)
34 * @retval ==NULL error(device dose not exist)
36 /*--------------------------------------------------------------------------*/
37 ICO_APF_API Ico_Uxf_InputDev *
38 ico_uxf_inputdev_attribute_get(const int devidx)
40 Ico_Uxf_InputDev *pdev;
43 uifw_trace("ico_uxf_inputdev_attribute_get: Enter(%d)", devidx);
45 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
46 uifw_warn("ico_uxf_window_layer: Leave(ESRCH)");
50 pdev = gIco_Uxf_Api_Mng.InputDev;
52 while ((pdev != NULL) && (idx < devidx)) {
57 if ((pdev == NULL) || (idx != devidx)) {
58 uifw_trace("ico_uxf_inputdev_attribute_get: Leave(ENOENT)");
62 uifw_trace("ico_uxf_inputdev_attribute_get: Leave(EOK, device=%s)", pdev->device);
66 /*--------------------------------------------------------------------------*/
68 * @brief ico_uxf_inputsw_attribute_get: get input switch attribute
70 * @param[in] inputdev input device attribute
71 * @param[in] swidx input switch index (0-)
73 * @retval !=NULL success(input switch attribute address)
74 * @retval ==NULL error(device dose not exist)
76 /*--------------------------------------------------------------------------*/
77 ICO_APF_API Ico_Uxf_InputSw *
78 ico_uxf_inputsw_attribute_get(Ico_Uxf_InputDev *inputdev, const int swidx)
83 uifw_trace("ico_uxf_inputsw_attribute_get: Enter(%s,%d)",
84 inputdev ? inputdev->device : "(NULL)", swidx);
86 if (gIco_Uxf_Api_Mng.Initialized <= 0) {
87 uifw_warn("ico_uxf_inputsw_attribute_get: Leave(ESRCH)");
90 if ((inputdev == NULL) || (swidx < 0) || (swidx >= inputdev->numInputSw)) {
91 uifw_warn("ico_uxf_inputsw_attribute_get: Leave(device ENOENT)");
95 psw = inputdev->inputSw;
97 while ((psw != NULL) && (idx < swidx)) {
102 if ((psw == NULL) || (idx != swidx)) {
103 uifw_warn("ico_uxf_inputsw_attribute_get: Leave(switch ENOENT)");
107 uifw_trace("ico_uxf_inputsw_attribute_get: Leave(EOK, switch=%s.%s)",
108 inputdev->device, psw->swname);
112 /*--------------------------------------------------------------------------*/
114 * @brief Send request to Multi Input Manager
116 * @param[in] add switch add(=1)/delete(=0)
117 * @param[in] appid target application id
118 * @param[in] device target input device name
119 * @param[in] input target input switch number
120 * @param[in] keycode emulated keyboard key-code
121 * @return result status
122 * @retval ICO_UXF_EOK success(cullentry always success)
124 /*--------------------------------------------------------------------------*/
126 ico_uxf_input_control(const int add, const char *appid,
127 const char *device, const int input, const int keycode)
129 apfw_trace("ico_uxf_input_control: input switch %s %s %s.%d(%d)",
130 add ? "add" : "del", appid ? appid : "all-app",
131 device ? device : "all-device", input, keycode);
134 ico_input_mgr_control_add_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr, appid,
135 device, input, 0, keycode);
138 ico_input_mgr_control_del_input_app(gIco_Uxf_Api_Mng.Wayland_InputMgr, appid,