|
VLCB
|
Service for producing events. More...
#include <EventProducerService.h>
Public Member Functions | |
| void | setRequestEventHandler (void(*fptr)(byte index, const VlcbMessage *msg)) |
| register the user handler for learned events | |
| virtual void | processAction (const Action &action) override |
| Called when there is an action available. | |
| virtual VlcbServiceTypes | getServiceID () const override |
| Return a unique ID for this service. | |
| virtual byte | getServiceVersionID () const override |
| Return the version of the service specification implemented by this service. | |
| 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) |
| Public Member Functions inherited from VLCB::Service | |
| void | setController (Controller *ctrl) |
| Set a pointer to the controller object for use in implementing class. | |
| virtual void | begin () |
| This optional method is called at the beginning of the Arduino sketch. Define this method for the service to do any setup required at the beginning. | |
| virtual void | process () |
| This method that be called regularly from the VLCB core to let the service perform regular tasks. | |
| virtual void | reportDiagnostics (byte serviceIndex, byte diagnosticsCode) |
| Report a given diagnostic value. | |
| virtual int | getDiagnosticCount () |
| report how many diagnostics this service supports. | |
| virtual Data | getServiceData () |
| Return Data bytes specific for the implementing service. The meaning of each data byte is defined in the service specification. | |
Protected Attributes | |
| unsigned int | diagEventsProduced = 0 |
| Protected Attributes inherited from VLCB::Service | |
| Controller * | controller |
| Pointer to the Controller object that can be used by implementing classes. | |
Additional Inherited Members | |
| Protected Member Functions inherited from VLCB::Service | |
| bool | isThisNodeNumber (unsigned int nodeNumber) |
| Helper function to decide if a given node number is the same as that assigned to this node. | |
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) | ) |
register the user handler for learned events
Sets the callback function that is called when an Accessory Request opcode or Accessory Request Short Event opcode is received.
|
overridevirtual |
Called when there is an action available.
This method does not need to be implemented if the service does react to any actions.
| action | The action that the service may have interest in. |
Reimplemented from VLCB::Service.
|
inlineoverridevirtual |
Return a unique ID for this service.
This ID is used by configuration utilities to identify the service type. The service IDs are listed in the VLCB service specifications.
Implements VLCB::Service.
|
inlineoverridevirtual |
Return the version of the service specification implemented by this service.
This version is used by configuration utilities to identify which features are implemented by this service.
Implements VLCB::Service.
| 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.
|
protected |