rpc_status.c 740 B

12345678910111213141516171819202122232425
  1. #include "flipper.pb.h"
  2. #include "rpc_i.h"
  3. #include "status.pb.h"
  4. void rpc_system_status_ping_process(const PB_Main* msg_request, void* context) {
  5. PB_Main msg_response = PB_Main_init_default;
  6. msg_response.has_next = false;
  7. msg_response.command_status = PB_CommandStatus_OK;
  8. msg_response.command_id = msg_request->command_id;
  9. msg_response.which_content = PB_Main_ping_response_tag;
  10. rpc_encode_and_send(context, &msg_response);
  11. }
  12. void* rpc_system_status_alloc(Rpc* rpc) {
  13. RpcHandler rpc_handler = {
  14. .message_handler = rpc_system_status_ping_process,
  15. .decode_submessage = NULL,
  16. .context = rpc,
  17. };
  18. rpc_add_handler(rpc, PB_Main_ping_request_tag, &rpc_handler);
  19. return NULL;
  20. }