rpc_i.h 847 B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include "rpc.h"
  3. #include "pb.h"
  4. #include "pb_decode.h"
  5. #include "pb_encode.h"
  6. #include "flipper.pb.h"
  7. typedef void* (*RpcSystemAlloc)(Rpc*);
  8. typedef void (*RpcSystemFree)(void*);
  9. typedef void (*PBMessageHandler)(const PB_Main* msg_request, void* context);
  10. typedef struct {
  11. bool (*decode_submessage)(pb_istream_t* stream, const pb_field_t* field, void** arg);
  12. PBMessageHandler message_handler;
  13. void* context;
  14. } RpcHandler;
  15. void rpc_encode_and_send(Rpc* rpc, PB_Main* main_message);
  16. void rpc_encode_and_send_empty(Rpc* rpc, uint32_t command_id, PB_CommandStatus status);
  17. void rpc_add_handler(Rpc* rpc, pb_size_t message_tag, RpcHandler* handler);
  18. void* rpc_system_status_alloc(Rpc* rpc);
  19. void* rpc_system_storage_alloc(Rpc* rpc);
  20. void rpc_system_storage_free(void* ctx);
  21. void rpc_print_message(const PB_Main* message);