Skip to content

Commit 1d80cbc

Browse files
committed
fix(modem): Fixed set_pdp_context() command timeout
Closes #455
1 parent 82c2cf8 commit 1d80cbc

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

components/esp_modem/include/cxx_include/esp_modem_command_library.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ command_result power_down_sim70xx(CommandableIf *t);
5555
command_result set_network_bands_sim76xx(CommandableIf *t, const std::string &mode, const int *bands, int size);
5656
command_result power_down_sim8xx(CommandableIf *t);
5757
command_result set_data_mode_sim8xx(CommandableIf *t);
58+
command_result set_pdp_context(CommandableIf *t, PdpContext &pdp, uint32_t timeout_ms);
5859

5960
/**
6061
* @}

components/esp_modem/include/cxx_include/esp_modem_dce_module.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ class SIM800: public GenericModule {
170170
*/
171171
class BG96: public GenericModule {
172172
using GenericModule::GenericModule;
173+
public:
174+
command_result set_pdp_context(PdpContext &pdp) override;
173175
};
174176

175177
/**

components/esp_modem/src/esp_modem_command_library.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -261,12 +261,17 @@ command_result set_echo(CommandableIf *t, bool on)
261261
return generic_command_common(t, "ATE0\r");
262262
}
263263

264-
command_result set_pdp_context(CommandableIf *t, PdpContext &pdp)
264+
command_result set_pdp_context(CommandableIf *t, PdpContext &pdp, uint32_t timeout_ms)
265265
{
266266
ESP_LOGV(TAG, "%s", __func__ );
267267
std::string pdp_command = "AT+CGDCONT=" + std::to_string(pdp.context_id) +
268268
",\"" + pdp.protocol_type + "\",\"" + pdp.apn + "\"\r";
269-
return generic_command_common(t, pdp_command, 150000);
269+
return generic_command_common(t, pdp_command, timeout_ms);
270+
}
271+
272+
command_result set_pdp_context(CommandableIf *t, PdpContext &pdp)
273+
{
274+
return set_pdp_context(t, pdp, 1000);
270275
}
271276

272277
command_result set_data_mode(CommandableIf *t)

components/esp_modem/src/esp_modem_modules.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -82,4 +82,9 @@ command_result SIM800::set_data_mode()
8282
return dce_commands::set_data_mode_sim8xx(dte.get());
8383
}
8484

85+
command_result BG96::set_pdp_context(esp_modem::PdpContext &pdp)
86+
{
87+
return dce_commands::set_pdp_context(dte.get(), pdp, 300);
88+
}
89+
8590
}

0 commit comments

Comments
 (0)