代码拉取完成,页面将自动刷新
同步操作将从 rENYI/propwd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include <json.h>
#include <stdio.h>
void json_parse(json_object * jobj) {
enum json_type type;
json_object_object_foreach(jobj, key, val) {
//type = json_object_get_type(val);
//switch (type) {
// case json_type_string: printf("type: json_type_string, ");
printf("%s =>%s\n", key, json_object_get_string(val));
if (key == 'result'){
json_object * jobj = json_tokener_parse(json_object_get_string(val));
json_parse(jobj);
}
// break;
//}
}
}
int main()
{
char * string = "{\"jsonrpc\":\"2.0\",\"id\":0,\"result\":[0,{\"device_id\":\"INyRyS5Y6166\",\"device_name\":\"Ren\",\"device_sn\":\"ACPZ0FC206166\",\"system_name\":\"挖矿固件\",\"system_version\":\"V1.2.135\",\"hardware_model\":\"WS1508\",\"mac_address\":\"B0:D5:9D:62:86:EF\",\"lan_ip\":\"192.168.1.143\",\"account_id\":\"469956463\",\"account_name\":\"469956463\",\"product_id\":321,\"disk_quota\":\"10995116277760\",\"schedule_hours\":\"[ { \\\"from\\\": 0, \\\"to\\\": 24, \\\"type\\\": \\\"unlimit\\\", \\\"params\\\": { } } ]\"}]}";
printf ("JSON string: %s\n", string);
json_object * jobj = json_tokener_parse(string);
json_parse(jobj);
struct json_object *result_object = NULL;
struct json_object *result_object1 = NULL;
struct json_object *result_object2 = NULL;
result_object = json_object_object_get(jobj, "result");
printf("-----------result_object method ---------------------------\n");
printf("%s\n", json_object_to_json_string(result_object));
printf("-----------result_object method---------------------------\n");
result_object = json_object_array_get_idx(result_object, 1);
result_object1 = json_object_object_get(result_object, "device_id");
printf("-----------device_id method ---------------------------\n");
printf("%s\n", json_object_to_json_string(result_object1));
printf("-----------device_id method---------------------------\n");
result_object2 = json_object_object_get(result_object, "device_name");
printf("-----------device_name method ---------------------------\n");
printf("%s\n", json_object_to_json_string(result_object2));
printf("-----------device_name method---------------------------\n");
/*
char passsend[1000];
sprintf(passsend, "{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"call\",\"params\":[\"\",\"netcfg\",\"set_device_discovery\",{\"device_id\":\"INyRyS5Y6166\",\"device_name\":\"jj\",\"device_password\":\"u6ZPLocu\"}]}");
printf("%s\n\n",passsend);
*/
char * device_id = "INyRyS5Y6166";
char * device_name = "kuangji";
char * device_password ="000000";
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。