1 #ifndef ConnectinoArrowConnect_h 2 #define ConnectinoArrowConnect_h 4 #include "ConnectinoModule.h" 6 #include "StxHwSerial.h" 8 #define ARROW_CONNECT_SERVER_MAX_LEN 64 9 #define ARROW_CONNECT_VHOST_MAX_LEN 24 10 #define ARROW_CONNECT_HID_LEN 40 37 bool moduleCallback(uint8_t subId, uint8_t reqId, uint16_t dataSize, uint8_t *data);
59 bool connect(
char *server, uint16_t port,
char *vHost,
char *gatewayHid,
char *apiKey,
char *deviceHid,
bool waitConnected);
68 bool disconnect(
bool waitDisconnected =
false);
93 bool read(
char *command, uint16_t *commandLen,
char *payload, uint16_t *payloadLen);
107 bool publish(
char *varName,
char *data);
116 bool publish(
char *varName,
bool data);
125 bool publish(
char *varName,
long int data);
136 bool publish(
char *varName1,
long int data1,
char *varName2,
long int data2);
138 StxHwSerial &StxSerial;
139 volatile bool _reqPending;
140 volatile bool _reqResOk;
141 volatile uint8_t _reqSubId;
142 volatile uint8_t _reqReqId;
143 volatile uint8_t _reqState;
145 volatile char *_reqServer;
146 volatile uint16_t *_reqPort;
147 volatile char *_reqVHost;
148 volatile char *_reqGatewayHid;
150 volatile bool _isConnected =
false;
151 volatile bool _dataAvailable =
false;
153 uint8_t _deviceHid[ARROW_CONNECT_HID_LEN];
160 bool _setState(uint8_t state);
167 bool _getState(uint8_t *state);
178 bool _setConfig(
char *server, uint16_t port,
char *vHost,
char *gatewayHid,
char *apiKey);
188 bool _getConfig(
char *server, uint16_t *port,
char *vHost,
char *gatewayHid);
197 bool _sendData(uint8_t datatype,
char *varName,
void *data);
207 bool _sendDataMulti(uint8_t datatype[],
char *varName[],
void *data[], uint16_t numData);
ConnectinoArrowConnect(StxHwSerial &refSerial)
ArrowConnect module constructor.
Definition: ConnectinoArrowConnect.cpp:289
bool isConnected(void)
Check the connection state of the ArrowConnect module.
Definition: ConnectinoArrowConnect.cpp:435
ArrowConnect module.
Definition: ConnectinoArrowConnect.h:19
bool connect(char *server, uint16_t port, char *vHost, char *gatewayHid, char *apiKey, char *deviceHid, bool waitConnected)
Connect to the configured server and gateway.
Definition: ConnectinoArrowConnect.cpp:396
uint8_t getModId()
Get the ID of the ArrowConnect module.
Definition: ConnectinoArrowConnect.cpp:293
bool moduleCallback(uint8_t subId, uint8_t reqId, uint16_t dataSize, uint8_t *data)
Callback function for serial frames of the ArrowConnect module.
Definition: ConnectinoArrowConnect.cpp:298
bool publish(char *varName, char *data)
Publish data.
Definition: ConnectinoArrowConnect.cpp:500
bool available(void)
Check if data is available.
Definition: ConnectinoArrowConnect.cpp:440
bool disconnect(bool waitDisconnected=false)
Disconnect from the configured server.
Definition: ConnectinoArrowConnect.cpp:424
void clear(void)
Clear the receive buffer.
Definition: ConnectinoArrowConnect.cpp:494
bool read(char *command, uint16_t *commandLen, char *payload, uint16_t *payloadLen)
Receive commands sent by the server.
Definition: ConnectinoArrowConnect.cpp:445
Binuart module.
Definition: ConnectinoModule.h:10