CellularHelper
|
Things that return a + response and a string use this. More...
#include <CellularHelper.h>
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... | |
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.
String CellularHelperPlusStringResponse::getDoubleQuotedPart | ( | bool | onlyFirst = true | ) | const |
Gets the double quoted part of a string response.
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.
|
virtual |
Method to parse the output from the modem.
type | one of 13 different enumerated AT command response types. |
buf | a pointer to the character array containing the AT command response. |
len | length 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.
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.