Another pass at Marlin Compatibility mode. Functional enough to test.

This commit is contained in:
Rob Giseburt
2017-01-20 14:36:21 -06:00
parent c1b2a91115
commit 3556a2cbf3
16 changed files with 526 additions and 147 deletions
+4 -3
View File
@@ -85,7 +85,7 @@ static stat_t _get_nv_pair(nvObj_t *nv, char **pstr, int8_t *depth);
* _json_parser_execute() executes sets and gets in an application agnostic way. It should work for other apps than g2core
*/
void json_parser(char *str)
stat_t json_parser(char *str, bool suppress_response) // suppress_response defaults to false, see decalaration in .h
{
nvObj_t *nv = nv_reset_nv_list(); // get a fresh nvObj list
stat_t status = _json_parser_kernal(nv, str);
@@ -93,11 +93,12 @@ void json_parser(char *str)
nv = nv_body;
status = _json_parser_execute(nv);
}
if (status == STAT_COMPLETE) { // skip the print if returning from something that already did it.
return;
if (suppress_response || (status == STAT_COMPLETE)) { // skip the print if returning from something that already did it.
return status;
}
nv_print_list(status, TEXT_NO_PRINT, JSON_RESPONSE_FORMAT);
sr_request_status_report(SR_REQUEST_TIMED); // generate incremental status report to show any changes
return STAT_OK;
}
// This is almost the same as json_parser, except it doesn't *always* execute the parsed out list, and it never returns a reponse