Raritan PX2/PX3 JSON-RPC API

TimerEventManager.idl
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3 * Copyright 2012 Raritan Inc. All rights reserved.
4 */
5
6 #ifndef __EVENT_TIMEREVENTMANAGER_IDL__
7 #define __EVENT_TIMEREVENTMANAGER_IDL__
8
9 /** Event interface */
10 module event {
11
12 /** TimerEventManager interface */
13 interface TimerEventManager_2_0_0 {
14
15 /** Error codes */
16 constant int NO_ERROR = 0; ///< operation successful, no error
17 constant int ERR_INVALID_SCHEDULE = 1; ///< failure in schedule
18 constant int ERR_UNKNOWN_EVENT_ID = 2; ///< unknown eventId
19 constant int ERR_CREATE_EVENT_ID_FAILED = 3; ///< creating eventId failed
20 constant int ERR_MAX_TIMERS_CREATED = 4; ///< max number of timers have been created
21
22 /**
23 * Schedule defines and structures
24 *
25 * The goal of the following declarations is
26 * to express crontab entries in a structured way.
27 */
28 /** Months */
29 constant int JAN = 1; ///< January
30 constant int FEB = 2; ///< February
31 constant int MAR = 3; ///< March
32 constant int APR = 4; ///< April
33 constant int MAY = 5; ///< May
34 constant int JUN = 6; ///< June
35 constant int JUL = 7; ///< July
36 constant int AUG = 8; ///< August
37 constant int SEP = 9; ///< September
38 constant int OCT = 10; ///< October
39 constant int NOV = 11; ///< November
40 constant int DEC = 12; ///< December
41 /** Days of week */
42 constant int SUN = 0; ///< Sunday
43 constant int MON = 1; ///< Monday
44 constant int TUE = 2; ///< Tuesday
45 constant int WED = 3; ///< Wednesday
46 constant int THU = 4; ///< Thursday
47 constant int FRI = 5; ///< Friday
48 constant int SAT = 6; ///< Saturday
49 /**
50 * Range structure
51 *
52 * A range defines a time between start and end point in time.
53 * If start and end point are the same it is a specific point in time
54 * and no range. Step defines the repeating interval in time.
55 * Step of 1 is default and matches all values in range.
56 */
57 structure Range {
58 int start; ///< Start time
59 int end; ///< End time
60 int step; ///< Step
61 };
62 /**
63 * Schedule structure
64 *
65 * An empty vector means a match for all values.
66 * The values range of every field depends on the meaning of the field.
67 * For minutes 0-59 is possible, for hour 0-24 and for day of month 0-31.
68 * For month and day of weeks the definitions above should be used.
69 */
70 structure Schedule {
71 boolean enabled; ///< Whether the timer event is enabled
72 vector<Range> minute; ///< Ranges for minute
73 vector<Range> hour; ///< Ranges for hour
74 vector<Range> dayOfMonth; ///< Ranges for day of month
75 vector<Range> month; ///< Ranges for month
76 vector<Range> dayOfWeek; ///< Ranges for day of week
77 };
78
79 /**
80 * TimerEvent structure
81 *
82 * A TimerEvent can be used in the event engine to run actions
83 * at a specified time.
84 * The 'eventId' is an unique identification of every timer event.
85 * The 'executionTime' contains the schedule for the execution time.
86 */
87 structure TimerEvent {
88 vector<string> eventId; ///< Event ID
89 Schedule executionTime; ///< Schedule for execution time
90 };
91
92 /**
93 * Add a new timer event.
94 *
95 * The timer event id field is allocated automatically
96 * and returned in the timerEventId parameter.
97 *
98 * @param schedule schedule for timer
99 * @param eventId created event id
100 * @return NO_ERROR if OK
101 * @return ERR_INVALID_SCHEDULE if schedule is invalid
102 * @return ERR_CREATE_EVENT_ID_FAILED if generating the eventId failed
103 * @return ERR_MAX_TIMERS_CREATED if max timer count already created
104 */
105 int addTimerEvent(in Schedule schedule, out vector<string> eventId);
106
107 /**
108 * Modify a timer event.
109 *
110 * @param eventId event id
111 * @param schedule new schedule for timer
112 * @return NO_ERROR if OK
113 * @return ERR_INVALID_SCHEDULE if schedule is invalid
114 * @return ERR_UNKNOWN_EVENT_ID if eventId is unknown
115 */
116 int modifyTimerEvent(in vector<string> eventId, in Schedule schedule);
117
118 /**
119 * Delete a timer event.
120 *
121 * @param eventId event id
122 * @return NO_ERROR if OK
123 * @return ERR_UNKNOWN_EVENT_ID if eventId is unknown
124 */
125 int deleteTimerEvent(in vector<string> eventId);
126
127 /**
128 * List all timer events.
129 */
130 vector<TimerEvent> listTimerEvents();
131
132 };
133
134 }
135
136 #endif /* __EVENT_TIMEREVENTMANAGER_IDL__ */
event::TimerEventManager_2_0_0::TimerEvent::executionTime
Schedule executionTime
Schedule for execution time.
Definition: TimerEventManager.idl:89
event::TimerEventManager_2_0_0::Schedule::minute
vector< Range > minute
Ranges for minute.
Definition: TimerEventManager.idl:72
event::TimerEventManager_2_0_0::Schedule::month
vector< Range > month
Ranges for month.
Definition: TimerEventManager.idl:75
event::TimerEventManager_2_0_0::Range::start
int start
Start time.
Definition: TimerEventManager.idl:58
event::TimerEventManager_2_0_0
TimerEventManager interface.
Definition: TimerEventManager.idl:13
event::TimerEventManager_2_0_0::TimerEvent
TimerEvent structure.
Definition: TimerEventManager.idl:87
event::TimerEventManager_2_0_0::Schedule::dayOfWeek
vector< Range > dayOfWeek
Ranges for day of week.
Definition: TimerEventManager.idl:76
event::TimerEventManager_2_0_0::Range
Range structure.
Definition: TimerEventManager.idl:57
event::TimerEventManager_2_0_0::Range::step
int step
Step.
Definition: TimerEventManager.idl:60
event::TimerEventManager_2_0_0::TimerEvent::eventId
vector< string > eventId
Event ID.
Definition: TimerEventManager.idl:88
event::TimerEventManager_2_0_0::Schedule::hour
vector< Range > hour
Ranges for hour.
Definition: TimerEventManager.idl:73
event::TimerEventManager_2_0_0::Range::end
int end
End time.
Definition: TimerEventManager.idl:59
event::TimerEventManager_2_0_0::Schedule::dayOfMonth
vector< Range > dayOfMonth
Ranges for day of month.
Definition: TimerEventManager.idl:74
event::TimerEventManager_2_0_0::Schedule
Schedule structure.
Definition: TimerEventManager.idl:70
event::TimerEventManager_2_0_0::Schedule::enabled
boolean enabled
Whether the timer event is enabled.
Definition: TimerEventManager.idl:71