int main() { printf("Test Function\n"); //dup_init(); iot_init(); //rule_init(); json_object *jso = json_object_from_file("./example/iot_config.json"); if (jso) { //json_object_put(jso); json_object_object_foreach(jso, key, child_object) { if(!strcmp(key, "iot-device")) { for(int i =0; i < json_object_array_length(child_object); i++) { json_object* iot_object = json_object_array_get_idx(child_object, i); iot_json_create(iot_object); printf("\n"); } } else if(!strcmp(key, "rule")) { for(int i =0; i < json_object_array_length(child_object); i++) { json_object* rule_object = json_object_array_get_idx(child_object, i); rule_json_create(rule_object); printf("\n"); } } } } return 0; }
unsigned short fs2416_init(void) { struct iotdev *fs2416_dev; bool_t bool = BOOL_FALSE; fs2416_dev = (struct iotdev *)kmalloc(sizeof(struct iotdev),GFP_KERNEL); iot_init(&fs2416_dev,&fs2416_ops); if(fs2416_dev == NULL) { return RET_ERR; } bool = iot_register_devlist(&fs2416_dev->ops); if(bool == BOOL_FALSE) { printk("register device faild.\n"); kfree(fs2416_dev); return RET_ERR; } return RET_OK; }