Skip to content

Commit 8e297d0

Browse files
Added the possibility to get the modem answer from a passthrough call
1 parent 03b4a91 commit 8e297d0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

libraries/WiFiS3/src/Modem.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@ void ModemClass::end(){
4848
}
4949

5050
/* -------------------------------------------------------------------------- */
51-
bool ModemClass::passthrough(const uint8_t *data, size_t size) {
51+
bool ModemClass::passthrough(const uint8_t *data, size_t size, std::string *response) {
5252
/* -------------------------------------------------------------------------- */
5353
_serial->write(data,size);
5454

5555
std::string prompt = DO_NOT_CHECK_CMD, data_res;
5656
auto res = buf_read(prompt, data_res);
5757

58+
if(response != nullptr) {
59+
*response = data_res;
60+
}
61+
5862
if(_serial_debug && _debug_level >= 2) {
5963
_serial_debug->print(" ANSWER (passthrough): ");
6064
_serial_debug->println(data_res.c_str());

libraries/WiFiS3/src/Modem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ModemClass {
2727
bool write(const std::string &cmd, std::string &str, const char * fmt, ...);
2828
void write_nowait(const std::string &cmd, std::string &str, const char * fmt, ...);
2929

30-
bool passthrough(const uint8_t *data, size_t size);
30+
bool passthrough(const uint8_t *data, size_t size, std::string *response=nullptr);
3131
void avoid_trim_results() {
3232
/* one shot - it works only 1 time the it is necessary to call again this
3333
funtion */

0 commit comments

Comments
 (0)