Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added the possibility to get the modem answer from a passthrough call
  • Loading branch information
andreagilardoni committed Dec 2, 2024
commit 8e297d005f6d23482585ba3e969d63fe7b9a3de0
6 changes: 5 additions & 1 deletion libraries/WiFiS3/src/Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ void ModemClass::end(){
}

/* -------------------------------------------------------------------------- */
bool ModemClass::passthrough(const uint8_t *data, size_t size) {
bool ModemClass::passthrough(const uint8_t *data, size_t size, std::string *response) {
/* -------------------------------------------------------------------------- */
_serial->write(data,size);

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

if(response != nullptr) {
*response = data_res;
}

if(_serial_debug && _debug_level >= 2) {
_serial_debug->print(" ANSWER (passthrough): ");
_serial_debug->println(data_res.c_str());
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFiS3/src/Modem.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ModemClass {
bool write(const std::string &cmd, std::string &str, const char * fmt, ...);
void write_nowait(const std::string &cmd, std::string &str, const char * fmt, ...);

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