merging in edge to dev-p24-feedhold-lift. Still many things broken

This commit is contained in:
Alden Hart
2017-01-05 13:14:17 -05:00
70 changed files with 2195 additions and 538 deletions
+35 -8
View File
@@ -89,8 +89,7 @@ void json_parser(char *str)
{
nvObj_t *nv = nv_reset_nv_list(); // get a fresh nvObj list
stat_t status = _json_parser_kernal(nv, str);
if (status == STAT_OK) {
// execute the command
if (status == STAT_OK) { // execute the command
nv = nv_body;
status = _json_parser_execute(nv);
}
@@ -98,7 +97,7 @@ void json_parser(char *str)
return;
}
nv_print_list(status, TEXT_MULTILINE_FORMATTED, JSON_RESPONSE_FORMAT);
// 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
}
@@ -499,7 +498,9 @@ void json_print_list(stat_t status, uint8_t flags)
switch (flags) {
case JSON_NO_PRINT: break;
case JSON_OBJECT_FORMAT: { json_print_object(nv_body); break; }
case JSON_RESPONSE_FORMAT: { json_print_response(status); break; }
case JSON_RESPONSE_FORMAT:
case JSON_RESPONSE_TO_MUTED_FORMAT:
{ json_print_response(status, flags == JSON_RESPONSE_TO_MUTED_FORMAT); break; }
}
}
@@ -522,7 +523,7 @@ void json_print_list(stat_t status, uint8_t flags)
* on all the (non-silent) responses.
*/
void json_print_response(uint8_t status)
void json_print_response(uint8_t status, const bool only_to_muted /*= false*/)
{
if (js.json_verbosity == JV_SILENT) { // silent means no responses
return;
@@ -566,10 +567,13 @@ void json_print_response(uint8_t status)
nv->valuetype = TYPE_EMPTY;
}
}
} while ((nv = nv->nx) != NULL);
} while ((nv = nv->nx) != NULL); // Emergency escape
}
// Footer processing
// Footer processing - wind to the end of the populated blocks
if (nv == NULL) { // this can happen when processing a stale list
return; //...that already has a null-terminated footer
}
while(nv->valuetype != TYPE_EMPTY) { // find a free nvObj at end of the list...
if ((nv = nv->nx) == NULL) { // oops! No free nvObj!
rpt_exception(STAT_JSON_OUTPUT_TOO_LONG, "json_print_response() json too long"); // report this as an exception
@@ -599,7 +603,7 @@ void json_print_response(uint8_t status)
// serialize the JSON response and print it if there were no errors
if (json_serialize(nv_header, cs.out_buf, sizeof(cs.out_buf)) >= 0) {
xio_writeline(cs.out_buf);
xio_writeline(cs.out_buf, only_to_muted);
}
}
@@ -660,6 +664,29 @@ stat_t js_set_jv(nvObj_t *nv)
return(STAT_OK);
}
/*
* json_set_ej() - set JSON communications mode
*/
/*
stat_t json_set_ej(nvObj_t *nv)
{
if (nv->value < TEXT_MODE) {
nv->valuetype = TYPE_NULL;
return (STAT_INPUT_LESS_THAN_MIN_VALUE);
}
if (nv->value > AUTO_MODE) {
nv->valuetype = TYPE_NULL;
return (STAT_INPUT_EXCEEDS_MAX_VALUE);
}
// set json_mode to 0 or 1, but don't change it if comm_mode == 2
if (commMode(nv->value) < AUTO_MODE) {
js.json_mode = commMode(nv->value);
}
return (set_ui8(nv));
}
*/
/***********************************************************************************
* TEXT MODE SUPPORT
* Functions to print variables from the cfgArray table