Loading...
Searching...
No Matches
rpc.h
1#pragma once
2
3#include <stddef.h>
4#include <stdint.h>
5#include <stdbool.h>
6#include <furi.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#define RPC_BUFFER_SIZE (1024)
13
14#define RECORD_RPC "rpc"
15
17typedef struct Rpc Rpc;
19typedef struct RpcSession RpcSession;
20
22typedef void (*RpcSendBytesCallback)(void* context, uint8_t* bytes, size_t bytes_len);
24typedef void (*RpcBufferIsEmptyCallback)(void* context);
28typedef void (*RpcSessionClosedCallback)(void* context);
31typedef void (*RpcSessionTerminatedCallback)(void* context);
32
34typedef enum {
35 RpcOwnerUnknown = 0,
36 RpcOwnerBle,
37 RpcOwnerUsb,
38 RpcOwnerUart,
39 RpcOwnerCount,
40} RpcOwner;
41
47RpcOwner rpc_session_get_owner(RpcSession* session);
48
67RpcSession* rpc_session_open(Rpc* rpc, RpcOwner owner);
68
76void rpc_session_close(RpcSession* session);
77
83void rpc_session_set_context(RpcSession* session, void* context);
84
91void rpc_session_set_send_bytes_callback(RpcSession* session, RpcSendBytesCallback callback);
92
99void rpc_session_set_buffer_is_empty_callback(
100 RpcSession* session,
101 RpcBufferIsEmptyCallback callback);
102
109void rpc_session_set_close_callback(RpcSession* session, RpcSessionClosedCallback callback);
110
116void rpc_session_set_terminated_callback(
117 RpcSession* session,
118 RpcSessionTerminatedCallback callback);
119
129size_t rpc_session_feed(RpcSession* session, const uint8_t* buffer, size_t size, uint32_t timeout);
130
137size_t rpc_session_get_available_size(RpcSession* session);
138
139#ifdef __cplusplus
140}
141#endif
Definition rpc.c:88
Definition rpc.c:67