ZUNO_DOORLOCK()
This macro is used to setup door lock channel for Z-Uno board using ZUNO_SETUP_CHANNELS.
Z-Uno understands two ways to define a channel: using getter/setter functions and using a variable.
-
With getter/setter definition the getter functions is called each time a value is requested and setter each time a new value is received. This allows to do some calculus before returning a value as well as to handle the incoming value.
-
With variable definition Z-Uno will automatically return the variable status. This allows to minimize your code.
ZUNO_DOORLOCK(getter, setter)
getter
pointer to a user defined function, which is supposed to return current door lock mode for this channel.
setter
pointer to a user defined function, which is called when new door lock mode is received for this channel.
Functions getter should return 0 for opened or 255 closed.
BYTE getter(void)
Functions setter accepts values 0 for open and 255 for close.
void setter(BYTE value)
Channel generated using this macro will have Z-Wave Device Class GENERIC_TYPE_ENTRY_CONTROL / SPECIFIC_TYPE_DOOR_LOCK with Switch Multilevel Command Class.
This type is allowed only if security is used. Otherwise it will be disabled and hidden.
ZUNO_SETUP_CHANNELS(ZUNO_DOORLOCK(getterFunction, setterFunction))
void setup() {
...
}
void loop() {
...
}
BYTE getterFunction() {
return ...;
}
void setterFunction(BYTE newValue) {
...
}
ZUNO_DOORLOCK(variable, NULL)
variable
variable that holds the current door lock mode for this channel.
Variable change can be detected using function zunoIsChannelUpdated(channelNum).
ZUNO_SETUP_CHANNELS(ZUNO_DOORLOCK(lockStatus, NULL))
byte lockStatus = 0;
void setup() {
...
}
void loop() {
...
lockStatus = ...;
...
}
BYTE getterFunction() {
}