ArrowConnect module.
More...
#include <ConnectinoArrowConnect.h>
|
| ConnectinoArrowConnect (StxHwSerial &refSerial) |
| ArrowConnect module constructor. More...
|
|
bool | moduleCallback (uint8_t subId, uint8_t reqId, uint16_t dataSize, uint8_t *data) |
| Callback function for serial frames of the ArrowConnect module. More...
|
|
uint8_t | getModId () |
| Get the ID of the ArrowConnect module. More...
|
|
bool | connect (char *server, uint16_t port, char *vHost, char *gatewayHid, char *apiKey, char *deviceHid, bool waitConnected) |
| Connect to the configured server and gateway. More...
|
|
bool | disconnect (bool waitDisconnected=false) |
| Disconnect from the configured server. More...
|
|
bool | isConnected (void) |
| Check the connection state of the ArrowConnect module. More...
|
|
bool | available (void) |
| Check if data is available. More...
|
|
bool | read (char *command, uint16_t *commandLen, char *payload, uint16_t *payloadLen) |
| Receive commands sent by the server. More...
|
|
void | clear (void) |
| Clear the receive buffer. More...
|
|
bool | publish (char *varName, char *data) |
| Publish data. More...
|
|
bool | publish (char *varName, bool data) |
| Publish data. More...
|
|
bool | publish (char *varName, long int data) |
| Publish data. More...
|
|
bool | publish (char *varName1, long int data1, char *varName2, long int data2) |
| Publish data. More...
|
|
void | begin () |
| Starts the module.
|
|
|
bool | append (uint8_t **buffer, uint16_t *bufferSize, const char data[], const uint8_t numOfSizeBytes=1) |
| Append a string to the frames payload. More...
|
|
bool | append (uint8_t **buffer, uint16_t *bufferSize, const uint8_t data[], const uint16_t dataSize, const uint8_t numOfSizeBytes=1) |
| Append binary data to the frames payload. More...
|
|
bool | append (uint8_t **buffer, uint16_t *bufferSize, const bool data) |
| Append a boolean to the frames payload. More...
|
|
bool | append (uint8_t **buffer, uint16_t *bufferSize, const uint8_t data) |
| Append a uint8_t variable to the frames payload. More...
|
|
bool | append (uint8_t **buffer, uint16_t *bufferSize, const uint16_t data) |
| Append a uint16_t variable to the frames payload. More...
|
|
bool | append (uint8_t **buffer, uint16_t *bufferSize, const uint32_t data) |
| Append a uint32_t variable to the frames payload. More...
|
|
ArrowConnect module.
The ArrowConnect module can be used to publish data on the Arrow Connect Portal. Therefore the module needs to be configured with a gateway HID, the API key for the gateway and the device HID. Server address, port and vHost also needs to be configured.
◆ ConnectinoArrowConnect()
ConnectinoArrowConnect::ConnectinoArrowConnect |
( |
StxHwSerial & |
refSerial | ) |
|
ArrowConnect module constructor.
Instantiates the ArrowConnect module and connects it to the hardware serial.
- Parameters
-
refSerial | A reference to the hardware serial. |
◆ moduleCallback()
bool ConnectinoArrowConnect::moduleCallback |
( |
uint8_t |
subId, |
|
|
uint8_t |
reqId, |
|
|
uint16_t |
dataSize, |
|
|
uint8_t * |
data |
|
) |
| |
|
virtual |
Callback function for serial frames of the ArrowConnect module.
This function will be called for messages sent by the WiFi module which are targeted at the ArrowConnect module.
- Parameters
-
subId | Sub ID of the message. |
reqId | Request ID of the message. |
dataSize | Size of the received data. |
data | Reference to the received data. |
- Return values
-
Returns | whether or not to block the current frame. |
Implements ConnectinoModule.
◆ getModId()
uint8_t ConnectinoArrowConnect::getModId |
( |
| ) |
|
|
virtual |
Get the ID of the ArrowConnect module.
This function will return the module ID of the ArrowConnect module defined in MODULE.h.
- Return values
-
Implements ConnectinoModule.
◆ connect()
bool ConnectinoArrowConnect::connect |
( |
char * |
server, |
|
|
uint16_t |
port, |
|
|
char * |
vHost, |
|
|
char * |
gatewayHid, |
|
|
char * |
apiKey, |
|
|
char * |
deviceHid, |
|
|
bool |
waitConnected |
|
) |
| |
Connect to the configured server and gateway.
This function will configure the ArrowConnect client with the given parameters and try to establish a connection. It will be informed about the connection state in the modules callback function.
- Parameters
-
server | Server address. |
port | Server port. |
vHost | Virtual host. |
gatewayHid | Gateway HID. |
apiKey | Gateway API key. |
deviceHid | Device HID. |
waitConnected | If true this function is a blocking wait until connected. |
- Return values
-
True | if success, false otherwise. |
◆ disconnect()
bool ConnectinoArrowConnect::disconnect |
( |
bool |
waitDisconnected = false | ) |
|
Disconnect from the configured server.
This function will disconnect the ArrowConnect module from the configured server. Connect function needs to be called again to establish connection.
- Parameters
-
waitDisconnected | If true this function is a blocking wait until disconnected. |
- Return values
-
True | if success, false otherwise. |
◆ isConnected()
bool ConnectinoArrowConnect::isConnected |
( |
void |
| ) |
|
Check the connection state of the ArrowConnect module.
Checks if the ArrowConnect module is connected to the configured server.
- Return values
-
True | if connected, false otherwise. |
◆ available()
bool ConnectinoArrowConnect::available |
( |
void |
| ) |
|
Check if data is available.
With this function the user can check if data is available for this device.
- Return values
-
True | if data available, false otherwise. |
- Note
- When data was received the receive buffer is blocked and no other messages can be received. Be sure to read out or clear the data when there is data available.
◆ read()
bool ConnectinoArrowConnect::read |
( |
char * |
command, |
|
|
uint16_t * |
commandLen, |
|
|
char * |
payload, |
|
|
uint16_t * |
payloadLen |
|
) |
| |
Receive commands sent by the server.
This function will read out received commands together with their payload.
- Parameters
-
command | Received command. |
commandLen | Length of received command. |
payload | Received Payload. |
payloadLen | Size of received payload. |
- Return values
-
True | if success, false otherwise. |
◆ clear()
void ConnectinoArrowConnect::clear |
( |
void |
| ) |
|
Clear the receive buffer.
Clears the receive buffer if there is an entry available.
◆ publish() [1/4]
bool ConnectinoArrowConnect::publish |
( |
char * |
varName, |
|
|
char * |
data |
|
) |
| |
Publish data.
This publishes the given string on the configured server if the ArrowConnect module has an active connection.
- Parameters
-
varName | Name of the variable which is sent. |
data | The string which should be sent. |
- Return values
-
True | if success, false otherwise. |
◆ publish() [2/4]
bool ConnectinoArrowConnect::publish |
( |
char * |
varName, |
|
|
bool |
data |
|
) |
| |
Publish data.
This publishes the given boolean on the configured server if the ArrowConnect module has an active connection.
- Parameters
-
varName | Name of the variable which is sent. |
data | The boolean which should be sent. |
- Return values
-
True | if success, false otherwise. |
◆ publish() [3/4]
bool ConnectinoArrowConnect::publish |
( |
char * |
varName, |
|
|
long int |
data |
|
) |
| |
Publish data.
This publishes the given integer on the configured server if the ArrowConnect module has an active connection.
- Parameters
-
varName | Name of the variable which is sent. |
data | The integer which should be sent. |
- Return values
-
True | if success, false otherwise. |
◆ publish() [4/4]
bool ConnectinoArrowConnect::publish |
( |
char * |
varName1, |
|
|
long int |
data1, |
|
|
char * |
varName2, |
|
|
long int |
data2 |
|
) |
| |
Publish data.
This publishes the given integers on the configured server if the ArrowConnect module has an active connection.
- Parameters
-
varName1 | Name of the first variable which is sent. |
data1 | The first integer which should be sent. |
varName2 | Name of the second variable which is sent. |
data2 | The second integer which should be sent. |
- Return values
-
True | if success, false otherwise. |
The documentation for this class was generated from the following files:
- C:/user/jpo/SVN_stxserv/branches/KundenProjekte/Connectino/Arduino_Lib/lib/libraries/ConnectinoArrowConnect/src/ConnectinoArrowConnect.h
- C:/user/jpo/SVN_stxserv/branches/KundenProjekte/Connectino/Arduino_Lib/lib/libraries/ConnectinoArrowConnect/src/ConnectinoArrowConnect.cpp