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
17#ifdef __cplusplus
18extern "C" {
19#endif
20
30
36typedef struct {
39 union {
40 const char* string;
41 int32_t i32;
42 struct {
43 const uint8_t* ptr;
44 size_t size;
45 } bytes;
46 };
48
100
108
119typedef void (*RpcAppSystemCallback)(const RpcAppSystemEvent* event, void* context);
120
125
134 RpcAppSystem* rpc_app,
135 RpcAppSystemCallback callback,
136 void* context);
137
146
155
171void rpc_system_app_confirm(RpcAppSystem* rpc_app, bool result);
172
182void rpc_system_app_set_error_code(RpcAppSystem* rpc_app, uint32_t error_code);
183
193void rpc_system_app_set_error_text(RpcAppSystem* rpc_app, const char* error_text);
194
203
211void rpc_system_app_exchange_data(RpcAppSystem* rpc_app, const uint8_t* data, size_t data_size);
212
213#ifdef __cplusplus
214}
215#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:24
@ RpcAppSystemEventDataTypeString
Event data contains a zero-terminated string.
Definition rpc_app.h:26
@ RpcAppSystemEventDataTypeNone
No data is provided by the event.
Definition rpc_app.h:25
@ RpcAppSystemEventDataTypeBytes
Event data contains zero or more bytes.
Definition rpc_app.h:28
@ RpcAppSystemEventDataTypeInt32
Event data contains a signed 32-bit integer.
Definition rpc_app.h:27
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:52
@ RpcAppEventTypeDataExchange
The client has sent a byte array of arbitrary size.
Definition rpc_app.h:98
@ RpcAppEventTypeInvalid
Denotes an invalid state.
Definition rpc_app.h:58
@ RpcAppEventTypeAppExit
The client has requested the application to exit.
Definition rpc_app.h:70
@ RpcAppEventTypeButtonPress
The client has informed the application that a button has been pressed.
Definition rpc_app.h:84
@ RpcAppEventTypeSessionClose
The client side has closed the session.
Definition rpc_app.h:64
@ RpcAppEventTypeLoadFile
The client has requested the application to load a file.
Definition rpc_app.h:77
@ RpcAppEventTypeButtonRelease
The client has informed the application that a button has been released.
Definition rpc_app.h:91
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:119
Event data structure, containing the type and associated data.
Definition rpc_app.h:36
RpcAppSystemEventDataType type
Type of the data.
Definition rpc_app.h:38
size_t size
Size of the byte array, in bytes.
Definition rpc_app.h:44
const char * string
Pointer to a zero-terminated character string.
Definition rpc_app.h:40
const uint8_t * ptr
Pointer to the byte array data.
Definition rpc_app.h:43
int32_t i32
Signed 32-bit integer value.
Definition rpc_app.h:41
RPC application subsystem event structure.
Definition rpc_app.h:104
RpcAppSystemEventType type
Type of the event.
Definition rpc_app.h:105
RpcAppSystemEventData data
Data associated with the event.
Definition rpc_app.h:106
Definition rpc_app.c:10