Legrand / Raritan / Server Technology Xerus™ JSON-RPC API
Loading...
Searching...
No Matches
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 */
10module event {
11
12 /** TimerEventManager interface */
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 * The system's local time will be used (as defined by the configured time zone).
71 */
72 structure Schedule {
73 boolean enabled; ///< Whether the timer event is enabled
74 vector<Range> minute; ///< Ranges for minute
75 vector<Range> hour; ///< Ranges for hour
76 vector<Range> dayOfMonth; ///< Ranges for day of month
77 vector<Range> month; ///< Ranges for month
78 vector<Range> dayOfWeek; ///< Ranges for day of week
79 };
80
81 /**
82 * TimerEvent structure
83 *
84 * A TimerEvent can be used in the event engine to run actions
85 * at a specified time.
86 * The 'eventId' is an unique identification of every timer event.
87 * The 'executionTime' contains the schedule for the execution time.
88 */
89 structure TimerEvent {
90 vector<string> eventId; ///< Event ID
91 Schedule executionTime; ///< Schedule for execution time
92 };
93
94 /**
95 * Add a new timer event.
96 *
97 * The timer event id field is allocated automatically
98 * and returned in the timerEventId parameter.
99 *
100 * @param schedule schedule for timer
101 * @param eventId created event id
102 * @return NO_ERROR if OK
103 * @return ERR_INVALID_SCHEDULE if schedule is invalid
104 * @return ERR_CREATE_EVENT_ID_FAILED if generating the eventId failed
105 * @return ERR_MAX_TIMERS_CREATED if max timer count already created
106 */
107 int addTimerEvent(in Schedule schedule, out vector<string> eventId);
108
109 /**
110 * Modify a timer event.
111 *
112 * @param eventId event id
113 * @param schedule new schedule for timer
114 * @return NO_ERROR if OK
115 * @return ERR_INVALID_SCHEDULE if schedule is invalid
116 * @return ERR_UNKNOWN_EVENT_ID if eventId is unknown
117 */
118 int modifyTimerEvent(in vector<string> eventId, in Schedule schedule);
119
120 /**
121 * Delete a timer event.
122 *
123 * @param eventId event id
124 * @return NO_ERROR if OK
125 * @return ERR_UNKNOWN_EVENT_ID if eventId is unknown
126 */
127 int deleteTimerEvent(in vector<string> eventId);
128
129 /**
130 * List all timer events.
131 */
132 vector<TimerEvent> listTimerEvents();
133
134 };
135
136}
137
138#endif /* __EVENT_TIMEREVENTMANAGER_IDL__ */
TimerEventManager interface.
vector< TimerEvent > listTimerEvents()
List all timer events.
int addTimerEvent(in Schedule schedule, out vector< string > eventId)
Add a new timer event.
int modifyTimerEvent(in vector< string > eventId, in Schedule schedule)
Modify a timer event.
int deleteTimerEvent(in vector< string > eventId)
Delete a timer event.
vector< Range > minute
Ranges for minute.
boolean enabled
Whether the timer event is enabled.
vector< Range > month
Ranges for month.
vector< Range > hour
Ranges for hour.
vector< Range > dayOfWeek
Ranges for day of week.
vector< Range > dayOfMonth
Ranges for day of month.
Schedule executionTime
Schedule for execution time.