Type ZUNO_HANDLER_SYSEVENT
Special system runtime events including usage exceptions, events of Z-Wave network. For this event type `sub_type` always is set to 0. void handlerSysEvent(ZUNOSysEvent_t * ev) { ... }ev pointer to type ZUNOSysEvent_t nothing
typedef struct ZUNOSysEvent_s{
uint8_t event;
uint32_t params[2];
}ZUNOSysEvent_t;
event
One of following values:
- ZUNO_SYS_EVENT_QUICKWAKEUP Z-Uno wakes up from EM2 energy mode
- ZUNO_SYS_EVENT_LEARNCOMPLETED Z-Uno was added to network or exluded from the network. Learn process has been finished.
- ZUNO_SYS_EVENT_LEARNSTARTED Process of network inclusion/exclusion has started.
- ZUNO_SYS_EVENT_SETDEFAULT Configuration of device was cleaned up.
- ZUNO_SYS_EVENT_SLEEP_MODEEXC Warning, user tries to go to sleep listening device. Don't call zunoSendDeviceToSleep() for listening devices.
- ZUNO_SYS_EVENT_STACK_OVERFLOW Firmware detected user stack overflow. Be careful with recursion and large amounts of local data inside nested functions.
- ZUNO_SYS_EVENT_QUEUE_OVERLOAD IRQ queue is full. System can miss some interrupts.
- ZUNO_SYS_EVENT_INVALID_TX_REQUEST Z-Uno tries to send an invalid message.
- ZUNO_SYS_EVENT_INVALID_COMMAND User calls unknowm system call number. param[0] is invalid system call vector.
- ZUNO_SYS_EVENT_INVALID_CLOCK Unknown peripheral clock source. param[0] is invalid translated clock index.
- ZUNO_SYS_EVENT_INVALID_MEMORYAREA_IN_SYSCALL User translates illegal memory pointer to syscall. param[0] is a system call vector number, param[1] is system call parameter number.
- ZUNO_SYS_EVENT_INVALID_PARAMNUM_IN_SYSCALL Syscall parameter number doesn't match to reference. param[0] is a system call vector number.
- ZUNO_SYS_EVENT_INVALID_SYSCALL_PARAM_VALUE Syscall parameter is invalid. param[0] is a system call vector number, param[1] is system call parameter number.
// Catches start & complete learn events and turn on/off led
// Handler fuction
void handlerSysEvent(ZUNOSysEvent_t * e) {
switch(e->event){
case ZUNO_SYS_EVENT_LEARNSTARTED:
digitalWrite(LED_BUILTIN, HIGH);
break;
case ZUNO_SYS_EVENT_LEARNCOMPLETED:
digitalWrite(LED_BUILTIN, LOW);
break;
}
}
void setup() {
// Initialize led pin as output
pinMode(LED_BUILTIN, OUTPUT);
// Bind our handler to system runtime events
zunoAttachSysHandler(ZUNO_HANDLER_SYSEVENT, 0, (void *)&handlerSysTimer);
}
void loop() {
// There is nothing to do. All logic is inside handlerSysEvent()
}
In most cases use static-defined handler.
ZUNO_SETUP_SYSEVENT_HANDLER Setups system runtime events handler.