90361230e84b8a8d18f8abbf58ba9de41e9cbe85
[profile/ivi/ico-uxf-homescreen.git] / lib / system-controller / CicoSCWlInputMgrIF.cpp
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full tWlExt of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9
10 //==========================================================================
11 /**
12  *  @file   CicoSCWlInputMgrIF.cpp
13  *
14  *  @brief  This file implementation of CicoSCInputDev class
15  */
16 //==========================================================================
17
18 #include <cstring>
19
20 #include <string>
21 using namespace std;
22
23 #include "CicoSCWlInputMgrIF.h"
24 #include "CicoSCWayland.h"
25 #include "CicoLog.h"
26
27 //--------------------------------------------------------------------------
28 /**
29  *  @brief  default constructor
30  */
31 //--------------------------------------------------------------------------
32 CicoSCWlInputMgrIF::CicoSCWlInputMgrIF()
33 {
34 }
35
36 //--------------------------------------------------------------------------
37 /**
38  *  @brief  destructor
39  */
40 //--------------------------------------------------------------------------
41 CicoSCWlInputMgrIF::~CicoSCWlInputMgrIF()
42 {
43 }
44
45 //--------------------------------------------------------------------------
46 /**
47  *  @brief  initialize input interfaces
48  *
49  *  @param [in] data        user data
50  *  @param [in] registry    wayland registry
51  *  @param [in] name        wayland display id
52  *  @parma [in] interface   wayland interface name
53  *  @parma [in] version     wayland interface version number
54  */
55 //--------------------------------------------------------------------------
56 void
57 CicoSCWlInputMgrIF::initInterface(void               *data,
58                                   struct wl_registry *registry,
59                                   uint32_t           name,
60                                   const char         *interface,
61                                   uint32_t           version)
62 {
63     ICO_TRA("CicoSCWlInputMgrIF::initInterface : Enter(interface=%s)", interface);
64     m_initialized = true;
65     ICO_TRA("CicoSCWlInputMgrIF::initInterface Leave");
66 }
67
68 //--------------------------------------------------------------------------
69 /**
70  *  @brief  wrapper function add_input_app
71  *
72  *  @param [in] appid   application id
73  *  @param [in] device  input device name
74  *  @param [in] input   input number
75  *  @parma [in] fix     fixed assign flag
76  *  @parma [in] keycode assigned keycode value
77  */
78 //--------------------------------------------------------------------------
79 void
80 CicoSCWlInputMgrIF::addInputApp(const string &appid,
81                                 const string &device,
82                                 int          input,
83                                 int          fix,
84                                 int          keycode)
85 {
86     ICO_DBG("called: add_input_app"
87             "(appid=%s device=%s input=%d fix=%d keycode=%d)",
88             appid.c_str(), device.c_str(), input, fix, keycode);
89 }
90
91 //--------------------------------------------------------------------------
92 /**
93  *  @brief  wrapper function del_input_app
94  *
95  *  @param [in] appid   application id
96  *  @param [in] device  input device name
97  *  @param [in] input   input number
98  */
99 //--------------------------------------------------------------------------
100 void
101 CicoSCWlInputMgrIF::delInputApp(const string &appid,
102                                 const string &device,
103                                 int          input)
104 {
105     ICO_DBG("called: del_input_app"
106             "(appid=%s device=%s input=%d)",
107             appid.c_str(), device.c_str(), input);
108 }
109
110 //--------------------------------------------------------------------------
111 /**
112  *  @brief  wrapper function set_input_region
113  *
114  *  @param [in] target    target window name(winname@appid)
115  *  @param [in] x         region x positon
116  *  @param [in] y         region y positon
117  *  @param [in] width     region width
118  *  @param [in] height    region height
119  *  @param [in] hotspot_x hotspot x position
120  *  @param [in] hotspot_y hotspot y position
121  *  @param [in] cursor_x  cursor x position
122  *  @param [in] cursor_y  cursor y position
123  *  @param [in] cursor_width  cursor width
124  *  @param [in] cursor_height cursor height
125  *  @param [in] attr      region attribute
126  */
127 //--------------------------------------------------------------------------
128 void
129 CicoSCWlInputMgrIF::setInputRegion(const string &target,
130                                    int x,
131                                    int y,
132                                    int width,
133                                    int height,
134                                    int hotspot_x,
135                                    int hotspot_y,
136                                    int cursor_x,
137                                    int cursor_y,
138                                    int cursor_width,
139                                    int cursor_height,
140                                    int attr)
141 {
142     ICO_DBG("called: set_input_region"
143             "(target=%s x/y=%d/%d w/h=%d/%d hot=%d/%d "
144             "cursor=%d/%d-%d/%d attr=%d)",
145             target.c_str(), x, y, width, height, hotspot_x, hotspot_y,
146             cursor_x, cursor_y, cursor_width, cursor_height, attr);
147 }
148
149 //--------------------------------------------------------------------------
150 /**
151  *  @brief  wrapper function unset_input_region
152  *
153  *  @param [in] target    target window name(winname@appid)
154  *  @param [in] x         region x positon
155  *  @param [in] y         region y positon
156  *  @param [in] width     region width
157  *  @param [in] height    region height
158  */
159 //--------------------------------------------------------------------------
160 void
161 CicoSCWlInputMgrIF::unsetInputRegion(const string &target,
162                                      int x,
163                                      int y,
164                                      int width,
165                                      int height)
166 {
167     ICO_DBG("called: unset_input_region"
168             "(target=%s x=%d y=%d width=%d height=%d",
169             target.c_str(), x, y, width, height);
170 }
171
172 //--------------------------------------------------------------------------
173 /**
174  *  @brief  callback to application for input switch information
175  *
176  *  @param [in] data        user data
177  *  @param [in] device      input device name
178  *  @param [in] type        input device type (as enum type)
179  *  @param [in] swname      input switch name
180  *  @param [in] input       input switch number
181  *  @param [in] codename    input code name
182  *  @param [in] code        input code number
183  */
184 //--------------------------------------------------------------------------
185 void
186 CicoSCWlInputMgrIF::capabilitiesCB(void               *data,
187                                    const char         *device,
188                                    int32_t            type,
189                                    const char         *swname,
190                                    int32_t            input,
191                                    const char         *codename,
192                                    int32_t            code)
193 {
194     ICO_WRN("CicoSCWlInputMgrIF::capabilitiesCB called.");
195 }
196
197 //--------------------------------------------------------------------------
198 /**
199  *  @brief  callback to application for input code information
200  *
201  *  @param [in] data        user data
202  *  @param [in] device      input device name
203  *  @param [in] input       input switch number
204  *  @param [in] codename    input code name
205  *  @param [in] code        input code number
206  */
207 //--------------------------------------------------------------------------
208 void
209 CicoSCWlInputMgrIF::codeCB(void               *data,
210                            const char         *device,
211                            int32_t            input,
212                            const char         *codename,
213                            int32_t            code)
214 {
215     ICO_WRN("CicoSCWlInputMgrIF::codeCB called.");
216 }
217
218 //--------------------------------------------------------------------------
219 /**
220  *  @brief  callback to application for switch input
221  *
222  *  @param [in] data        user data
223  *  @param [in] time        input time of millisecond
224  *  @param [in] device      input device name
225  *  @param [in] input       input switch number
226  *  @param [in] code        input switch code
227  *  @param [in] state       Of/Off status
228  */
229 //--------------------------------------------------------------------------
230 void
231 CicoSCWlInputMgrIF::inputCB(void               *data,
232                             uint32_t           time,
233                             const char         *device,
234                             int32_t            input,
235                             int32_t            code,
236                             int32_t            state)
237 {
238     ICO_WRN("CicoSCWlInputMgrIF::inputCB called.");
239 }
240
241 //--------------------------------------------------------------------------
242 /**
243  *  @brief  callback to application for change input region
244  *
245  *  @param [in] data                user data
246  *  @param [in] region              input regions
247  */
248 //--------------------------------------------------------------------------
249 void
250 CicoSCWlInputMgrIF::regionCB(void                        *data,
251                              struct wl_array             *region)
252 {
253     ICO_WRN("CicoSCWlInputMgrIF::regionCB called.");
254 }
255
256 //==========================================================================
257 // private method
258 //==========================================================================
259
260 //--------------------------------------------------------------------------
261 /**
262  *  @brief  callback to application for input switch information
263  *
264  *  @param [in] data        user data
265  *  @param [in] device      input device name
266  *  @param [in] type        input device type (as enum type)
267  *  @param [in] swname      input switch name
268  *  @param [in] input       input switch number
269  *  @param [in] codename    input code name
270  *  @param [in] code        input code number
271  */
272 //--------------------------------------------------------------------------
273 void
274 CicoSCWlInputMgrIF::wlCapabilitiesCB(void               *data,
275                                      const char         *device,
276                                      int32_t            type,
277                                      const char         *swname,
278                                      int32_t            input,
279                                      const char         *codename,
280                                      int32_t            code)
281 {
282     if (NULL == data) {
283         ICO_WRN("wlCapabilitiesCB: data is null");
284         return;
285     }
286     static_cast<CicoSCWlInputMgrIF*>(data)->capabilitiesCB(data, device, type,
287                                                            swname, input,
288                                                            codename, code);
289 }
290
291 //--------------------------------------------------------------------------
292 /**
293  *  @brief  callback to application for input code information
294  *
295  *  @param [in] data        user data
296  *  @param [in] device      input device name
297  *  @param [in] input       input switch number
298  *  @param [in] codename    input code name
299  *  @param [in] code        input code number
300  */
301 //--------------------------------------------------------------------------
302 void
303 CicoSCWlInputMgrIF::wlCodeCB(void               *data,
304                              const char         *device,
305                              int32_t            input,
306                              const char         *codename,
307                              int32_t            code)
308 {
309     if (NULL == data) {
310         ICO_WRN("wlCodeCB: data is null");
311         return;
312     }
313     static_cast<CicoSCWlInputMgrIF*>(data)->codeCB(data, device, input,
314                                                    codename, code);
315 }
316
317 //--------------------------------------------------------------------------
318 /**
319  *  @brief  callback to application for switch input
320  *
321  *  @param [in] data        user data
322  *  @param [in] time        input time of millisecond
323  *  @param [in] device      input device name
324  *  @param [in] input       input switch number
325  *  @param [in] code        input switch code
326  *  @param [in] state       Of/Off status
327  */
328 //--------------------------------------------------------------------------
329 void
330 CicoSCWlInputMgrIF::wlInputCB(void               *data,
331                               uint32_t           time,
332                               const char         *device,
333                               int32_t            input,
334                               int32_t            code,
335                               int32_t            state)
336 {
337     if (NULL == data) {
338         ICO_WRN("wlInputCB: data is null");
339         return;
340     }
341     static_cast<CicoSCWlInputMgrIF*>(data)->inputCB(data, time, device, input,
342                                                     code, state);
343 }
344
345 //--------------------------------------------------------------------------
346 /**
347  *  @brief  callback to application for change input region
348  *
349  *  @param [in] data                user data
350  *  @param [in] region              input regions
351  */
352 //--------------------------------------------------------------------------
353 void
354 CicoSCWlInputMgrIF::wlRegionCB(void                        *data,
355                                struct wl_array             *region)
356 {
357     if (NULL == data) {
358         ICO_WRN("wlRegionCB: data is null");
359         return;
360     }
361     static_cast<CicoSCWlInputMgrIF*>(data)->regionCB(data, region);
362 }
363 // vim:set expandtab ts=4 sw=4: