1d7efb2306ce9bc618133145962eaeffc6b6eecd
[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     // set input region information
65     int setInputRegion(const std::string &appid,
66                        const std::string &winname,
67                        int x,
68                        int y,
69                        int width,
70                        int height,
71                        int hotspot_x,
72                        int hotspot_y,
73                        int cursor_x,
74                        int cursor_y,
75                        int cursor_width,
76                        int cursor_height,
77                        int attr);
78
79     // unset input region information
80     int unsetInputRegion(const std::string &appid,
81                          const std::string &winname,
82                          int x,
83                          int y,
84                          int width,
85                          int height);
86
87     // callback to application for input switch information
88     void capabilitiesCB(void               *data,
89                         const char         *device,
90                         int32_t            type,
91                         const char         *swname,
92                         int32_t            input,
93                         const char          *codename,
94                         int32_t            code);
95
96     // callback to application for input code information
97     void codeCB(void               *data,
98                 const char         *device,
99                 int32_t            input,
100                 const char         *codename,
101                 int32_t            code);
102
103     // callback to application for switch input 
104     void inputCB(void               *data,
105                  uint32_t           time,
106                  const char         *device,
107                  int32_t            input,
108                  int32_t            code,
109                  int32_t            state);
110
111     // callback to application for change input region
112     void regionCB(void                        *data,
113                   struct wl_array             *region);
114
115 protected:
116     // assignment operator
117     CicoSCInputController& operator=(const CicoSCInputController &object);
118
119     // copy constructor
120     CicoSCInputController(const CicoSCInputController &object);
121
122 private:
123     // find input device information
124     CicoSCInputDev* findInputDev(const char *device);
125
126     // find input device switch information
127     CicoSCSwitch* findInputSwitch(const char *device, int input);
128
129 private:
130     /// input device information list
131     std::vector<CicoSCInputDev*> m_inputDevList;
132 };
133 #endif  // __CICO_SC_INPUT_CONTROLLER_H__
134 // vim:set expandtab ts=4 sw=4: