I ran into the same problem, but solved it by adding some printstatement, where the JSON is parsed
Like in this statement
LOCAL struct jsontree_callback status_callback = JSONTREE_CALLBACK(status_get, status_set);
Where the first parameter is used when GETting your values and setting it into the JSON-variable, and the second is SETting your variables from values in the JSON-variable.
ANd then in the status-set function adding
/******************************************************************************
* FunctionName : status_set
* Description : parse the device status parmer as a JSON format
* Parameters : js_ctx -- A pointer to a JSON set up
* parser -- A pointer to a JSON parser state
* Returns : result
*******************************************************************************/
LOCAL int ICACHE_FLASH_ATTR
status_set(struct jsontree_context *js_ctx, struct jsonparse_state *parser)
{
int type;
while ((type = jsonparse_next(parser)) != 0) {
if (type == JSON_TYPE_PAIR_NAME) {
if (jsonparse_strcmp_value(parser, "status") == 0) {
uint8 status;
jsonparse_next(parser);
jsonparse_next(parser);
status = jsonparse_get_value_as_int(parser);
user_plug_set_status(status);
os_printf("status: %d\n", status);
}
}
}
return 0;
}
Best regards
ThorvaldStatistics: Posted by Thorvald — Mon Mar 02, 2015 4:43 pm
]]>