mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-18 08:43:10 +00:00
a5052a0375
Co-authored-by: あく <alleteam@gmail.com>
48 lines
828 B
C
48 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
|