#include <ELClient.h>

Public Member Functions | |
| ELClient (Stream *serial, Stream *debug) | |
| Initialize ELClient and enable debug output. | |
| ELClient (Stream *serial) | |
| Initialize ELClient. | |
| void | Request (uint16_t cmd, uint32_t value, uint16_t argc) |
| Start a request. | |
| void | Request (const void *data, uint16_t len) |
| Append an argument to the request. | |
| void | Request (const __FlashStringHelper *data, uint16_t len) |
| Append an argument to the request. | |
| void | Request (void) |
| Finish the request. | |
| ELClientPacket * | Process (void) |
| Handle serial input. | |
| ELClientPacket * | WaitReturn (uint32_t timeout=ESP_TIMEOUT) |
| Wait for a response from ESP for a given timeout. | |
| boolean | Sync (uint32_t timeout=ESP_TIMEOUT) |
| Synchronize the communication between the MCU and the ESP. | |
| void | GetWifiStatus (void) |
| Request WiFi status from the ESP. | |
| void | init () |
| Initialize ELClient protocol. | |
| void | DBG (const char *info) |
| Send debug message over serial debug stream. | |
| ELClientPacket * | protoCompletedCb (void) |
| Process a received SLIP message. | |
| void | write (uint8_t data) |
| Send a byte. | |
| void | write (void *data, uint16_t len) |
| Send several byte. | |
| uint16_t | crc16Add (unsigned char b, uint16_t acc) |
| Create CRC for a byte add it to an existing CRC checksum and return the result. | |
| uint16_t | crc16Data (const unsigned char *data, uint16_t len, uint16_t acc) |
| Create/add CRC for a data buffer. | |
Data Fields | |
| Stream * | _debug |
| FP< void, void * > | wifiCb |
| void(* | resetCb )() |
| Stream * | _serial |
| boolean | _debugEn |
| uint16_t | crc |
| ELClientProtocol | _proto |
| uint8_t | _protoBuf [128] |
Definition at line 78 of file ELClient.h.
| ELClient::ELClient | ( | Stream * | serial, |
| Stream * | debug | ||
| ) |
Initialize ELClient and enable debug output.
ELClient(Stream* serial, Stream* debug)
Store serial streams to be used for the communication
| serial | Serial stream for communication with ESP |
| debug | Serial stream for debug output |
Definition at line 404 of file ELClient.cpp.

| ELClient::ELClient | ( | Stream * | serial | ) |
Initialize ELClient.
Store serial stream to be used for the communication
| serial | Serial stream for communication with ESP |
Definition at line 371 of file ELClient.cpp.

| uint16_t ELClient::crc16Add | ( | unsigned char | b, |
| uint16_t | acc | ||
| ) |
Create CRC for a byte add it to an existing CRC checksum and return the result.
crc16Add(unsigned char b, uint16_t acc)
| b | Byte which CRC will be added |
| acc | Existing CRC checksum |
uint16_t New CRC checksum Definition at line 468 of file ELClient.cpp.

| uint16_t ELClient::crc16Data | ( | const unsigned char * | data, |
| uint16_t | len, | ||
| uint16_t | acc | ||
| ) |
Create/add CRC for a data buffer.
crc16Data(const unsigned char *data, uint16_t len, uint16_t acc)
| data | The data buffer which will be CRCed |
| len | Size of the data buffer |
| acc | Existing CRC checksum |
uint16_t New CRC checksum Definition at line 493 of file ELClient.cpp.


| void ELClient::DBG | ( | const char * | info | ) |
Send debug message over serial debug stream.
ELClient::DBG(const char* info)
| info | Debug message |
Definition at line 419 of file ELClient.cpp.

| void ELClient::GetWifiStatus | ( | void | ) |
Request WiFi status from the ESP.
Definition at line 564 of file ELClient.cpp.

| void ELClient::init | ( | ) |
Initialize ELClient protocol.
Prepare buffer for protocol
Definition at line 339 of file ELClient.cpp.

| ELClientPacket * ELClient::Process | ( | void | ) |
Handle serial input.
Read all characters available on the serial input and process any messages that arrive, but stop if a non-callback response comes in
ELClientPacket Pointer to ELClientResponse structure with the received response Definition at line 115 of file ELClient.cpp.


