@@ -168,8 +168,20 @@ void CAtHandler::add_cmds_preferences() {
168
168
}
169
169
break ;
170
170
case PreferenceType::PT_STR: {
171
- auto value = parser.args [2 ];
172
- error = String (pref.putString (key.c_str (), value.c_str ())) + " \r\n " ;
171
+ int value = atoi (parser.args [2 ].c_str ());
172
+ pref_buf = srv.inhibit_read (value);
173
+ size_t offset = pref_buf.size ();
174
+ if (offset < value) {
175
+ pref_buf.resize (value);
176
+ do {
177
+ offset += serial->read (pref_buf.data () + offset, value - offset);
178
+ } while (offset < value);
179
+ }
180
+
181
+ pref_buf.push_back (' \0 ' );
182
+
183
+ srv.continue_read ();
184
+ error = String (pref.putString (key.c_str (), (char *)pref_buf.data ())) + " \r\n " ;
173
185
}
174
186
break ;
175
187
case PreferenceType::PT_BLOB: {
@@ -297,7 +309,13 @@ void CAtHandler::add_cmds_preferences() {
297
309
break ;
298
310
case PreferenceType::PT_STR: {
299
311
auto value = parser.args [2 ];
300
- error = String (pref.getString (key.c_str (), value.c_str ())) + " \r\n " ;
312
+ auto res = pref.getString (key.c_str (), value.c_str ());
313
+
314
+ srv.write_response_prompt ();
315
+ srv.write_str (String (res.length ()).c_str ());
316
+ srv.write_str (" |" );
317
+ srv.write_str (res.c_str ());
318
+ srv.write_line_end ();
301
319
}
302
320
break ;
303
321
case PreferenceType::PT_BLOB: {
@@ -320,7 +338,7 @@ void CAtHandler::add_cmds_preferences() {
320
338
}
321
339
322
340
323
- if (type != PreferenceType::PT_BLOB) {
341
+ if (type != PreferenceType::PT_BLOB && type != PreferenceType::PT_STR ) {
324
342
srv.write_response_prompt ();
325
343
srv.write_str ((const char *)(error.c_str ()));
326
344
srv.write_line_end ();
0 commit comments