From 3ea9a16adb6f0d2ec40f54f49055565854382688 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Thu, 3 Oct 2019 21:56:54 +0200 Subject: [PATCH] Add skeleton of FollowSun.* RPCs --- src/rpc.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/rpc.c b/src/rpc.c index 5d31e85..8dd12f6 100644 --- a/src/rpc.c +++ b/src/rpc.c @@ -287,6 +287,46 @@ exit: (void)fi; } +static void rpc_followsun_get_handler(struct mg_rpc_request_info *ri, void *cb_arg, struct mg_rpc_frame_info *fi, struct mg_str args) { + rpc_log(ri, args); + mg_rpc_send_errorf(ri, 400, "Not implemented yet"); + ri = NULL; + return; + + (void)cb_arg; + (void)fi; +} + +static void rpc_followsun_set_handler(struct mg_rpc_request_info *ri, void *cb_arg, struct mg_rpc_frame_info *fi, struct mg_str args) { + rpc_log(ri, args); + mg_rpc_send_errorf(ri, 400, "Not implemented yet"); + ri = NULL; + return; + + (void)cb_arg; + (void)fi; +} + +static void rpc_followsun_clear_handler(struct mg_rpc_request_info *ri, void *cb_arg, struct mg_rpc_frame_info *fi, struct mg_str args) { + rpc_log(ri, args); + mg_rpc_send_errorf(ri, 400, "Not implemented yet"); + ri = NULL; + return; + + (void)cb_arg; + (void)fi; +} + +static void rpc_followsun_replace_handler(struct mg_rpc_request_info *ri, void *cb_arg, struct mg_rpc_frame_info *fi, struct mg_str args) { + rpc_log(ri, args); + mg_rpc_send_errorf(ri, 400, "Not implemented yet"); + ri = NULL; + return; + + (void)cb_arg; + (void)fi; +} + void rpc_init() { struct mg_rpc *c = mgos_rpc_get_global(); @@ -297,4 +337,8 @@ void rpc_init() { mg_rpc_add_handler(c, "Timespec.Clear", "{idx: %d}", rpc_timespec_clear_handler, NULL); mg_rpc_add_handler(c, "Timespec.Add", "{idx: %d, spec: %Q}", rpc_timespec_add_handler, NULL); mg_rpc_add_handler(c, "Timespec.Replace", "{idx: %d, spec: %Q}", rpc_timespec_replace_handler, NULL); + mg_rpc_add_handler(c, "FollowSun.Get", "{idx: %d}", rpc_followsun_get_handler, NULL); + mg_rpc_add_handler(c, "FollowSun.Clear", "{idx: %d}", rpc_followsun_clear_handler, NULL); + mg_rpc_add_handler(c, "FollowSun.Set", "{idx: %d, riseoffset: %d, setoffset: %d}", rpc_followsun_set_handler, NULL); + mg_rpc_add_handler(c, "FollowSun.Replace", "{idx: %d, riseoffset: %d, setoffset: %d}", rpc_followsun_replace_handler, NULL); }