rpc_status.c 786 B

1234567891011121314151617181920212223242526
  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_send_and_release(context, &msg_response);
  11. pb_release(&PB_Main_msg, &msg_response);
  12. }
  13. void* rpc_system_status_alloc(Rpc* rpc) {
  14. RpcHandler rpc_handler = {
  15. .message_handler = rpc_system_status_ping_process,
  16. .decode_submessage = NULL,
  17. .context = rpc,
  18. };
  19. rpc_add_handler(rpc, PB_Main_ping_request_tag, &rpc_handler);
  20. return NULL;
  21. }