CellularHelper
Public Member Functions | Data Fields
CellularHelperPlusStringResponse Class Reference

Things that return a + response and a string use this. More...

#include <CellularHelper.h>

Inheritance diagram for CellularHelperPlusStringResponse:
CellularHelperCommonResponse CellularHelperCREGResponse CellularHelperEnvironmentResponse CellularHelperExtendedQualResponse CellularHelperLocationResponse CellularHelperRSSIQualResponse CellularHelperEnvironmentResponseStatic< MAX_NEIGHBOR_CELLS >

Public Member Functions

virtual int parse (int type, const char *buf, int len)
 Method to parse the output from the modem. More...
 
String getDoubleQuotedPart (bool onlyFirst=true) const
 Gets the double quoted part of a string response. More...
 
- Public Member Functions inherited from CellularHelperCommonResponse
void logCellularDebug (int type, const char *buf, int len) const
 Used when enableDebug is true to log the Cellular.command callback data using Log.info. More...
 

Data Fields

String command
 Your subclass must set this to the command requesting (not including the AT+ part) More...
 
String string
 Returned string is stored here.
 
- Data Fields inherited from CellularHelperCommonResponse
int resp = RESP_ERROR
 Response code from Cellular.command. More...
 
bool enableDebug = false
 Enables debug mode (default: false) More...
 

Detailed Description

Things that return a + response and a string use this.

Since it inherits from CellularHelperCommonResponse you can check resp == RESP_OK to make sure the call succeeded.

Member Function Documentation

◆ getDoubleQuotedPart()

String CellularHelperPlusStringResponse::getDoubleQuotedPart ( bool  onlyFirst = true) const

Gets the double quoted part of a string response.

Parameters
onlyFirst(boolean, default true) Only the first double quoted string is returned if true. If false, all double quoted strings are concatenated, ignoring all of the parts outside of the double quotes.

Some commands, like AT+UDOPN return a + response that contains a double quoted string. If you only want to extract this string, you can use this method to extract it.

◆ parse()

int CellularHelperPlusStringResponse::parse ( int  type,
const char *  buf,
int  len 
)
virtual

Method to parse the output from the modem.

Parameters
typeone of 13 different enumerated AT command response types.
bufa pointer to the character array containing the AT command response.
lenlength of the AT command response buf.

This is called from responseCallback, which is the callback to Cellular.command.

This class just appends all + responses (TYPE_PLUS) that match command into string.

Implements CellularHelperCommonResponse.

Reimplemented in CellularHelperEnvironmentResponse.

Field Documentation

◆ command

String CellularHelperPlusStringResponse::command

Your subclass must set this to the command requesting (not including the AT+ part)

Say you're implementing an AT+CSQ response handler. You would set command to "CSQ". This is because the modem will return +CSQ as the response so the parser needs to know what to look for.


The documentation for this class was generated from the following files: