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 //==========================================================================
12 * @file CicoSCCommand.h
14 * @brief This file is definition of CicoSCCommand class
16 //==========================================================================
17 #ifndef __CICO_SC_COMMAND_H__
18 #define __CICO_SC_COMMAND_H__
21 #include <boost/property_tree/ptree.hpp>
25 //==========================================================================
27 * @brief command option variables
28 * This class is abstract class
30 //==========================================================================
31 class CicoSCCommandOption
34 /// default constructor
35 CicoSCCommandOption() {}
38 virtual ~CicoSCCommandOption() {}
40 /// dump log this class member variables
41 virtual void dump(void) {}
44 //==========================================================================
46 * @brief This class holds the option of window control command
48 //==========================================================================
49 class CicoSCCmdWinCtrlOpt : public CicoSCCommandOption
52 /// default constructor
54 : nodeid(0), displayid(0), layerid(0),
55 zone(""), surfaceid(-1), animationType(0), animation(""), animationTime(0),
56 x(-1), y(-1), width(-1), height(-1), raise(-1),
57 visible(-1), active(-1), framerate(0), stride(-1), format(-1) {}
60 virtual ~CicoSCCmdWinCtrlOpt() {}
62 /// dump log this class member variables
65 ICO_DBG("WinCtrlOpt: "
66 "surfaceid=%08x layerid=%d nodeid=%d zone=%s "
67 "animation=%s animaType=%x animaTime=%d "
68 "x=%d y=%d w=%d h=%d raise=%d "
69 "visible=%d active=%d framerate=%d stride=%d format=%d",
70 surfaceid, layerid, nodeid, zone.c_str(),
71 animation.c_str(), animationType, animationTime,
72 x, y, width, height, raise,
73 visible, active, framerate, stride, format);
76 int nodeid; //!< id of node
77 int displayid; //!< id of display
78 int layerid; //!< id of layer
79 std::string zone; //!< name of display zone
80 int surfaceid; //!< id of surface
81 int animationType; //!< type of animation
82 std::string animation; //!< name of animation
83 int animationTime; //!< time of animation
84 int x; //!< x position of window
85 int y; //!< y position of window
86 int width; //!< width of window
87 int height; //!< height of window
88 int raise; //!< status of raise(raise/lower)
89 int visible; //!< status of visible(visible/invisible)
90 int active; //!< status of active(active/nonactive):
91 int framerate; //!< frame rate for thumbnail
92 int stride; //!< stride for thumbnail
93 int format; //!< format of color for thumbnail
96 //==========================================================================
98 * @brief This class holds the option of input device control command
100 //==========================================================================
101 class CicoSCCmdInputDevCtrlOpt : public CicoSCCommandOption
104 /// default constructor
105 CicoSCCmdInputDevCtrlOpt()
106 : device(""), input(-1), surfaceid(-1), deviceno(-1),
107 fix(-1), keycode(-1), evtype(-1), evtime(0), evcode(-1),
111 virtual ~CicoSCCmdInputDevCtrlOpt() {}
113 /// dump log this class member variables
116 ICO_DBG("InputCtrlOpt: "
117 "device=%s input=%d surfaceid=%08x deviceno=%d "
118 "fix=%d keycode=%d evtype=%d evtime=%d evcode=%d evvalue=%d",
119 device.c_str(), input, surfaceid, deviceno,
120 fix, keycode, evtype, evtime, evcode, evvalue);
123 std::string device; //!< name of input device
124 int input; //!< number of input
125 int surfaceid; //!< id of surface
126 int deviceno; //!< number of device
127 int fix; //!< status of fix
128 int keycode; //!< code of key
129 int evtype; //!< type of event
130 int evtime; //!< time of event
131 int evcode; //!< code of event
132 int evvalue; //!< value of event
135 //==========================================================================
137 * @brief This class holds the option of user manager command
139 //==========================================================================
140 class CicoSCCmdUserMgrOpt : public CicoSCCommandOption
143 /// default constructor
144 CicoSCCmdUserMgrOpt()
145 : user(""), pass(""), lastinfo("") {}
148 virtual ~CicoSCCmdUserMgrOpt() {}
150 /// dump log this class member variables
153 ICO_DBG("UserMgrOpt: user=%s pass=%s lastinfo=%s",
154 user.c_str(), pass.c_str(), lastinfo.c_str());
159 std::string lastinfo;
162 //==========================================================================
164 * @brief This class holds the option of resource control command
166 //==========================================================================
167 class CicoSCCmdResCtrlOpt : public CicoSCCommandOption
170 /// default constructor
171 CicoSCCmdResCtrlOpt()
172 : dispres(false), dispzone(""), layerid(-1), winname(""), surfaceid(-1),
173 animation(""), animationTime(0),
174 ECU(""), display(""), layer(""), layout(""), area(""), dispatchApp(""),
175 role(""), resourceID(-1),
176 soundres(false), soundzone(""), soundname(""), adjust(0),
177 inputres(false), device(""), input(0), type(0) {}
180 virtual ~CicoSCCmdResCtrlOpt() {}
182 /// dump log this class member variables
185 ICO_DBG("ResCtrlOpt: "
186 "diapres=%s dispzone=%s layerid=%d winname=%s srufaceid=%08x "
187 "animation=%s animatime=%d soundres=%s soundzone=%s"
188 "soundname=%s soundid=%d adjust=%d inputres=%s "
189 "device=%s input=%d type=%d",
190 dispres ? "true" : "false", dispzone.c_str(), layerid,
191 winname.c_str(), surfaceid, animation.c_str(),
192 animationTime, soundres ? "true" : "false",
193 soundzone.c_str(), soundname.c_str(),
194 soundid, adjust, inputres ? "true" : "false",
195 device.c_str(), input, type);
196 ICO_DBG("ResCtrlOptEx: "
197 "dispresEx=%s ECU=%s display=%s layer=%s layout=%s area=%s "
198 "dispatchApp=%s role=%s resourceID=%d",
199 dispresEx? "true": "false", ECU.c_str(), display.c_str(),
200 layer.c_str(), layout.c_str(), area.c_str(), dispatchApp.c_str(),
201 role.c_str(), resourceID);
204 bool dispres; //!< flag of display resource
205 std::string dispzone; //!< name of display zone
206 int layerid; //!< id of window layer
207 std::string winname; //!< name of window
208 int surfaceid; //!< id of surface
209 std::string animation; //!< name of animation
210 int animationTime; //!< time of animation[ms]
211 bool dispresEx; //!< Expansion flag
212 std::string ECU; //!< name to identify ECU
213 std::string display; //!< name to identify Display in ECU
214 std::string layer; //!< name to identify Layer in Display
215 std::string layout; //!< name to identify Layout in Layer
216 std::string area; //!< name to Output position in Layout
217 std::string dispatchApp; //!< dispatch of application
218 std::string role; //!< role of notice
219 int resourceID; //!< ID number of resource
221 bool soundres; //!< flag of sound resource
222 std::string soundzone; //!< name of sound zone
223 std::string soundname; //!< name of sound(stream)
224 int soundid; //!< id of sound(stream)
225 int adjust; //!< parameter of adjust
227 bool inputres; //!< flag of input resource
228 std::string device; //!< name of input device
229 int input; //!< input
231 int type; //!<< type of request for display and sound
234 //==========================================================================
236 * @brief This class holds the option of input device setting command
238 //==========================================================================
239 class CicoSCCmdInputDevSettingOpt: public CicoSCCommandOption
242 /// default constructor
243 CicoSCCmdInputDevSettingOpt()
244 : winname(""), x(0), y(0), width(0), height(0), hotspot_x(0), hotspot_y(0),
245 cursor_x(0), cursor_y(0), cursor_width(0), cursor_height(0), attr(0) {}
248 virtual ~CicoSCCmdInputDevSettingOpt() {}
250 /// dump log this class member variables
253 ICO_DBG("InputDevSettingOpt: winname=%s x=%d y=%d w=%d h=%d attr=%d",
254 winname.c_str(), x, y, width, height, attr);
257 std::string winname;//!< window name of surface
258 short x; //!< x position of input region
259 short y; //!< y position of input region
260 short width; //!< width of input region
261 short height; //!< height of input region
262 short hotspot_x; //!< hotspot of X relative coordinate
263 short hotspot_y; //!< hotspot of Y relative coordinate
264 short cursor_x; //!< cursor region X coordinate
265 short cursor_y; //!< cursor region Y coordinate
266 short cursor_width; //!< cursor region width
267 short cursor_height;//!< cursor region height
268 int attr; //!< attribute of input region
271 //==========================================================================
273 * @brief This class holds command information
275 //==========================================================================
279 // default constructor
285 // parse from message of process communication
286 int parseMessage(const char *cmdMessage);
288 // dump log this class member variables
293 int getIntValue(const boost::property_tree::ptree & root,
297 std::string getStrValue(const boost::property_tree::ptree & root,
300 // check exist object
301 bool isExistObject(const boost::property_tree::ptree & root,
304 // parse window control options
305 void parseWinCtrlOpt(const boost::property_tree::ptree & root);
307 // parse input device control options
308 void parseInputDevCtrlOpt(const boost::property_tree::ptree & root);
310 // parse user control options
311 void parseUserMgrOpt(const boost::property_tree::ptree & root);
313 // parse resource control options
314 void parseResCtrlOpt(const boost::property_tree::ptree & root);
316 // parse input device setting options
317 void parseInputDevSettingOpt(const boost::property_tree::ptree & root);
320 unsigned long cmdid; //!< id of command
321 std::string appid; //!< id of application
322 int pid; //!< id of process
323 CicoSCCommandOption *opt; //!< command option instance
325 #endif // __CICO_SC_COMMAND_H__
326 // vim:set expandtab ts=4 sw=4: