Flipper Zero Firmware
Loading...
Searching...
No Matches
rpc_app.h
Go to the documentation of this file.
1
13#pragma once
14
15#include "rpc.h"
16#include "rpc_app_error_codes.h"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
31
37typedef struct {
40 union {
41 const char* string;
42 int32_t i32;
43 struct {
44 const uint8_t* ptr;
45 size_t size;
46 } bytes;
47 };
49
101
109
120typedef void (*RpcAppSystemCallback)(const RpcAppSystemEvent* event, void* context);
121
126
135 RpcAppSystem* rpc_app,
136 RpcAppSystemCallback callback,
137 void* context);
138
147
156
172void rpc_system_app_confirm(RpcAppSystem* rpc_app, bool result);
173
183void rpc_system_app_set_error_code(RpcAppSystem* rpc_app, uint32_t error_code);
184
194void rpc_system_app_set_error_text(RpcAppSystem* rpc_app, const char* error_text);
195
204
212void rpc_system_app_exchange_data(RpcAppSystem* rpc_app, const uint8_t* data, size_t data_size);
213
214#ifdef __cplusplus
215}
216#endif
void rpc_system_app_set_error_code(RpcAppSystem *rpc_app, uint32_t error_code)
Set the error code stored in an RpcAppSystem instance.
Definition rpc_app.c:362
void rpc_system_app_set_callback(RpcAppSystem *rpc_app, RpcAppSystemCallback callback, void *context)
Set the callback function for use by an RpcAppSystem instance.
Definition rpc_app.c:355
RpcAppSystemEventDataType
Enumeration of possible event data types.
Definition rpc_app.h:25
@ RpcAppSystemEventDataTypeString
Event data contains a zero-terminated string.
Definition rpc_app.h:27
@ RpcAppSystemEventDataTypeNone
No data is provided by the event.
Definition rpc_app.h:26
@ RpcAppSystemEventDataTypeBytes
Event data contains zero or more bytes.
Definition rpc_app.h:29
@ RpcAppSystemEventDataTypeInt32
Event data contains a signed 32-bit integer.
Definition rpc_app.h:28
void rpc_system_app_send_started(RpcAppSystem *rpc_app)
Send a notification that an RpcAppSystem instance has been started and is ready.
Definition rpc_app.c:316
void rpc_system_app_send_exited(RpcAppSystem *rpc_app)
Send a notification that the application using an RpcAppSystem instance is about to exit.
Definition rpc_app.c:321
RpcAppSystemEventType
Enumeration of possible event types.
Definition rpc_app.h:53
@ RpcAppEventTypeDataExchange
The client has sent a byte array of arbitrary size.
Definition rpc_app.h:99
@ RpcAppEventTypeInvalid
Denotes an invalid state.
Definition rpc_app.h:59
@ RpcAppEventTypeAppExit
The client has requested the application to exit.
Definition rpc_app.h:71
@ RpcAppEventTypeButtonPress
The client has informed the application that a button has been pressed.
Definition rpc_app.h:85
@ RpcAppEventTypeSessionClose
The client side has closed the session.
Definition rpc_app.h:65
@ RpcAppEventTypeLoadFile
The client has requested the application to load a file.
Definition rpc_app.h:78
@ RpcAppEventTypeButtonRelease
The client has informed the application that a button has been released.
Definition rpc_app.h:92
void rpc_system_app_set_error_text(RpcAppSystem *rpc_app, const char *error_text)
Set the error text stored in an RpcAppSystem instance.
Definition rpc_app.c:367
void rpc_system_app_confirm(RpcAppSystem *rpc_app, bool result)
Send a confirmation that the application using an RpcAppSystem instance has handled the event.
Definition rpc_app.c:326
void rpc_system_app_error_reset(RpcAppSystem *rpc_app)
Reset the error code and text stored in an RpcAppSystem instance.
Definition rpc_app.c:377
void rpc_system_app_exchange_data(RpcAppSystem *rpc_app, const uint8_t *data, size_t data_size)
Send a byte array of arbitrary data to the client using an RpcAppSystem instance.
Definition rpc_app.c:384
void(* RpcAppSystemCallback)(const RpcAppSystemEvent *event, void *context)
Callback function type.
Definition rpc_app.h:120
Event data structure, containing the type and associated data.
Definition rpc_app.h:37
RpcAppSystemEventDataType type
Type of the data.
Definition rpc_app.h:39
size_t size
Size of the byte array, in bytes.
Definition rpc_app.h:45
const char * string
Pointer to a zero-terminated character string.
Definition rpc_app.h:41
const uint8_t * ptr
Pointer to the byte array data.
Definition rpc_app.h:44
int32_t i32
Signed 32-bit integer value.
Definition rpc_app.h:42
RPC application subsystem event structure.
Definition rpc_app.h:105
RpcAppSystemEventType type
Type of the event.
Definition rpc_app.h:106
RpcAppSystemEventData data
Data associated with the event.
Definition rpc_app.h:107
Definition rpc_app.c:10