Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
AtClient Class Reference

Class that facilitates the communication with an AT device. More...

#include <AtClient.h>

Public Member Functions

 AtClient (HardwareSerial *stream)
 
void send (const String &text, const String &altResponse=nullptr, uint32_t timeoutMs=AT_TIMEOUT, unsigned retries=0)
 Sends AT command. More...
 
void send (const String &text, AtReceiveCallback onReceive, uint32_t timeoutMs=AT_TIMEOUT, unsigned retries=0)
 Sends AT command. More...
 
void send (const String &text, AtCompleteCallback onComplete, uint32_t timeoutMs=AT_TIMEOUT, unsigned retries=0)
 Sends AT command. More...
 
void send (AtCommand command)
 Adds a command to the queue. If you need all the flexibility then use that command and manually set your AtCommand arguments. More...
 
void sendDirect (AtCommand command)
 Executes directly (does not queue it) a command. More...
 
AtState getState ()
 Returns the current state. More...
 
void resend ()
 
void next ()
 

Public Attributes

AtCommand currentCommand
 The current command. More...
 

Protected Member Functions

virtual void processor (Stream &source, char arrivedChar, uint16_t availableCharsCount)
 Processes response data. More...
 

Detailed Description

Class that facilitates the communication with an AT device.

Member Function Documentation

AtState AtClient::getState ( )
inline

Returns the current state.

Returns
AtState
virtual void AtClient::processor ( Stream source,
char  arrivedChar,
uint16_t  availableCharsCount 
)
protectedvirtual

Processes response data.

void AtClient::send ( const String text,
const String altResponse = nullptr,
uint32_t  timeoutMs = AT_TIMEOUT,
unsigned  retries = 0 
)

Sends AT command.

Parameters
textString The actual AT command text. For example AT+CAMSTOP
altResponseString Expected response on success in addition to the default one which is OK
timeoutMsuint32_t Time in milliseconds to wait for response
retriesunsigned Retries on error
void AtClient::send ( const String text,
AtReceiveCallback  onReceive,
uint32_t  timeoutMs = AT_TIMEOUT,
unsigned  retries = 0 
)

Sends AT command.

Parameters
textString The actual AT command text. For example AT+CAMSTOP
AtReceiveCallbackonReceive
timeoutMsuint32_t Time in milliseconds to wait for response
retriesint Retries on error
void AtClient::send ( const String text,
AtCompleteCallback  onComplete,
uint32_t  timeoutMs = AT_TIMEOUT,
unsigned  retries = 0 
)

Sends AT command.

Parameters
textString The actual AT command text. For example AT+CAMSTOP
AtCompleteCallbackonComplete
timeoutMsuint32_t Time in milliseconds to wait for response
retriesint Retries on error
void AtClient::send ( AtCommand  command)

Adds a command to the queue. If you need all the flexibility then use that command and manually set your AtCommand arguments.

Parameters
commandAtCommand
void AtClient::sendDirect ( AtCommand  command)

Executes directly (does not queue it) a command.

Parameters
commandAtCommand

Member Data Documentation

AtCommand AtClient::currentCommand

The current command.