tcMenu
Classes | Functions | Variables
MessageProcessors.h File Reference

Go to the source code of this file.

Classes

union  MessageProcessorInfo
 
struct  MsgHandler
 
class  CombinedMessageProcessor
 
struct  MessageProcessorInfo.value
 
struct  MessageProcessorInfo.join
 
struct  MessageProcessorInfo.pairing
 
struct  MessageProcessorInfo.dialog
 
struct  MessageProcessorInfo.hb
 

Functions

void fieldUpdateJoinMsg (TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
 
void fieldUpdateValueMsg (TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
 
void fieldUpdatePairingMsg (TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
 
void fieldUpdateDialogMsg (TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
 
void fieldUpdateHeartbeatMsg (TagValueRemoteConnector *connector, FieldAndValue *field, MessageProcessorInfo *info)
 

Variables

MsgHandler msgHandlers []
 

Detailed Description

This file contains the default processors that can deal with incoming messages turning them into events on tcMenu.


Class Documentation

◆ MessageProcessorInfo

union MessageProcessorInfo

Message processors need to store some state while they are working through the fields of a message, this union keeps state between a message starting processing and ending It can be added to with additional unions. It is essentially stored globally so size is an issue. If you need to extend the messages that can be processed, you'll probably also need to store some state. This is the ideal place to store such state in the union.

This union structure exists once per remote connection, and given that only one message on a remote connection can be processed at once, it can be a union. It is cleared at the start of each process.

Class Members
struct MessageProcessorInfo value
struct MessageProcessorInfo join
struct MessageProcessorInfo pairing
struct MessageProcessorInfo dialog
struct MessageProcessorInfo hb

◆ MessageProcessorInfo.value

struct MessageProcessorInfo.value
Class Members
MenuItem * item
int changeValue
uint32_t correlation
ChangeType changeType

◆ MessageProcessorInfo.join

struct MessageProcessorInfo.join
Class Members
uint8_t major
uint8_t minor
ApiPlatform platform
bool authProvided

◆ MessageProcessorInfo.pairing

struct MessageProcessorInfo.pairing
Class Members
char name[16]

◆ MessageProcessorInfo.dialog

struct MessageProcessorInfo.dialog
Class Members
char mode
uint8_t button
uint32_t correlation

◆ MessageProcessorInfo.hb

struct MessageProcessorInfo.hb
Class Members
HeartbeatMode hbMode

Function Documentation

◆ fieldUpdateJoinMsg()

void fieldUpdateJoinMsg ( TagValueRemoteConnector connector,
FieldAndValue field,
MessageProcessorInfo info 
)

If you decide to write your own processor, this method can handle join messages

◆ fieldUpdateValueMsg()

void fieldUpdateValueMsg ( TagValueRemoteConnector connector,
FieldAndValue field,
MessageProcessorInfo info 
)

If you decide to write your own processor, this method can handle value messages.

◆ fieldUpdatePairingMsg()

void fieldUpdatePairingMsg ( TagValueRemoteConnector connector,
FieldAndValue field,
MessageProcessorInfo info 
)

If you decide to write your own processor, this method can handle pairing messages.

◆ fieldUpdateDialogMsg()

void fieldUpdateDialogMsg ( TagValueRemoteConnector connector,
FieldAndValue field,
MessageProcessorInfo info 
)

If you decide to write your own processor, this method can handle dialog updates

◆ fieldUpdateHeartbeatMsg()

void fieldUpdateHeartbeatMsg ( TagValueRemoteConnector connector,
FieldAndValue field,
MessageProcessorInfo info 
)

If you decide to write your own processor, this method can handle heartbeat updates

Variable Documentation

◆ msgHandlers

MsgHandler msgHandlers[]

An array of message handlers, pre constructed that can be passed into the constructor of CombinedMessageProcessor. This provides enough processors for tcMenu to work properly. But can be recreated with additional ones if needed. For example: CombinedMessageProcessor processor(msgHandlers, MSG_HANDLERS_SIZE);

An array of message handlers, where each one is a function that can process that type of message and a message type. Messages are received a field at a time, so each time the function is called a new field will be available, when the last field is processed the end indicator will be set. TagValueRemoteConnector