| ELClientPacket * ELClient::protoCompletedCb | ( | void | ) |
Process a received SLIP message.
protoCompletedCb(void *res)
Callback to process a SLIP message and check CRCs If a user callback function was defined in the message, ELClientResponse is called to handle the callback.
ELClientPacket Pointer to ELClientPacket structure generated or NULL if it the message is from a callback or if an error occured Definition at line 31 of file ELClient.cpp.


| void ELClient::Request | ( | const __FlashStringHelper * | data, |
| uint16_t | len | ||
| ) |
Append an argument to the request.
Request(const __FlashStringHelper* data, uint16_t len)
Send additional arguments located in flash as appendment to the ESP
| data | Pointer to the buffer with the argument |
| len | Size of the argument buffer |
Definition at line 285 of file ELClient.cpp.

| void ELClient::Request | ( | const void * | data, |
| uint16_t | len | ||
| ) |
Append an argument to the request.
Request(uint16_t cmd, uint32_t value, uint16_t argc)
Send additional arguments as appendment to the ESP
| data | Pointer to the buffer with the argument |
| len | Size of the argument buffer |
Definition at line 243 of file ELClient.cpp.

| void ELClient::Request | ( | uint16_t | cmd, |
| uint32_t | value, | ||
| uint16_t | argc | ||
| ) |
Start a request.
Request(uint16_t cmd, uint32_t value, uint16_t argc)
Start preparing a request by sending the command, number of arguments and the first argument (which can be a callback pointer)
| cmd | Command for the ESP, see enum CmdName for available commands |
| value | First argument or pointer to a callback function |
| argc | Number of arguments in this request |
Definition at line 211 of file ELClient.cpp.


| void ELClient::Request | ( | void | ) |
Finish the request.
Send final CRC and SLIP_END to the ESP to finish the request
Definition at line 322 of file ELClient.cpp.


| boolean ELClient::Sync | ( | uint32_t | timeout = ESP_TIMEOUT | ) |
Synchronize the communication between the MCU and the ESP.
| timeout | Timeout for synchronization request |
boolean True if synchronization succeeds or False if it fails Definition at line 521 of file ELClient.cpp.

| ELClientPacket * ELClient::WaitReturn | ( | uint32_t | timeout = ESP_TIMEOUT | ) |
Wait for a response from ESP for a given timeout.
| timeout | Time in milliseconds to wait for a response, defaults to ESP_TIMEOUT |
ELClientPacket Received packet or null if timeout occured Definition at line 444 of file ELClient.cpp.


| void ELClient::write | ( | uint8_t | data | ) |
Send a byte.
Write a byte to the output stream and perform SLIP escaping
| data | Byte to be sent |
Definition at line 154 of file ELClient.cpp.

| void ELClient::write | ( | void * | data, |
| uint16_t | len | ||
| ) |
Send several byte.
write(void* data, uint16_t len)
Write some bytes to the output stream, no SLIP escaping is performed
| data | Pointer to data buffer to be sent |
| len | Size of data buffer |
Definition at line 183 of file ELClient.cpp.

| Stream* ELClient::_debug |
Data stream for debug use
Definition at line 85 of file ELClient.h.
| boolean ELClient::_debugEn |
Flag for debug - True = enabled, False = disabled
Definition at line 125 of file ELClient.h.
| ELClientProtocol ELClient::_proto |
Protocol structure
Definition at line 127 of file ELClient.h.
| uint8_t ELClient::_protoBuf[128] |
Protocol buffer
Definition at line 128 of file ELClient.h.
| Stream* ELClient::_serial |
Serial stream for communication with ESP
Definition at line 124 of file ELClient.h.
| uint16_t ELClient::crc |
CRC checksum
Definition at line 126 of file ELClient.h.
| void(* ELClient::resetCb) () |
Pointer to callback function
Definition at line 121 of file ELClient.h.
| FP<void, void*> ELClient::wifiCb |
Pointer to callback function
Definition at line 118 of file ELClient.h.