Skip to content

Commit ef0eea2

Browse files
committed
Event abstractions added.
1 parent eab62a6 commit ef0eea2

19 files changed

+17318
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.1
2+
3+
- Bugfix: Abstract event modules added.
4+
15
## 0.7.0
26

37
- Update to VSCP framework v0.8.0, please see the ![changelog](https://github.com/BlueAndi/vscp-framework/releases/tag/v0.8.0) there.

src/framework/events/vscp_alarm.c

Lines changed: 382 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,382 @@
1+
/* The MIT License (MIT)
2+
*
3+
* Copyright (c) 2014 - 2019, Andreas Merkle
4+
* http://www.blue-andi.de
5+
* vscp@blue-andi.de
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
*
25+
*/
26+
27+
/*******************************************************************************
28+
DESCRIPTION
29+
*******************************************************************************/
30+
/**
31+
@brief VSCP class 1 type Alarm events
32+
@file vscp_alarm.c
33+
@author Andreas Merkle, http://www.blue-andi.de
34+
35+
@section desc Description
36+
@see vscp_alarm.h
37+
38+
This file is automatically generated. Don't change it manually.
39+
40+
*******************************************************************************/
41+
42+
/*******************************************************************************
43+
INCLUDES
44+
*******************************************************************************/
45+
#include "vscp_alarm.h"
46+
#include "../core/vscp_core.h"
47+
#include "../core/vscp_class_l1.h"
48+
#include "../core/vscp_type_alarm.h"
49+
50+
/*******************************************************************************
51+
COMPILER SWITCHES
52+
*******************************************************************************/
53+
54+
/*******************************************************************************
55+
CONSTANTS
56+
*******************************************************************************/
57+
58+
/*******************************************************************************
59+
MACROS
60+
*******************************************************************************/
61+
62+
/*******************************************************************************
63+
TYPES AND STRUCTURES
64+
*******************************************************************************/
65+
66+
/*******************************************************************************
67+
PROTOTYPES
68+
*******************************************************************************/
69+
70+
/*******************************************************************************
71+
LOCAL VARIABLES
72+
*******************************************************************************/
73+
74+
/*******************************************************************************
75+
GLOBAL VARIABLES
76+
*******************************************************************************/
77+
78+
/*******************************************************************************
79+
GLOBAL FUNCTIONS
80+
*******************************************************************************/
81+
82+
/**
83+
* Undefined alarm.
84+
*
85+
* @return Status
86+
* @retval FALSE Failed to send the event
87+
* @retval TRUE Event successul sent
88+
*
89+
*/
90+
extern BOOL vscp_alarm_sendUndefinedEvent(void)
91+
{
92+
vscp_TxMessage txMsg;
93+
94+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_UNDEFINED, VSCP_PRIORITY_3_NORMAL);
95+
96+
txMsg.dataNum = 0;
97+
98+
return vscp_core_sendEvent(&txMsg);
99+
}
100+
101+
/**
102+
* Indicates a warning condition.
103+
*
104+
* @param[in] state State (0=off, 1=on)
105+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
106+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
107+
* @return Status
108+
* @retval FALSE Failed to send the event
109+
* @retval TRUE Event successul sent
110+
*
111+
*/
112+
extern BOOL vscp_alarm_sendWarningEvent(uint8_t state, uint8_t zone, uint8_t subZone)
113+
{
114+
vscp_TxMessage txMsg;
115+
116+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_WARNING, VSCP_PRIORITY_3_NORMAL);
117+
118+
txMsg.dataNum = 3;
119+
txMsg.data[0] = state;
120+
txMsg.data[1] = zone;
121+
txMsg.data[2] = subZone;
122+
123+
return vscp_core_sendEvent(&txMsg);
124+
}
125+
126+
/**
127+
* Indicates an alarm condition.
128+
*
129+
* @param[in] state State (0=off, 1=on)
130+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
131+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
132+
* @return Status
133+
* @retval FALSE Failed to send the event
134+
* @retval TRUE Event successul sent
135+
*
136+
*/
137+
extern BOOL vscp_alarm_sendAlarmOccurredEvent(uint8_t state, uint8_t zone, uint8_t subZone)
138+
{
139+
vscp_TxMessage txMsg;
140+
141+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_ALARM_OCCURRED, VSCP_PRIORITY_3_NORMAL);
142+
143+
txMsg.dataNum = 3;
144+
txMsg.data[0] = state;
145+
txMsg.data[1] = zone;
146+
txMsg.data[2] = subZone;
147+
148+
return vscp_core_sendEvent(&txMsg);
149+
}
150+
151+
/**
152+
* Alarm sound should be turned on or off.
153+
*
154+
* @param[in] state State (0=off, 1=on)
155+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
156+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
157+
* @return Status
158+
* @retval FALSE Failed to send the event
159+
* @retval TRUE Event successul sent
160+
*
161+
*/
162+
extern BOOL vscp_alarm_sendAlarmSoundOnOffEvent(uint8_t state, uint8_t zone, uint8_t subZone)
163+
{
164+
vscp_TxMessage txMsg;
165+
166+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_ALARM_SOUND_ON_OFF, VSCP_PRIORITY_3_NORMAL);
167+
168+
txMsg.dataNum = 3;
169+
txMsg.data[0] = state;
170+
txMsg.data[1] = zone;
171+
txMsg.data[2] = subZone;
172+
173+
return vscp_core_sendEvent(&txMsg);
174+
}
175+
176+
/**
177+
* Alarm light should be turned on or off.
178+
*
179+
* @param[in] state State (0=off, 1=on)
180+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
181+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
182+
* @return Status
183+
* @retval FALSE Failed to send the event
184+
* @retval TRUE Event successul sent
185+
*
186+
*/
187+
extern BOOL vscp_alarm_sendAlarmLightOnOffEvent(uint8_t state, uint8_t zone, uint8_t subZone)
188+
{
189+
vscp_TxMessage txMsg;
190+
191+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_ALARM_LIGHT_ON_OFF, VSCP_PRIORITY_3_NORMAL);
192+
193+
txMsg.dataNum = 3;
194+
txMsg.data[0] = state;
195+
txMsg.data[1] = zone;
196+
txMsg.data[2] = subZone;
197+
198+
return vscp_core_sendEvent(&txMsg);
199+
}
200+
201+
/**
202+
* Power has been lost or is available again.
203+
*
204+
* @param[in] state State (0=off, 1=on)
205+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
206+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
207+
* @return Status
208+
* @retval FALSE Failed to send the event
209+
* @retval TRUE Event successul sent
210+
*
211+
*/
212+
extern BOOL vscp_alarm_sendPowerOnOffEvent(uint8_t state, uint8_t zone, uint8_t subZone)
213+
{
214+
vscp_TxMessage txMsg;
215+
216+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_POWER_ON_OFF, VSCP_PRIORITY_3_NORMAL);
217+
218+
txMsg.dataNum = 3;
219+
txMsg.data[0] = state;
220+
txMsg.data[1] = zone;
221+
txMsg.data[2] = subZone;
222+
223+
return vscp_core_sendEvent(&txMsg);
224+
}
225+
226+
/**
227+
* Emergency stop has been hit/activated. All systems on the zone/sub-zone should go to their
228+
* inactive/safe state.
229+
*
230+
* @param[in] state State (0=off, 1=on)
231+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
232+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
233+
* @return Status
234+
* @retval FALSE Failed to send the event
235+
* @retval TRUE Event successul sent
236+
*
237+
*/
238+
extern BOOL vscp_alarm_sendEmergencyStopEvent(uint8_t state, uint8_t zone, uint8_t subZone)
239+
{
240+
vscp_TxMessage txMsg;
241+
242+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_EMERGENCY_STOP, VSCP_PRIORITY_3_NORMAL);
243+
244+
txMsg.dataNum = 3;
245+
txMsg.data[0] = state;
246+
txMsg.data[1] = zone;
247+
txMsg.data[2] = subZone;
248+
249+
return vscp_core_sendEvent(&txMsg);
250+
}
251+
252+
/**
253+
* Emergency pause has been hit/activated. All systems on the zone/sub-zone should go to their
254+
* inactive/safe state but preserve there settings.
255+
*
256+
* @param[in] state State (0=off, 1=on)
257+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
258+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all subzones.
259+
* @return Status
260+
* @retval FALSE Failed to send the event
261+
* @retval TRUE Event successul sent
262+
*
263+
*/
264+
extern BOOL vscp_alarm_sendEmergencyPauseEvent(uint8_t state, uint8_t zone, uint8_t subZone)
265+
{
266+
vscp_TxMessage txMsg;
267+
268+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_EMERGENCY_PAUSE, VSCP_PRIORITY_3_NORMAL);
269+
270+
txMsg.dataNum = 3;
271+
txMsg.data[0] = state;
272+
txMsg.data[1] = zone;
273+
txMsg.data[2] = subZone;
274+
275+
return vscp_core_sendEvent(&txMsg);
276+
}
277+
278+
/**
279+
* Issued after an emergency stop or pause in order for nodes to reset and start operating .
280+
*
281+
* @param[in] state State (0=off, 1=on)
282+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
283+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
284+
* @return Status
285+
* @retval FALSE Failed to send the event
286+
* @retval TRUE Event successul sent
287+
*
288+
*/
289+
extern BOOL vscp_alarm_sendEmergencyResetEvent(uint8_t state, uint8_t zone, uint8_t subZone)
290+
{
291+
vscp_TxMessage txMsg;
292+
293+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_EMERGENCY_RESET, VSCP_PRIORITY_3_NORMAL);
294+
295+
txMsg.dataNum = 3;
296+
txMsg.data[0] = state;
297+
txMsg.data[1] = zone;
298+
txMsg.data[2] = subZone;
299+
300+
return vscp_core_sendEvent(&txMsg);
301+
}
302+
303+
/**
304+
* Issued after an emergency pause in order for nodes to start operating from where they left of
305+
* without resetting their registers .
306+
*
307+
* @param[in] state State (0=off, 1=on)
308+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
309+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
310+
* @return Status
311+
* @retval FALSE Failed to send the event
312+
* @retval TRUE Event successul sent
313+
*
314+
*/
315+
extern BOOL vscp_alarm_sendEmergencyResumeEvent(uint8_t state, uint8_t zone, uint8_t subZone)
316+
{
317+
vscp_TxMessage txMsg;
318+
319+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_EMERGENCY_RESUME, VSCP_PRIORITY_3_NORMAL);
320+
321+
txMsg.dataNum = 3;
322+
txMsg.data[0] = state;
323+
txMsg.data[1] = zone;
324+
txMsg.data[2] = subZone;
325+
326+
return vscp_core_sendEvent(&txMsg);
327+
}
328+
329+
/**
330+
* Issued after an alarm system has been armed.
331+
*
332+
* @param[in] state State (0=off, 1=on)
333+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
334+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
335+
* @return Status
336+
* @retval FALSE Failed to send the event
337+
* @retval TRUE Event successul sent
338+
*
339+
*/
340+
extern BOOL vscp_alarm_sendArm(uint8_t state, uint8_t zone, uint8_t subZone)
341+
{
342+
vscp_TxMessage txMsg;
343+
344+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_EMERGENCY_ARM, VSCP_PRIORITY_3_NORMAL);
345+
346+
txMsg.dataNum = 3;
347+
txMsg.data[0] = state;
348+
txMsg.data[1] = zone;
349+
txMsg.data[2] = subZone;
350+
351+
return vscp_core_sendEvent(&txMsg);
352+
}
353+
354+
/**
355+
* Issued after an alarm system has been disarmed.
356+
*
357+
* @param[in] state State (0=off, 1=on)
358+
* @param[in] zone Zone for which event applies to (0-255). 255 is all zones.
359+
* @param[in] subZone Sub-zone for which event applies to (0-255). 255 is all sub-zones.
360+
* @return Status
361+
* @retval FALSE Failed to send the event
362+
* @retval TRUE Event successul sent
363+
*
364+
*/
365+
extern BOOL vscp_alarm_sendDisarm(uint8_t state, uint8_t zone, uint8_t subZone)
366+
{
367+
vscp_TxMessage txMsg;
368+
369+
vscp_core_prepareTxMessage(&txMsg, VSCP_CLASS_L1_ALARM, VSCP_TYPE_ALARM_EMERGENCY_DISARM, VSCP_PRIORITY_3_NORMAL);
370+
371+
txMsg.dataNum = 3;
372+
txMsg.data[0] = state;
373+
txMsg.data[1] = zone;
374+
txMsg.data[2] = subZone;
375+
376+
return vscp_core_sendEvent(&txMsg);
377+
}
378+
379+
/*******************************************************************************
380+
LOCAL FUNCTIONS
381+
*******************************************************************************/
382+

0 commit comments

Comments
 (0)