Additional functions of policy and resource management.
[profile/ivi/ico-uxf-homescreen.git] / lib / system-controller / CicoSCInputController.h
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 text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9
10 //==========================================================================
11 /**
12  *  @file   CicoSCInputController.h
13  *
14  *  @brief  This file is definition of CicoSCInputController class
15  */
16 //==========================================================================
17 #ifndef __CICO_SC_INPUT_CONTROLLER_H__
18 #define __CICO_SC_INPUT_CONTROLLER_H__
19
20 #include <string>
21 #include <vector>
22
23 #include "CicoSCWlInputMgrIF.h"
24
25 //==========================================================================
26 //  Forward declaration
27 //==========================================================================
28 class CicoSCCommand;
29 class CicoSCInputDev;
30 class CicoSCSwitch;
31
32 //--------------------------------------------------------------------------
33 /**
34  *  @brief  This class is controller of input device
35  */
36 //--------------------------------------------------------------------------
37 class CicoSCInputController : public CicoSCWlInputMgrIF
38 {
39 public:
40     // default constructor
41     CicoSCInputController();
42
43     // destructor
44     ~CicoSCInputController();
45
46     // initialize input device information 
47     int initDB(void);
48
49     // executes an input control process corresponding to the command
50     void handleCommand(const CicoSCCommand *cmd);
51
52     // register input device control application
53     int addInputApp(const std::string &appid,
54                     const std::string &device,
55                     int               input,
56                     int               fix,
57                     int               keycode);
58
59     // unregister input device control application
60     int delInputApp(const std::string &appid,
61                     const std::string &device,
62                     int               input);
63
64     // send input device event
65     int sendInputEvent(const std::string &appid,
66                        int               surfaceid,
67                        int               type,
68                        int               deviceno,
69                        int               code,
70                        int               value);
71
72     // set input region informantion
73     int setInputRegion(const std::string &appid,
74                        const std::string &winname,
75                        int x,
76                        int y,
77                        int width,
78                        int height,
79                        int hotspot_x,
80                        int hotspot_y,
81                        int cursor_x,
82                        int cursor_y,
83                        int cursor_width,
84                        int cursor_height,
85                        int attr);
86
87     // unset input region informantion
88     int unsetInputRegion(const std::string &appid,
89                          const std::string &winname,
90                          int x,
91                          int y,
92                          int width,
93                          int height);
94
95     // callback to application for input switch information
96     void capabilitiesCB(void               *data,
97                         struct ico_exinput *ico_exinput,
98                         const char         *device,
99                         int32_t            type,
100                         const char         *swname,
101                         int32_t            input,
102                         const char          *codename,
103                         int32_t            code);
104
105     // callback to application for input code information
106     void codeCB(void               *data,
107                 struct ico_exinput *ico_exinput,
108                 const char         *device,
109                 int32_t            input,
110                 const char         *codename,
111                 int32_t            code);
112
113     // callback to application for switch input 
114     void inputCB(void               *data,
115                  struct ico_exinput *ico_exinput,
116                  uint32_t           time,
117                  const char         *device,
118                  int32_t            input,
119                  int32_t            code,
120                  int32_t            state);
121
122     // callback to application for change input region
123     void regionCB(void                        *data,
124                   struct ico_input_mgr_device *ico_input_mgr_device,
125                   struct wl_array             *region);
126
127 protected:
128     // assignment operator
129     CicoSCInputController& operator=(const CicoSCInputController &object);
130
131     // copy constructor
132     CicoSCInputController(const CicoSCInputController &object);
133
134 private:
135     // find input device information
136     CicoSCInputDev* findInputDev(const char *device);
137
138     // find input device switch information
139     CicoSCSwitch* findInputSwitch(const char *device, int input);
140
141 private:
142     /// input device information list
143     std::vector<CicoSCInputDev*> m_inputDevList;
144 };
145 #endif  // __CICO_SC_INPUT_CONTROLLER_H__
146 // vim:set expandtab ts=4 sw=4: