Fix JSON escaping and scoping
This commit is contained in:
@ -49,7 +49,7 @@ static void rpc_channel_toggle_handler(struct mg_rpc_request_info *ri, void *cb_
|
||||
return;
|
||||
|
||||
channel_handler(gpio, NULL);
|
||||
mg_rpc_send_responsef(ri, "idx: %d, relay_state: %d", idx, channel_get(idx));
|
||||
mg_rpc_send_responsef(ri, "{idx: %d, relay_state: %d}", idx, channel_get(idx));
|
||||
ri = NULL;
|
||||
|
||||
(void) ri;
|
||||
@ -67,7 +67,7 @@ static void rpc_channel_get_handler(struct mg_rpc_request_info *ri, void *cb_arg
|
||||
if (!rpc_args_to_idx_and_gpio(ri, args, &idx, &gpio))
|
||||
return;
|
||||
|
||||
mg_rpc_send_responsef(ri, "idx: %d, relay_state: %d", idx, channel_get(idx));
|
||||
mg_rpc_send_responsef(ri, "{idx: %d, relay_state: %d}", idx, channel_get(idx));
|
||||
ri = NULL;
|
||||
|
||||
(void) ri;
|
||||
@ -103,7 +103,7 @@ static void rpc_channel_set_handler(struct mg_rpc_request_info *ri, void *cb_arg
|
||||
}
|
||||
|
||||
channel_set(idx, (bool) value);
|
||||
mg_rpc_send_responsef(ri, "idx: %d, relay_state: %d", idx, channel_get(idx));
|
||||
mg_rpc_send_responsef(ri, "{idx: %d, relay_state: %d}", idx, channel_get(idx));
|
||||
ri = NULL;
|
||||
|
||||
(void) ri;
|
||||
|
Reference in New Issue
Block a user