|
Arduino C++ Library for VLCB
|
Service for producing events. More...
#include <EventProducerService.h>
Public Member Functions | |
| void | setRequestEventHandler (void(*fptr)(byte index, const VlcbMessage *msg)) |
| void | sendShortEvent (bool state, int eventNumber) |
| Send a short event. | |
| void | sendLongEvent (bool state, int eventNumber) |
| Send a long event. | |
| void | sendLongEventWithSpoofedNodeNumber (bool state, int nodeNumber, int eventNumber) |
| Send a long event with a spoofed node number. | |
| void | sendEventAtIndex (bool state, byte evIndex) |
| Send an event from the taught events table. | |
| void | sendEventAtIndex (bool state, byte evIndex, byte data1) |
| Send an event from the taught events table with data. | |
| void | sendEventAtIndex (bool state, byte evIndex, byte data1, byte data2) |
| Send an event from the taught events table with data. | |
| void | sendEventAtIndex (bool state, byte evIndex, byte data1, byte data2, byte data3) |
| Send an event from the taught events table with data. | |
| void | sendEventResponse (bool state, byte index) |
| void | sendEventResponse (bool state, byte index, byte data1) |
| void | sendEventResponse (bool state, byte index, byte data1, byte data2) |
| void | sendEventResponse (bool state, byte index, byte data1, byte data2, byte data3) |
Service for producing events.
This service provides a means of generating VLCB events and interrogating their status. A full description of events can be found in the document VLCB Event Model.
The events that a module can produce are either taught events which are stored in the events table or direct events.
| void VLCB::EventProducerService::setRequestEventHandler | ( | void(* | fptr )(byte index, const VlcbMessage *msg) | ) |
Sets the callback function that is called when an Accessory Request opcode or Accessory Request Short Event opcode is received.
| void VLCB::EventProducerService::sendShortEvent | ( | bool | state, |
| int | eventNumber ) |
Send a short event.
| state | send an ON event if state is true or OFF event if false |
| eventNumber | event number for the short event. |
The event does not need to be taught, and stored in the events table.
| void VLCB::EventProducerService::sendLongEvent | ( | bool | state, |
| int | eventNumber ) |
Send a long event.
| state | send an ON event if state is true or OFF event if false |
| eventNumber | event number for the long event. |
The event does not need to be taught, and stored in the events table. The node number is the number of this node.
| void VLCB::EventProducerService::sendLongEventWithSpoofedNodeNumber | ( | bool | state, |
| int | nodeNumber, | ||
| int | eventNumber ) |
Send a long event with a spoofed node number.
| state | send an ON event if state is true or OFF event if false |
| nodeNumber | node number to use for the long event instead of the current node. |
| eventNumber | event number for the long event. |
The event does not need to be taught, and stored in the events table.
Use spoofed node numbers only when many nodes send the same long event. It is recommended to use short events for many-to-many events.
| void VLCB::EventProducerService::sendEventAtIndex | ( | bool | state, |
| byte | evIndex ) |
Send an event from the taught events table.
| state | send an ON event if state is true or OFF event if false |
| evIndex | index into the taught events table for the event to use. |
The indexed event determines if the sent event is short or long.
| void VLCB::EventProducerService::sendEventAtIndex | ( | bool | state, |
| byte | evIndex, | ||
| byte | data1 ) |
Send an event from the taught events table with data.
| state | send an ON event if state is true or OFF event if false |
| evIndex | index into the taught events table for the event to use. |
| data1 | data byte to be included in the event. |
The indexed event determines if the sent event is short or long.
| void VLCB::EventProducerService::sendEventAtIndex | ( | bool | state, |
| byte | evIndex, | ||
| byte | data1, | ||
| byte | data2 ) |
Send an event from the taught events table with data.
| state | send an ON event if state is true or OFF event if false |
| evIndex | index into the taught events table for the event to use. |
| data1 | first data byte to be included in the event. |
| data2 | second data byte to be included in the event. |
The indexed event determines if the sent event is short or long.
| void VLCB::EventProducerService::sendEventAtIndex | ( | bool | state, |
| byte | evIndex, | ||
| byte | data1, | ||
| byte | data2, | ||
| byte | data3 ) |
Send an event from the taught events table with data.
| state | send an ON event if state is true or OFF event if false |
| evIndex | index into the taught events table for the event to use. |
| data1 | first data byte to be included in the event. |
| data2 | second data byte to be included in the event. |
| data3 | third data byte to be included in the event. |
The indexed event determines if the sent event is short or long.
| void VLCB::EventProducerService::sendEventResponse | ( | bool | state, |
| byte | index ) |
Causes an Accessory Response to be sent with state indicating on for TRUE and off for FALSE. Short or Long event is determined by the nature of the request and the Event Table entry at evIndex.
| void VLCB::EventProducerService::sendEventResponse | ( | bool | state, |
| byte | index, | ||
| byte | data1 ) |
Causes an Accessory Response with one data byte to be sent with state indicating on for TRUE and off for FALSE. Short or Long event is determined by the nature of the request and the Event Table entry at evIndex. The data sent is data1.
| void VLCB::EventProducerService::sendEventResponse | ( | bool | state, |
| byte | index, | ||
| byte | data1, | ||
| byte | data2 ) |
Causes an Accessory Response with two data bytes to be sent with state indicating on for TRUE and off for FALSE. Short or Long event is determined by the nature of the request and the Event Table entry at evIndex. The data sent is data1 and data2.
| void VLCB::EventProducerService::sendEventResponse | ( | bool | state, |
| byte | index, | ||
| byte | data1, | ||
| byte | data2, | ||
| byte | data3 ) |
Causes an Accessory Response with three data bytes to be sent with state indicating on for TRUE and off for FALSE. Short or Long event is determined by the nature of the request and the Event Table entry at evIndex. The data sent is data1 and data2 and data3.