Add variation of PPPClass::cmd() #12034
Open
+39
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
Current
String PPPClass::cmd(const char *at_command, int timeout)function can return empty string in 3 cases:OKAT response is receivedERRORAT response is received.That is because
esp_modem_at()from esp-modem does not return basic AT responses (OK/ERROR) as output strings, only asesp_err_treturned by a function.This PR adds
bool PPPClass::cmd(const char *at_command, String &response, int timeout);function and itsbool PPPClass::cmd(String at_command, String &response, int timeout)variation.These functions allow to return command response in more detailed way:
responseis empty (not touched)responsecontainsERRORor detailed AT responseresponsecontainsOKor detailed AT responseExample output from the functions:
AT+CFUN=1returns true; response containsOKorAT+CFUN=1if command echo is enabledAT+CFUN=4returns true; response contains+PPPD: DISCONNECTED. Response is caused by SIM7600E sending+PPPD: DISCONNECTEDbefore sending theOKresponse.AT+CPSI?returns true; response contains+CPSI: LTE,Online, [...]Test Scenarios
Tested on arduino-esp32 v3.3.4; ESP32 DevKit; SIM7600E modem
Related links