Legrand / Raritan / Server Technology Xerus™ JSON-RPC API
Loading...
Searching...
No Matches
DoorAccessControl.idl
1/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright 2020 Raritan Inc. All rights reserved.
4 */
5
6#ifndef __SMARTLOCK_DOOR_ACCESS_CONTROL_IDL__
7#define __SMARTLOCK_DOOR_ACCESS_CONTROL_IDL__
8
9#include <Event.idl>
10#include <UserEvent.idl>
11#include <PeripheralDeviceSlot.idl>
12
13module smartlock {
14
15 /** Access control for door locks */
17
18 constant int ERR_INVALID_SETTINGS = 1; ///< Invalid settings
19 constant int ERR_NO_SUCH_ID = 2; ///< No such ID
20 constant int ERR_MAX_RULES_REACHED = 3; ///< Maximum number of rules
21
22 /**
23 * A condition representing an absolute time range.
24 *
25 * Timestamps are UNIX timestamps (UTC)
26 */
28 boolean enabled; ///< Condition is enabled
29 time validFrom; ///< Time range starting from this date or 0 if not set
30 time validTill; ///< Time range valid until this date or 0 if not set
31 };
32
33 /**
34 * A condition representing a periodic time range.
35 *
36 * Once this condition is enabled, weekdays have to be specified in
37 * order to get granted access. A specific clock time range can be set
38 * to allow access only certain times of the day. The system's local time
39 * will be used (as defined by the configured time zone).
40 *
41 * The clock time range will wrap over into the next day if
42 * fromHourOfDay:fromMinuteOfHour >= tillHourOfDay:tillMinuteOfHour,
43 * meaning that the weekday of fromHourOfDay:fromMinuteOfHour will be checked.
44 */
46 boolean enabled; ///< Condition is enabled
47 vector<int> daysOfWeek; ///< Range for these days of the week (valid values are 0 - 6, 0 is Sunday)
48 int fromHourOfDay; ///< Range periodically starts from this hour of the day (0 - 23)
49 int tillHourOfDay; ///< Range periodically ends this hour of the day (0 - 23)
50 int fromMinuteOfHour; ///< Specify minute of starting hour (0 - 59)
51 int tillMinuteOfHour; ///< Specify minute of ending hour (0 - 59)
52 };
53
54 /**
55 * Information in order to refer to a specific card reader
56 */
57 structure CardReaderInfo {
58 int linkId; ///< Unit the card reader is attached to
59 string position; ///< Position of the card reader.
60 ///< This can be fetched from the CardReader MetaData
61 };
62
63 /**
64 * Information in order to refer to a specific keypad
65 */
66 structure KeypadInfo {
67 int linkId; ///< Unit the keypad is attached to
68 string position; ///< Position of the keypad
69 ///< This can be fetched from the Keypad MetaData
70 };
71
72 /**
73 * A condition for specific cards and card readers.
74 */
75 structure CardCondition {
76 boolean enabled; ///< Condition is enabled
77 string cardUid; ///< Matching card uid
78 CardReaderInfo cardReader; ///< The card reader that has to be used
79 };
80
81 /**
82 * A condition for keypads with a secret pin
83 */
84 structure KeypadCondition {
85 boolean enabled; ///< Condition is enabled
86 string pin; ///< Pin that has to be entered
87 KeypadInfo keypad; ///< The keypad that has to be used
88 };
89
90
91 /**
92 * Data representing a rule to control access to certain doors.
93 *
94 * Access is granted (i.e. the defined locks are opened) if the defined
95 * and enabled conditions are met. At least one CardCondition or one
96 * KeypadCondition must be enabled. If multiple conditions are enabled, all
97 * conditions have to be met during the timeout that is defined in
98 * conditionsTimeout.
99 */
100 structure DoorAccessRule {
101 string name; ///< A name to describe this rule
102 vector<peripheral.DeviceSlot> doorHandleLocks; ///< Open these door handle locks
103 CardCondition cardCondition1; ///< Condition that has to be fulfilled when inserting a card
104 CardCondition cardCondition2; ///< Additional card condition that is needed
105 KeypadCondition keypadCondition1; ///< Condition that has to be fulfilled when using a keypad
106 KeypadCondition keypadCondition2; ///< Additional keypad condition that is needed
107 int conditionsTimeout; ///< Timeout for matching multiple card / keypad conditions
108 AbsoluteTimeCondition absoluteTime; ///< Absolute time range condition
109 PeriodicTimeCondition periodicTime; ///< Periodic time range condition
110 };
111
112 /**
113 * Door Access Denial Reason
114 */
116 DENIED_NO_MATCHING_RULE, ///< No rule that matches the triggering event
117 DENIED_ABSOLUTE_TIME_CONDITION, ///< Absolute time condition was not met
118 DENIED_PERIODIC_TIME_CONDITION, ///< Periodic time condition was not met
119 DENIED_CONDITIONS_TIMEOUT ///< A needed condition was not fulfilled during conditionsTimeout
120 };
121
122 /**
123 * Event: Door access granted
124 *
125 * This Event will be triggered for every rule whose conditions were fulfilled.
126 */
127 valueobject DoorAccessGrantedEvent extends idl.Event {
128 int ruleId; ///< Rule id of rule that granted access
129 DoorAccessRule rule; ///< Rule settings of rule that granted access, cardUid and pin will be filtered
130 };
131
132 /**
133 * Event: Door access denied
134 *
135 * This event will only be triggered if at least one DoorAccessRule
136 * exists and a card was inserted or keypad PIN entered, but none of
137 * the defined rules were sufficiently fulfilled to grant access.
138 *
139 * If matching rules are found, this will be triggered for every
140 * matching rule that could not be fulfilled. Otherwise it will only be
141 * triggered once with the according DoorAccessDenialReason.
142 */
143 valueobject DoorAccessDeniedEvent extends idl.Event {
144 DoorAccessDenialReason reason; ///< A DoorAccessDenialReason, specifying why the access was denied
145 int ruleId; ///< A matching rule that could not be fulfilled or -1 if no matching rule
146 string ruleName; ///< Name of the rule that could not be fulfilled or empty if no matching rule
147 };
148
149 /**
150 * Event: Door access rule added
151 */
152 valueobject DoorAccessRuleAddedEvent extends event.UserEvent {
153 int ruleId; ///< New rule id
154 DoorAccessRule rule; ///< Rule that was added, cardUid and pin will be filtered
155 };
156
157 /**
158 * Event: Door access rule modified
159 */
160 valueobject DoorAccessRuleChangedEvent extends event.UserEvent {
161 int ruleId; ///< Id of modified rule
162 DoorAccessRule oldRule; ///< Old rule settings, cardUid and pin will be filtered
163 DoorAccessRule newRule; ///< New rule settings, cardUid and pin will be filtered
164 };
165
166 /**
167 * Event: Door access rule deleted
168 */
169 valueobject DoorAccessRuleDeletedEvent extends event.UserEvent {
170 int ruleId; ///< Id of deleted rule
171 DoorAccessRule rule; ///< Rule that was deleted, cardUid and pin will be filtered
172 };
173
174 /**
175 * Get all stored door access control rules
176 *
177 * @return list of rules by id
178 */
179 map<int, DoorAccessRule> getDoorAccessRules();
180
181 /**
182 * Replace all the currently existing rules. Note that this not only
183 * adds and modifies rules, but also deletes existing rules that are
184 * not present in the given rule set.
185 *
186 * In case of any rule being invalid, no changes will be made at all.
187 *
188 * @param rules the new rule set
189 * @param invalidRules in case of an error, return ids of invalid rules
190 *
191 * @return 0 if OK
192 * @return 1 if the rule set contains a rule with invalid values
193 */
194 int setAllDoorAccessRules(in map<int, DoorAccessRule> rules, out vector<int> invalidRuleIds);
195
196 /**
197 * Add a door access control rule. If successful, the id of the new
198 * rule will be returned.
199 *
200 * @param rule the new rule
201 *
202 * @return 0 if OK
203 * @return 1 if rule has invalid values
204 * @return 3 if maximum number of rules reached
205 */
206 int addDoorAccessRule(in DoorAccessRule rule, out int ruleId);
207
208 /**
209 * Modify an existing door access control rule
210 *
211 * @param id id of the rule to modify
212 * @param modifiedRule rule containing the new settings
213 *
214 * @return 0 if OK
215 * @return 1 if modifiedRule has invalid values
216 * @return 2 if no rule with this id
217 */
218 int modifyDoorAccessRule(in int id, in DoorAccessRule modifiedRule);
219
220 /**
221 * Delete an existing door access control rule
222 *
223 * @param id id of the rule to delete
224 *
225 * @return 0 if OK
226 * @return 2 if no rule with this id
227 */
228 int deleteDoorAccessRule(in int id);
229 };
230}
231
232#endif /* __SMARTLOCK_DOOR_ACCESS_CONTROL_IDL__ */
Peripheral Device Slot.
Access control for door locks.
int setAllDoorAccessRules(in map< int, DoorAccessRule > rules, out vector< int > invalidRuleIds)
Replace all the currently existing rules.
DoorAccessDenialReason
Door Access Denial Reason.
@ DENIED_NO_MATCHING_RULE
No rule that matches the triggering event.
@ DENIED_ABSOLUTE_TIME_CONDITION
Absolute time condition was not met.
@ DENIED_PERIODIC_TIME_CONDITION
Periodic time condition was not met.
map< int, DoorAccessRule > getDoorAccessRules()
Get all stored door access control rules.
int deleteDoorAccessRule(in int id)
Delete an existing door access control rule.
int addDoorAccessRule(in DoorAccessRule rule, out int ruleId)
Add a door access control rule.
int modifyDoorAccessRule(in int id, in DoorAccessRule modifiedRule)
Modify an existing door access control rule.
Basic IDL definitions.
Definition: Event.idl:10
Peripheral Devices.
Common base for all events.
Definition: Event.idl:13
A condition representing an absolute time range.
time validFrom
Time range starting from this date or 0 if not set.
time validTill
Time range valid until this date or 0 if not set.
A condition for specific cards and card readers.
CardReaderInfo cardReader
The card reader that has to be used.
Information in order to refer to a specific card reader.
int linkId
Unit the card reader is attached to.
string position
Position of the card reader.
DoorAccessDenialReason reason
A DoorAccessDenialReason, specifying why the access was denied.
string ruleName
Name of the rule that could not be fulfilled or empty if no matching rule.
int ruleId
A matching rule that could not be fulfilled or -1 if no matching rule.
int ruleId
Rule id of rule that granted access.
DoorAccessRule rule
Rule settings of rule that granted access, cardUid and pin will be filtered.
DoorAccessRule rule
Rule that was added, cardUid and pin will be filtered.
DoorAccessRule newRule
New rule settings, cardUid and pin will be filtered.
DoorAccessRule oldRule
Old rule settings, cardUid and pin will be filtered.
DoorAccessRule rule
Rule that was deleted, cardUid and pin will be filtered.
Data representing a rule to control access to certain doors.
int conditionsTimeout
Timeout for matching multiple card / keypad conditions.
PeriodicTimeCondition periodicTime
Periodic time range condition.
AbsoluteTimeCondition absoluteTime
Absolute time range condition.
KeypadCondition keypadCondition1
Condition that has to be fulfilled when using a keypad.
vector< peripheral::DeviceSlot > doorHandleLocks
Open these door handle locks.
KeypadCondition keypadCondition2
Additional keypad condition that is needed.
CardCondition cardCondition2
Additional card condition that is needed.
string name
A name to describe this rule.
CardCondition cardCondition1
Condition that has to be fulfilled when inserting a card.
A condition for keypads with a secret pin.
KeypadInfo keypad
The keypad that has to be used.
Information in order to refer to a specific keypad.
string position
Position of the keypad This can be fetched from the Keypad MetaData.
int linkId
Unit the keypad is attached to.
A condition representing a periodic time range.
int fromHourOfDay
Range periodically starts from this hour of the day (0 - 23)
int tillMinuteOfHour
Specify minute of ending hour (0 - 59)
int tillHourOfDay
Range periodically ends this hour of the day (0 - 23)
int fromMinuteOfHour
Specify minute of starting hour (0 - 59)
vector< int > daysOfWeek
Range for these days of the week (valid values are 0 - 6, 0 is Sunday)