unleashed-firmware/firmware/targets/f7/ble_glue/services/serial_service.h
hedger e3e64e5e83
[FL-3267] ble: refactored bt gatt characteristics setup (#2587)
* ble: refactored bt gatt characteristics setup
* ble: naming fixes, small optimizations
* ble: expanded bitfields; fixed pvs warnings
* ble: fixed pvs warnings for real
* ble: using FlipperGattCharacteristicDataPropsFixed for char[] props
* ble: removed flipper_gatt_characteristic_props_const_char
* ble: gatt: naming changes
* ble: gatt: fixed device_info service constant attrs sizes
* ble: gatt: copy descriptors to char instances; reworked hid chars to be callback-based; moved max size getter to callback with NULL data; added comments
* ble: gatt: removed hid_svc_report_data_callback
* ble: hid svc: better double loop idx naming
* ble: hid svc: simplified hid_svc_update_info
* ble: gatt: removed magic values; fixed type for HidSvcGattCharacteristicInfo
* ble: gatt: moved long uuids to separate files

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2023-06-08 18:42:02 +09:00

55 lines
1.1 KiB
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#define SERIAL_SVC_DATA_LEN_MAX (486)
#define SERIAL_SVC_CHAR_VALUE_LEN_MAX (243)
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
SerialServiceRpcStatusNotActive = 0UL,
SerialServiceRpcStatusActive = 1UL,
} SerialServiceRpcStatus;
typedef enum {
SerialServiceEventTypeDataReceived,
SerialServiceEventTypeDataSent,
SerialServiceEventTypesBleResetRequest,
} SerialServiceEventType;
typedef struct {
uint8_t* buffer;
uint16_t size;
} SerialServiceData;
typedef struct {
SerialServiceEventType event;
SerialServiceData data;
} SerialServiceEvent;
typedef uint16_t (*SerialServiceEventCallback)(SerialServiceEvent event, void* context);
void serial_svc_start();
void serial_svc_set_callbacks(
uint16_t buff_size,
SerialServiceEventCallback callback,
void* context);
void serial_svc_set_rpc_status(SerialServiceRpcStatus status);
void serial_svc_notify_buffer_is_empty();
void serial_svc_stop();
bool serial_svc_is_started();
bool serial_svc_update_tx(uint8_t* data, uint16_t data_len);
#ifdef __cplusplus
}
#endif