#include <RemoteConnector.h>
Public Member Functions | |
TagValueRemoteConnector (uint8_t remoteNo=0) | |
void | initialise (TagValueTransport *transport, CombinedMessageProcessor *processor, const ConnectorLocalInfo *localInfoPgm, uint8_t remoteNo) |
void | setAuthManager (AuthenticationManager *mgr) |
void | setCommsNotificationCallback (CommsCallbackFn callback) |
bool | isTransportAvailable () |
void | provideAuthentication (const char *auth) |
bool | isTransportConnected () |
void | encodeJoin () |
void | encodeCustomTagValMessage (uint16_t msgType, void(*msgWriter)(TagValueTransport *, void *), void *) |
void | encodeCustomBinaryMessage (uint16_t msgType, uint16_t len, void(*msgWriter)(TagValueTransport *, void *, size_t), void *data=nullptr) |
void | encodeDialogMsg (uint8_t mode, uint8_t btn1, uint8_t btn2, const char *hdrPgm, const char *buffer) |
void | encodeBootstrap (bool isComplete) |
void | encodeHeartbeat (HeartbeatMode restartConnection) |
void | encodeAnalogItem (int parentId, AnalogMenuItem *item) |
void | encodeSubMenu (int parentId, SubMenuItem *item) |
void | encodeBooleanMenu (int parentId, BooleanMenuItem *item) |
void | encodeEnumMenu (int parentId, EnumMenuItem *item) |
void | encodeActionMenu (int parentId, ActionMenuItem *item) |
void | encodeFloatMenu (int parentId, FloatMenuItem *item) |
void | encodeRuntimeMenuItem (int parentId, RuntimeMenuItem *item) |
void | encodeMultiEditMenu (int parentId, RuntimeMenuItem *item) |
void | encodeLargeNumberMenuItem (int parentId, EditableLargeNumberMenuItem *item) |
void | encodeChangeValue (MenuItem *theItem) |
void | encodeAcknowledgement (uint32_t correlation, AckResponseStatus status) |
void | encodeColorMenuItem (int id, Rgb32MenuItem *pItem) |
void | encodeScrollMenuItem (int id, ScrollChoiceMenuItem *pItem) |
void | tick () |
void | pairingRequest (const char *name, const char *uuid) |
void | initiateBootstrap () |
uint8_t | getRemoteNo () const |
const char * | getRemoteName () |
uint8_t | getRemoteMajorVer () const |
uint8_t | getRemoteMinorVer () const |
ApiPlatform | getRemotePlatform () |
bool | isConnected () |
void | setRemoteName (const char *name) |
void | setRemoteConnected (uint8_t major, uint8_t minor, ApiPlatform platform) |
void | commsNotify (uint16_t commsEventType) |
void | close () |
bool | isAuthenticated () |
AuthenticationManager * | getAuthManager () |
void | setHeartbeatTimeout (uint16_t milli) |
The remote connector is what we would normally interact with when dealing with a remote. It provides functionality at the message processing level, for sending messages and processing incoming ones.
|
explicit |
Construct an instance
remoteNo | the index of this connector, 0 based. |
void TagValueRemoteConnector::initialise | ( | TagValueTransport * | transport, |
CombinedMessageProcessor * | processor, | ||
const ConnectorLocalInfo * | localInfoPgm, | ||
uint8_t | remoteNo = 0 |
||
) |
Initialises the connector with a specific transport that can send and recevie data, a message processor that can process incoming message, the remote number that should be used and it's name.
transport | a class that implements TagValueTransport for sending and receving data. |
processor | a linked list of processors that can process incoming messages. |
localInfoPgm | the name and UUID of this local device (in program memory where available). |
remoteNo | remote number, optional and defaults to 0 |
|
inline |
If you want to be informed of communication events for this remote, pass a function that takes a CommunicationInfo structure as its parameter.
|
inline |
Indicates if the underlying transport is functionality
|
inline |
Indicates if the underlying transport is connected.
void TagValueRemoteConnector::encodeJoin | ( | ) |
Encode a join message onto the wire, giving local name
localName | the name to send in the join message |
void TagValueRemoteConnector::encodeCustomTagValMessage | ( | uint16_t | msgType, |
void(*)(TagValueTransport *, void *) | msgWriter, | ||
void * | |||
) |
Encode a custom message onto the wire in the TagVal protocol, provide the message type and a function that sets the fields you wish to send. This works by you providing the type of message and a function that will set all the fields by calling transport's add field methods. Once that method returns the message will be completed and sent on the wire. Where myData can be a pointer to any data you need to provide, it allows you to get data into the lambda without enabling captures.
void TagValueRemoteConnector::encodeCustomBinaryMessage | ( | uint16_t | msgType, |
uint16_t | len, | ||
void(*)(TagValueTransport *, void *, size_t) | msgWriter, | ||
void * | data = nullptr |
||
) |
Encode a binary message onto the wire using your own format, note that the other end must be able to process this type of message. Embed Control UI will not understand such custom messages. This works by you providing the type of message and a function that will set all the binary data direct to the transport using the write function. The myData parameter allows you to pass data into the lambda with enabling capture.
void TagValueRemoteConnector::encodeDialogMsg | ( | uint8_t | mode, |
uint8_t | btn1, | ||
uint8_t | btn2, | ||
const char * | hdrPgm, | ||
const char * | buffer | ||
) |
Encodes a dialog message that the UI can use to render / remove a dialog from the display.
mode | either 'S'how, 'H'ide or 'A'ction |
btn1 | the status of the first button |
btn2 | the status of the second button |
hdrPgm | the header of the dialog (progrma memory) |
buffer | the additional text |
void TagValueRemoteConnector::encodeBootstrap | ( | bool | isComplete | ) |
Encode a bootstrap message indicating we are sending state
isComplete | true - end of boot sequence. |
void TagValueRemoteConnector::encodeHeartbeat | ( | HeartbeatMode | restartConnection | ) |
Encodes a heartbeat message onto the transport
restartConnection | indicates that the connection is to restart. |
void TagValueRemoteConnector::encodeAnalogItem | ( | int | parentId, |
AnalogMenuItem * | item | ||
) |
Encodes a bootstrap for an Analog menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeSubMenu | ( | int | parentId, |
SubMenuItem * | item | ||
) |
Encodes a bootstrap for a Sub menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeBooleanMenu | ( | int | parentId, |
BooleanMenuItem * | item | ||
) |
Encodes a bootstrap for a boolean menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeEnumMenu | ( | int | parentId, |
EnumMenuItem * | item | ||
) |
Encodes a bootstrap for an enum menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeActionMenu | ( | int | parentId, |
ActionMenuItem * | item | ||
) |
Encodes a bootstrap for an action menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeFloatMenu | ( | int | parentId, |
FloatMenuItem * | item | ||
) |
Encodes a bootstrap for a float menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeRuntimeMenuItem | ( | int | parentId, |
RuntimeMenuItem * | item | ||
) |
Encodes a bootstrap for a runtime list menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeMultiEditMenu | ( | int | parentId, |
RuntimeMenuItem * | item | ||
) |
Encodes a bootstrap for a multiEdit runtime menu item, this gives all needed state to the remote.
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeLargeNumberMenuItem | ( | int | parentId, |
EditableLargeNumberMenuItem * | item | ||
) |
Encodes a large number type (a specialisation of multiedit) as a boot command
parentId | the parent menu |
item | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeChangeValue | ( | MenuItem * | theItem | ) |
Encodes a value change message to be sent to the remote. The embedded device always sends absolute changes out.
parentId | the parent menu |
theItem | the item to be bootstrapped. |
void TagValueRemoteConnector::encodeAcknowledgement | ( | uint32_t | correlation, |
AckResponseStatus | status | ||
) |
Encodes an acknowledgement back to the other side to indicate the success or failure of an operation.
correlation | the ID to returned to the other side, or 0. |
status | the status to be returned. |
void TagValueRemoteConnector::encodeColorMenuItem | ( | int | id, |
Rgb32MenuItem * | pItem | ||
) |
Encodes a color RGB to the remote as a boot command.
id | the parent ID |
pItem | the item to be transferred |
void TagValueRemoteConnector::encodeScrollMenuItem | ( | int | id, |
ScrollChoiceMenuItem * | pItem | ||
) |
Encodes a scroll choice to the remote as a boot command
id | parent id |
pItem | the item to be sent |
void TagValueRemoteConnector::tick | ( | ) |
Called frequently to perform all functions, this is arranged interally by registering a taskManager task.
void TagValueRemoteConnector::pairingRequest | ( | const char * | name, |
const char * | uuid | ||
) |
Puts the system into pairing mode, If the system is in pairing mode already the display is updated. This will present a dialog on the renderer if there is one and the connection will be allowed only when the user selects to pair on the local device.
name | the name of the remote device |
uuid | the UUID to go with the name |
void TagValueRemoteConnector::initiateBootstrap | ( | ) |
Called internally to start a bootstrap on new connections
|
inline |
Returns the remoteNo (or remote number) for this remote
|
inline |
Returns the remote name for this connection. The name of the other side
|
inline |
returns the major version of the other party API
|
inline |
Returns the minor version of the other party API
|
inline |
Returns the platform of the other party.
|
inline |
Indicates if we are currently connected. Different to transport level connection as this includes checking for heartbeats.
void TagValueRemoteConnector::setRemoteName | ( | const char * | name | ) |
Sets the remote name, usually only used by the message processor.
void TagValueRemoteConnector::setRemoteConnected | ( | uint8_t | major, |
uint8_t | minor, | ||
ApiPlatform | platform | ||
) |
Sets the remote connection state, again only used by message processor.
void TagValueRemoteConnector::commsNotify | ( | uint16_t | commsEventType | ) |
Notify any listeners of a communication event on this remote, usually used by message processors to indicate an issue
commsEventType | an error usually defined in RemoteConnector.h |
void TagValueRemoteConnector::close | ( | ) |
close the connection
|
inline |
indicates if the connection is yet authenicated