Arduino C++ Library for VLCB
Loading...
Searching...
No Matches
VLCB::EventProducerService Class Reference

Service for producing events. More...

#include <EventProducerService.h>

Inheritance diagram for VLCB::EventProducerService:
VLCB::Service

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)

Detailed Description

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.

Member Function Documentation

◆ setRequestEventHandler()

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.

◆ sendShortEvent()

void VLCB::EventProducerService::sendShortEvent ( bool state,
int eventNumber )

Send a short event.

Parameters
statesend an ON event if state is true or OFF event if false
eventNumberevent number for the short event.

The event does not need to be taught, and stored in the events table.

◆ sendLongEvent()

void VLCB::EventProducerService::sendLongEvent ( bool state,
int eventNumber )

Send a long event.

Parameters
statesend an ON event if state is true or OFF event if false
eventNumberevent 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.

◆ sendLongEventWithSpoofedNodeNumber()

void VLCB::EventProducerService::sendLongEventWithSpoofedNodeNumber ( bool state,
int nodeNumber,
int eventNumber )

Send a long event with a spoofed node number.

Parameters
statesend an ON event if state is true or OFF event if false
nodeNumbernode number to use for the long event instead of the current node.
eventNumberevent 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.

◆ sendEventAtIndex() [1/4]

void VLCB::EventProducerService::sendEventAtIndex ( bool state,
byte evIndex )

Send an event from the taught events table.

Parameters
statesend an ON event if state is true or OFF event if false
evIndexindex into the taught events table for the event to use.

The indexed event determines if the sent event is short or long.

◆ sendEventAtIndex() [2/4]

void VLCB::EventProducerService::sendEventAtIndex ( bool state,
byte evIndex,
byte data1 )

Send an event from the taught events table with data.

Parameters
statesend an ON event if state is true or OFF event if false
evIndexindex into the taught events table for the event to use.
data1data byte to be included in the event.

The indexed event determines if the sent event is short or long.

◆ sendEventAtIndex() [3/4]

void VLCB::EventProducerService::sendEventAtIndex ( bool state,
byte evIndex,
byte data1,
byte data2 )

Send an event from the taught events table with data.

Parameters
statesend an ON event if state is true or OFF event if false
evIndexindex into the taught events table for the event to use.
data1first data byte to be included in the event.
data2second data byte to be included in the event.

The indexed event determines if the sent event is short or long.

◆ sendEventAtIndex() [4/4]

void VLCB::EventProducerService::sendEventAtIndex ( bool state,
byte evIndex,
byte data1,
byte data2,
byte data3 )

Send an event from the taught events table with data.

Parameters
statesend an ON event if state is true or OFF event if false
evIndexindex into the taught events table for the event to use.
data1first data byte to be included in the event.
data2second data byte to be included in the event.
data3third data byte to be included in the event.

The indexed event determines if the sent event is short or long.

◆ sendEventResponse() [1/4]

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.

◆ sendEventResponse() [2/4]

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.

◆ sendEventResponse() [3/4]

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.

◆ sendEventResponse() [4/4]

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.


The documentation for this class was generated from the following file: