Skip to content

feat(modem): execution of AT command in raw mode #11687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions libraries/PPP/src/PPP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,18 @@ String PPPClass::cmd(const char *at_command, int timeout) {
return String(out);
}

String PPPClass::cmd_raw(const char *at_command, int timeout) {
PPP_CMD_MODE_CHECK(String());

char out[CONFIG_ESP_MODEM_C_API_STR_MAX] = {0};
esp_err_t err = _esp_modem_at_raw(_dce, at_command, out, "OK", "ERROR", timeout);
if (err != ESP_OK) {
log_e("esp_modem_at failed %d %s", err, esp_err_to_name(err));
return String();
}
return String(out);
}

size_t PPPClass::printDriverInfo(Print &out) const {
size_t bytes = 0;
if (_dce == NULL || _mode == ESP_MODEM_MODE_DATA) {
Expand Down
6 changes: 6 additions & 0 deletions libraries/PPP/src/PPP.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ class PPPClass : public NetworkInterface {
return cmd(at_command.c_str(), timeout);
}

// Send AT command in raw mode (doesn’t append ‘\r’ to command, returns everything) with timeout in milliseconds
String cmd_raw(const char *at_command, int timeout);
String cmd_raw(String at_command, int timeout) {
return cmd_raw(at_command.c_str(), timeout);
}

// untested
bool powerDown();
bool reset();
Expand Down
Loading