flipperzero-firmware/firmware/targets/f7/ble-glue/gap.h
gornekich a5052a0375
[FL-2053] BLE MTU processing #830
Co-authored-by: あく <alleteam@gmail.com>
2021-11-21 17:47:54 +03:00

49 lines
828 B
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
BleEventTypeConnected,
BleEventTypeDisconnected,
BleEventTypeStartAdvertising,
BleEventTypeStopAdvertising,
BleEventTypePinCodeShow,
BleEventTypeUpdateMTU,
} BleEventType;
typedef union {
uint32_t pin_code;
uint16_t max_packet_size;
} BleEventData;
typedef struct {
BleEventType type;
BleEventData data;
} BleEvent;
typedef void(*BleEventCallback) (BleEvent event, void* context);
typedef enum {
GapStateIdle,
GapStateAdvFast,
GapStateAdvLowPower,
GapStateConnected,
} GapState;
bool gap_init(BleEventCallback on_event_cb, void* context);
void gap_start_advertising();
void gap_stop_advertising();
GapState gap_get_state();
#ifdef __cplusplus
}
#endif