16 #ifndef _SMING_CORE_ATCLIENT_H_ 17 #define _SMING_CORE_ATCLIENT_H_ 19 #include "HardwareSerial.h" 24 #define AT_REPLY_OK "OK" 26 #define AT_TIMEOUT 2000 43 bool breakOnError =
true;
48 typedef enum { eAtOK = 0, eAtRunning, eAtError } AtState;
69 void send(
const String& text,
const String& altResponse =
nullptr, uint32_t timeoutMs = AT_TIMEOUT,
70 unsigned retries = 0);
132 virtual void processor(
Stream& source,
char arrivedChar, uint16_t availableCharsCount);
138 AtState state = eAtOK;
void sendDirect(AtCommand command)
Executes directly (does not queue it) a command.
void send(const String &text, const String &altResponse=nullptr, uint32_t timeoutMs=AT_TIMEOUT, unsigned retries=0)
Sends AT command.
String response2
alternative successful response
Definition: AtClient.h:40
The string class.
Definition: WString.h:104
AtCommand currentCommand
The current command.
Definition: AtClient.h:126
AtState getState()
Returns the current state.
Definition: AtClient.h:110
Definition: AtClient.h:38
Hardware serial class.
Definition: HardwareSerial.h:100
virtual void processor(Stream &source, char arrivedChar, uint16_t availableCharsCount)
Processes response data.
unsigned retries
number of retries before giving up
Definition: AtClient.h:42
unsigned timeout
timeout in milliseconds
Definition: AtClient.h:41
Class that facilitates the communication with an AT device.
Definition: AtClient.h:53
String text
the actual AT command
Definition: AtClient.h:39