-
Notifications
You must be signed in to change notification settings - Fork 138
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
Request for Additional Method in ESP Modem: Handling Larger AT Command Responses (IDFGH-13338) #624
Comments
@david-cermak |
Yes, I'll look into it, planning on some maintenance work and the v1.2 release in about two weeks. |
I was not able to create a pull request for esp-modem |
Hi @david-cermak set(ESP_MODEM_C_API_STR_MAX_DEFAULT 512) even though it's better to have specific method to pass the max_length. |
Fixed in #649 |
Is your feature request related to a problem?
When issuing the commands AT+CMGF=0 and AT+CMGL=4, the response results in more data than usual. To handle this, we need an additional method that takes max_len as an argument.
Describe the solution you'd like.
This method allows the user to specify the maximum length of the output buffer, ensuring that larger responses can be handled appropriately.
extern "C" esp_err_t esp_modem_at_raw_ext(esp_modem_dce_t *dce_wrap, const char *cmd, char *p_out, const char *pass, const char *fail, int timeout, size_t max_len)
{
if (dce_wrap == nullptr || dce_wrap->dce == nullptr) {
return ESP_ERR_INVALID_ARG;
}
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(), max_len);
}
return ret;
}
Describe alternatives you've considered.
#define STR_MAX 1024
esp_modem_dce_t *dce_wrap;
char response[ESP_MODEM_C_API_STR_MAX];
esp_err_t ret = esp_modem_at_raw_ext(dce_wrap, "AT+CMGL=4", response, "OK", "ERROR", 1000, STR_MAX );
if (ret == ESP_OK) {
// Process the response
}
Additional context.
No response
The text was updated successfully, but these errors were encountered: