tcMenu
Classes | Typedefs | Enumerations
RemoteConnector.h File Reference

Contains the base functionality for communication between the menu library and remote APIs. More...

Go to the source code of this file.

Classes

struct  FieldAndValue
 
struct  CommunicationInfo
 
class  TagValueTransport
 
class  TagValueRemoteConnector
 

Typedefs

typedef void(* CommsCallbackFn) (CommunicationInfo)
 

Enumerations

enum  FieldValueType : uint8_t {
  FVAL_NEW_MSG , FVAL_END_MSG , FVAL_FIELD , FVAL_ERROR_PROTO ,
  FVAL_PROCESSING , FVAL_PROCESSING_WAITEQ , FVAL_PROCESSING_VALUE , FVAL_PROCESSING_AWAITINGMSG ,
  FVAL_PROCESSING_PROTOCOL , FVAL_PROCESSING_MSGTYPE_HI , FVAL_PROCESSING_MSGTYPE_LO
}
 
enum  TagValueTransportType { TVAL_UNBUFFERED , TVAL_BUFFERED , TVAL_BUFFERED_DELEGATE_ENCRYPT }
 

Detailed Description

Contains the base functionality for communication between the menu library and remote APIs.

This class contains the majority of the code for dealing with remote connections using the TagVal protocol.


Class Documentation

◆ FieldAndValue

struct FieldAndValue

This class describes the ongoing processing of an incoming message. In the embedded domain where we are essentially single threaded and even on 32 bit fairly memory constrained, there needs to be a minimalist way to process incoming events. This class processes data asynchronously by reading in a byte at a time and slowly updating it's state. It has many states, but more generally the states containing the word PROCESSING mean that there is nothing yet ready for use, these will never be passed externally to a message processor.

A remote connection will typically use a field and value to store the state on incoming message processing, it will generally pass anything that is not in a PROCESSING* state to a message callback for further processing.

Class Members
FieldValueType fieldType
uint16_t msgType
uint16_t field
char value[MAX_VALUE_LEN]
uint8_t len

◆ CommunicationInfo

struct CommunicationInfo
Class Members
uint16_t remoteNo: 4
uint16_t connected: 1
uint16_t errorMode: 8

Typedef Documentation

◆ CommsCallbackFn

typedef void(* CommsCallbackFn) (CommunicationInfo)

A callback function that will receive information about comms channels. This is registered as a static on the TagValueTransport object, and will receive updates for all remote tag value connections.

Enumeration Type Documentation

◆ FieldValueType

enum FieldValueType : uint8_t

This enum describes the various states that a field and value object can be in. Field and value is basically a simple state machine that remembers where the incoming communication was up to last time around, so it can be processed asynchronously. Anything containing PROCESSING is an internal state that is not ready for external processing, and generally would not be passed to a message callback.

See also
FieldAndValue
Enumerator
FVAL_NEW_MSG 

a new message has arrived

FVAL_END_MSG 

the end of the present message has been located

FVAL_FIELD 

a new field on the message has been found

FVAL_ERROR_PROTO 

there has been an error while reading the message

FVAL_PROCESSING 

waiting for a field key

FVAL_PROCESSING_WAITEQ 

waiting for the = sign following the key

FVAL_PROCESSING_VALUE 

waiting for the value after finding the equals sign

FVAL_PROCESSING_AWAITINGMSG 

waiting for a new message

FVAL_PROCESSING_PROTOCOL 

waiting to find the protocol type

FVAL_PROCESSING_MSGTYPE_HI 

waiting to find the first message type in the header

FVAL_PROCESSING_MSGTYPE_LO 

waiting to find the second message type in the header

◆ TagValueTransportType

The base type of transport that is in use, it can be either unbuffered, buffered, or simple encrypted. Encrypted tag val will become available during the 2.2 releases.

Enumerator
TVAL_UNBUFFERED 

an unbuffered connection that writes immediately to the transport.

TVAL_BUFFERED 

a buffered connection that writes to a buffer, and requires a timed check for writing

TVAL_BUFFERED_DELEGATE_ENCRYPT 

a buffered and encrypted transport that requires a timed check