Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Modem passthrough response #409

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions 4 libraries/Preferences/src/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ size_t Preferences::putBytes(const char* key, const void* value, size_t len) {
string res = "";
if ( key != nullptr && strlen(key) > 0 && value != nullptr && len > 0) {
modem.write_nowait(string(PROMPT(_PREF_PUT)), res, "%s%s,%d,%d\r\n", CMD_WRITE(_PREF_PUT), key, PT_BLOB, len);
if(modem.passthrough((uint8_t *)value, len)) {
return len;
if(modem.passthrough((uint8_t *)value, len, &res)) {
return atoi(res.c_str());
}
}
return 0;
Expand Down
6 changes: 5 additions & 1 deletion 6 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 2 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
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.