Skip to content
Open
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
16 changes: 12 additions & 4 deletions components/esp_modem/src/esp_modem_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@ extern "C" esp_err_t esp_modem_at(esp_modem_dce_t *dce_wrap, const char *at, cha
std::string out;
std::string at_str(at);
auto ret = command_response_to_esp_err(dce_wrap->dce->at(at_str, out, timeout));
if ((p_out != NULL) && (!out.empty())) {
strlcpy(p_out, out.c_str(), CONFIG_ESP_MODEM_C_API_STR_MAX);
if ((p_out != NULL)) {
if (!out.empty()) {
strlcpy(p_out, out.c_str(), CONFIG_ESP_MODEM_C_API_STR_MAX);
} else {
p_out[0] = '\0'; // Clear output buffer if no response
}
}
return ret;
}
Expand Down Expand Up @@ -251,8 +255,12 @@ extern "C" esp_err_t esp_modem_at_raw(esp_modem_dce_t *dce_wrap, const char *cmd
}
std::string out;
auto ret = command_response_to_esp_err(dce_wrap->dce->at_raw(cmd, out, pass, fail, timeout));
if ((p_out != NULL) && (!out.empty())) {
strlcpy(p_out, out.c_str(), CONFIG_ESP_MODEM_C_API_STR_MAX);
if ((p_out != NULL)) {
if (!out.empty()) {
strlcpy(p_out, out.c_str(), CONFIG_ESP_MODEM_C_API_STR_MAX);
} else {
p_out[0] = '\0'; // Clear output buffer if no response
}
}
return ret;
}
Expand Down
Loading