InertiaSDK

Loading...
Searching...
No Matches
SchedulerCommands.h
1#pragma once
2
3#include "data/command/InertiaCommand.h"
4
5 namespace inertia
6{
7
8 enum SchedulerCommands : uint8_t {
9 SchedulerCommandTimedEvent = 0,
10 SchedulerCommandChannelAction = 1
11};
12
13
14 enum SchedulerTimedEventCommands : uint8_t {
15 SchedulerTimedEventAddItem = 0,
16 SchedulerTimedEventGetAll = 1,
17 SchedulerTimedEventGetLast = 2,
18 SchedulerTimedEventGetNext = 3,
19 SchedulerTimedEventClear = 4
20};
21
22
23 enum SchedulerChannelActionCommands : uint8_t {
24 SchedulerChannelActionAddChannel = 0,
25 SchedulerChannelActionGetChannel = 1,
26 SchedulerChannelActionGetActive = 2,
27 SchedulerChannelActionDeleteChannel = 3,
28 SchedulerChannelActionGetChannelList = 4,
29 SchedulerChannelActionClear = 5
30};
31
32
33 enum SchedulerTimedEventRecurrence : uint8_t {
34 SchedulerTimedEventSingle = 0,
35 SchedulerTimedEventMinute,
36 SchedulerTimedEventHour,
37 SchedulerTimedEventDay,
38 SchedulerTimedEventWeek,
39 SchedulerTimedEventMonth,
40 SchedulerTimedEventYear
41};
42
43
44 struct INERTIA_API TimedEvent
45{
46 SchedulerTimedEventRecurrence intervalRecurrence;
47 uint8_t interval;
48 uint32_t firstEventTimestamp;
49 uint32_t lastEventTimestamp;
50 uint8_t eventChannel;
51
52 TimedEvent();
53 TimedEvent(const uint8_t* packet, const unsigned max_size);
54 TimedEvent(std::wstring const& argString);
55
56 void GetBytes(std::vector<uint8_t>& out) const;
57 const std::wstring ToString() const;
58
59#ifdef WITH_BOOST_PROGRAM_OPTIONS
60 static const po::options_description GetOptionDescription();
61#endif
62};
63
64
65 struct INERTIA_API ChannelAction
66{
67 bool preserveAction;
68 uint8_t channelNumber;
69 uint32_t timeOffset;
70 uint16_t addressTo;
71 uint16_t addressFrom;
72 std::wstring name;
73 std::vector<uint8_t> action;
74
75 ChannelAction();
76 ChannelAction(const uint8_t* packet, const unsigned max_size);
77 ChannelAction(std::wstring const& argString);
78
79 void GetBytes(std::vector<uint8_t>& out) const;
80 const std::wstring ToString() const;
81
82#ifdef WITH_BOOST_PROGRAM_OPTIONS
83 static const po::options_description GetOptionDescription();
84#endif
85};
86
87
88 struct INERTIA_API SchedulerCommand
89 : InertiaCommand
90{
91 protected:
92 SchedulerCommand(uint8_t subType);
93 SchedulerCommand(const uint8_t* packet, const unsigned max_size);
94 SchedulerCommand(std::wstring const& argString);
95
96 uint8_t subType;
97
98 void GetBytes(std::vector<uint8_t>& out) const override;
99 const std::wstring ToString() const override;
100
101#ifdef WITH_BOOST_PROGRAM_OPTIONS
102 static const po::options_description GetOptionDescription();
103#endif
104
105 public:
106 InertiaCommandGroups GetGroup() const override;
107
108 static InertiaCommandPtr Parse(const uint8_t* in, unsigned const packetSize);
109 static InertiaCommandPtr Parse(std::wstring const& argString);
110};
111
112
113 struct INERTIA_API SchedulerTimedEventRequest
114 : SchedulerCommand
115{
116 protected:
117 SchedulerTimedEventRequest(uint8_t subType);
118 SchedulerTimedEventRequest(const uint8_t* packet, const unsigned max_size);
119 SchedulerTimedEventRequest(std::wstring const& argString);
120
121 uint8_t GetType() const override;
122 bool IsResponse() const override;
123};
124
125
126 struct INERTIA_API SchedulerTimedEventResponse
127 : SchedulerCommand
128{
129 protected:
130 SchedulerTimedEventResponse(const uint8_t* packet, const unsigned max_size);
131 SchedulerTimedEventResponse(std::wstring const& argString);
132
133 uint8_t GetType() const override;
134 bool IsResponse() const override;
135};
136
137
138 struct INERTIA_API SchedulerTimedEventAddItemRequest
139 : SchedulerTimedEventRequest
140{
141 TimedEvent timedEvent;
142
143 SchedulerTimedEventAddItemRequest();
144 SchedulerTimedEventAddItemRequest(const uint8_t* packet, const unsigned max_size);
145 SchedulerTimedEventAddItemRequest(std::wstring const& argString);
146
147 void GetBytes(std::vector<uint8_t>& out) const override;
148 const std::wstring ToString() const override;
149
150#ifdef WITH_BOOST_PROGRAM_OPTIONS
151 static const po::options_description GetOptionDescription();
152#endif
153};
154
155
156 struct INERTIA_API SchedulerTimedEventAddItemResponse
157 : SchedulerTimedEventResponse
158 , BoolValue
159{
160 SchedulerTimedEventAddItemResponse(const uint8_t* packet, const unsigned max_size);
161 SchedulerTimedEventAddItemResponse(std::wstring const& argString);
162
163 void GetBytes(std::vector<uint8_t>& out) const override;
164 const std::wstring ToString() const override;
165
166#ifdef WITH_BOOST_PROGRAM_OPTIONS
167 static const po::options_description GetOptionDescription();
168#endif
169};
170
171
172 struct INERTIA_API SchedulerTimedEventGetAllRequest
173 : SchedulerTimedEventRequest
174{
175 SchedulerTimedEventGetAllRequest();
176 SchedulerTimedEventGetAllRequest(const uint8_t* packet, const unsigned max_size);
177 SchedulerTimedEventGetAllRequest(std::wstring const& argString);
178
179 void GetBytes(std::vector<uint8_t>& out) const override;
180 const std::wstring ToString() const override;
181
182#ifdef WITH_BOOST_PROGRAM_OPTIONS
183 static const po::options_description GetOptionDescription();
184#endif
185};
186
187
188 struct INERTIA_API SchedulerTimedEventGetAllResponse
189 : SchedulerTimedEventResponse
190{
191 protected:
192 uint8_t batchNumber;
193 public:
194 std::vector<TimedEvent> timedEvents;
195
196 SchedulerTimedEventGetAllResponse(const uint8_t* packet, const unsigned max_size);
197 SchedulerTimedEventGetAllResponse(std::wstring const& argString);
198
199 void GetBytes(std::vector<uint8_t>& out) const override;
200 const std::wstring ToString() const override;
201
202#ifdef WITH_BOOST_PROGRAM_OPTIONS
203 static const po::options_description GetOptionDescription();
204#endif
205};
206
207
208 struct INERTIA_API SchedulerTimedEventGetLastRequest
209 : SchedulerTimedEventRequest
210{
211 SchedulerTimedEventGetLastRequest();
212 SchedulerTimedEventGetLastRequest(const uint8_t* packet, const unsigned max_size);
213 SchedulerTimedEventGetLastRequest(std::wstring const& argString);
214
215 void GetBytes(std::vector<uint8_t>& out) const override;
216 const std::wstring ToString() const override;
217
218#ifdef WITH_BOOST_PROGRAM_OPTIONS
219 static const po::options_description GetOptionDescription();
220#endif
221};
222
223
224 struct INERTIA_API SchedulerTimedEventGetLastResponse
225 : SchedulerTimedEventResponse
226{
227 protected:
228 bool hasItem;
229
230 public:
231 TimedEvent timedEvent;
232
233 SchedulerTimedEventGetLastResponse(const uint8_t* packet, const unsigned max_size);
234 SchedulerTimedEventGetLastResponse(std::wstring const& argString);
235
236 void GetBytes(std::vector<uint8_t>& out) const override;
237 const std::wstring ToString() const override;
238
239#ifdef WITH_BOOST_PROGRAM_OPTIONS
240 static const po::options_description GetOptionDescription();
241#endif
242};
243
244
245 struct INERTIA_API SchedulerTimedEventGetNextRequest
246 : SchedulerTimedEventRequest
247{
248 SchedulerTimedEventGetNextRequest();
249 SchedulerTimedEventGetNextRequest(const uint8_t* packet, const unsigned max_size);
250 SchedulerTimedEventGetNextRequest(std::wstring const& argString);
251
252 void GetBytes(std::vector<uint8_t>& out) const override;
253 const std::wstring ToString() const override;
254
255#ifdef WITH_BOOST_PROGRAM_OPTIONS
256 static const po::options_description GetOptionDescription();
257#endif
258};
259
260
261 struct INERTIA_API SchedulerTimedEventGetNextResponse
262 : SchedulerTimedEventResponse
263{
264 protected:
265 bool hasItem;
266
267 public:
268 TimedEvent timedEvent;
269
270 SchedulerTimedEventGetNextResponse(const uint8_t* packet, const unsigned max_size);
271 SchedulerTimedEventGetNextResponse(std::wstring const& argString);
272
273 void GetBytes(std::vector<uint8_t>& out) const override;
274 const std::wstring ToString() const override;
275
276#ifdef WITH_BOOST_PROGRAM_OPTIONS
277 static const po::options_description GetOptionDescription();
278#endif
279};
280
281
282 struct INERTIA_API SchedulerTimedEventClearRequest
283 : SchedulerTimedEventRequest
284{
285 SchedulerTimedEventClearRequest();
286 SchedulerTimedEventClearRequest(const uint8_t* packet, const unsigned max_size);
287 SchedulerTimedEventClearRequest(std::wstring const& argString);
288
289 void GetBytes(std::vector<uint8_t>& out) const override;
290 const std::wstring ToString() const override;
291
292#ifdef WITH_BOOST_PROGRAM_OPTIONS
293 static const po::options_description GetOptionDescription();
294#endif
295};
296
297
298 struct INERTIA_API SchedulerTimedEventClearResponse
299 : SchedulerTimedEventResponse
300 , BoolValue
301{
302 SchedulerTimedEventClearResponse(const uint8_t* packet, const unsigned max_size);
303 SchedulerTimedEventClearResponse(std::wstring const& argString);
304
305 void GetBytes(std::vector<uint8_t>& out) const override;
306 const std::wstring ToString() const override;
307
308#ifdef WITH_BOOST_PROGRAM_OPTIONS
309 static const po::options_description GetOptionDescription();
310#endif
311};
312
313
314 struct INERTIA_API SchedulerActionRequest
315 : SchedulerCommand
316{
317 protected:
318 SchedulerActionRequest(uint8_t subType);
319 SchedulerActionRequest(const uint8_t* packet, const unsigned max_size);
320 SchedulerActionRequest(std::wstring const& argString);
321
322 uint8_t GetType() const override;
323 bool IsResponse() const override;
324};
325
326
327 struct INERTIA_API SchedulerActionResponse
328 : SchedulerCommand
329{
330 protected:
331 SchedulerActionResponse(const uint8_t* packet, const unsigned max_size);
332 SchedulerActionResponse(std::wstring const& argString);
333
334 uint8_t GetType() const override;
335 bool IsResponse() const override;
336};
337
338
339 struct INERTIA_API SchedulerActionAddChannelRequest
340 : SchedulerActionRequest
341{
342 ChannelAction channelAction;
343
344 SchedulerActionAddChannelRequest();
345 SchedulerActionAddChannelRequest(const uint8_t* packet, const unsigned max_size);
346 SchedulerActionAddChannelRequest(std::wstring const& argString);
347
348 void GetBytes(std::vector<uint8_t>& out) const override;
349 const std::wstring ToString() const override;
350
351#ifdef WITH_BOOST_PROGRAM_OPTIONS
352 static const po::options_description GetOptionDescription();
353#endif
354};
355
356
357 struct INERTIA_API SchedulerActionAddChannelResponse
358 : SchedulerActionResponse
359 , BoolValue
360{
361 SchedulerActionAddChannelResponse(const uint8_t* packet, const unsigned max_size);
362 SchedulerActionAddChannelResponse(std::wstring const& argString);
363
364 void GetBytes(std::vector<uint8_t>& out) const override;
365 const std::wstring ToString() const override;
366
367#ifdef WITH_BOOST_PROGRAM_OPTIONS
368 static const po::options_description GetOptionDescription();
369#endif
370};
371
372
373 struct INERTIA_API SchedulerActionGetChannelRequest
374 : SchedulerActionRequest
375{
376 uint8_t channelNumber;
377
378 SchedulerActionGetChannelRequest();
379 SchedulerActionGetChannelRequest(const uint8_t* packet, const unsigned max_size);
380 SchedulerActionGetChannelRequest(std::wstring const& argString);
381
382 void GetBytes(std::vector<uint8_t>& out) const override;
383 const std::wstring ToString() const override;
384
385#ifdef WITH_BOOST_PROGRAM_OPTIONS
386 static const po::options_description GetOptionDescription();
387#endif
388};
389
390
391 struct INERTIA_API SchedulerActionGetChannelResponse
392 : SchedulerActionResponse
393{
394 protected:
395 uint8_t batchNumber;
396 public:
397 std::vector<ChannelAction> channelActions;
398
399 SchedulerActionGetChannelResponse(const uint8_t* packet, const unsigned max_size);
400 SchedulerActionGetChannelResponse(std::wstring const& argString);
401
402 void GetBytes(std::vector<uint8_t>& out) const override;
403 const std::wstring ToString() const override;
404
405#ifdef WITH_BOOST_PROGRAM_OPTIONS
406 static const po::options_description GetOptionDescription();
407#endif
408};
409
410
411 struct INERTIA_API SchedulerActionGetActiveChannelRequest
412 : SchedulerActionRequest
413{
414 SchedulerActionGetActiveChannelRequest();
415 SchedulerActionGetActiveChannelRequest(const uint8_t* packet, const unsigned max_size);
416 SchedulerActionGetActiveChannelRequest(std::wstring const& argString);
417
418 void GetBytes(std::vector<uint8_t>& out) const override;
419 const std::wstring ToString() const override;
420
421#ifdef WITH_BOOST_PROGRAM_OPTIONS
422 static const po::options_description GetOptionDescription();
423#endif
424};
425
426
427 struct INERTIA_API SchedulerActionGetActiveChannelResponse
428 : SchedulerActionResponse
429{
430 protected:
431 uint8_t batchNumber;
432 public:
433 std::vector<uint8_t> channelData;
434
435 SchedulerActionGetActiveChannelResponse(const uint8_t* packet, const unsigned max_size);
436 SchedulerActionGetActiveChannelResponse(std::wstring const& argString);
437
438 void GetBytes(std::vector<uint8_t>& out) const override;
439 const std::wstring ToString() const override;
440
441#ifdef WITH_BOOST_PROGRAM_OPTIONS
442 static const po::options_description GetOptionDescription();
443#endif
444};
445
446
447 struct INERTIA_API SchedulerActionDeleteChannelRequest
448 : SchedulerActionRequest
449{
450 uint8_t channelNumber;
451
452 SchedulerActionDeleteChannelRequest();
453 SchedulerActionDeleteChannelRequest(const uint8_t* packet, const unsigned max_size);
454 SchedulerActionDeleteChannelRequest(std::wstring const& argString);
455
456 void GetBytes(std::vector<uint8_t>& out) const override;
457 const std::wstring ToString() const override;
458
459#ifdef WITH_BOOST_PROGRAM_OPTIONS
460 static const po::options_description GetOptionDescription();
461#endif
462};
463
464
465 struct INERTIA_API SchedulerActionDeleteChannelResponse
466 : SchedulerActionResponse
467 , BoolValue
468{
469 SchedulerActionDeleteChannelResponse(const uint8_t* packet, const unsigned max_size);
470 SchedulerActionDeleteChannelResponse(std::wstring const& argString);
471
472 void GetBytes(std::vector<uint8_t>& out) const override;
473 const std::wstring ToString() const override;
474
475#ifdef WITH_BOOST_PROGRAM_OPTIONS
476 static const po::options_description GetOptionDescription();
477#endif
478};
479
480
481 struct INERTIA_API SchedulerActionGetChannelListRequest
482 : SchedulerActionRequest
483{
484 SchedulerActionGetChannelListRequest();
485 SchedulerActionGetChannelListRequest(const uint8_t* packet, const unsigned max_size);
486 SchedulerActionGetChannelListRequest(std::wstring const& argString);
487
488 void GetBytes(std::vector<uint8_t>& out) const override;
489 const std::wstring ToString() const override;
490
491#ifdef WITH_BOOST_PROGRAM_OPTIONS
492 static const po::options_description GetOptionDescription();
493#endif
494};
495
496
497 struct INERTIA_API SchedulerActionGetChannelListResponse
498 : SchedulerActionResponse
499{
500 public:
501 std::vector<uint8_t> channelNumbers;
502
503 SchedulerActionGetChannelListResponse(const uint8_t* packet, const unsigned max_size);
504 SchedulerActionGetChannelListResponse(std::wstring const& argString);
505
506 void GetBytes(std::vector<uint8_t>& out) const override;
507 const std::wstring ToString() const override;
508
509#ifdef WITH_BOOST_PROGRAM_OPTIONS
510 static const po::options_description GetOptionDescription();
511#endif
512};
513
514
515 struct INERTIA_API SchedulerActionClearRequest
516 : SchedulerActionRequest
517{
518 SchedulerActionClearRequest();
519 SchedulerActionClearRequest(const uint8_t* packet, const unsigned max_size);
520 SchedulerActionClearRequest(std::wstring const& argString);
521
522 void GetBytes(std::vector<uint8_t>& out) const override;
523 const std::wstring ToString() const override;
524
525#ifdef WITH_BOOST_PROGRAM_OPTIONS
526 static const po::options_description GetOptionDescription();
527#endif
528};
529
530
531 struct INERTIA_API SchedulerActionClearResponse
532 : SchedulerActionResponse
533 , BoolValue
534{
535 SchedulerActionClearResponse(const uint8_t* packet, const unsigned max_size);
536 SchedulerActionClearResponse(std::wstring const& argString);
537
538 void GetBytes(std::vector<uint8_t>& out) const override;
539 const std::wstring ToString() const override;
540
541#ifdef WITH_BOOST_PROGRAM_OPTIONS
542 static const po::options_description GetOptionDescription();
543#endif
544};
545
546}
inertia
Definition FlashCommands.h:6
inertia::InertiaCommandPtr
std::shared_ptr< InertiaCommand > InertiaCommandPtr
Pointer to an InertiaCommand.
Definition platform.h:52
inertia::InertiaCommandGroups
InertiaCommandGroups
Definition InertiaCommand.h:7
inertia::ChannelAction
Definition SchedulerCommands.h:66
inertia::TimedEvent
Definition SchedulerCommands.h:45