123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430 |
- #ifndef PERIPHERAL_H
- #define PERIPHERAL_H
- #ifdef EXT_ADV_ENABLE
- #include "rflib_LR.h"
- #endif
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- #define GAPROLE_PROFILEROLE 0x300
- #define GAPROLE_IRK 0x301
- #define GAPROLE_SRK 0x302
- #define GAPROLE_SIGNCOUNTER 0x303
- #define GAPROLE_BD_ADDR 0x304
- #define GAPROLE_ADVERT_ENABLED 0x305
- #define GAPROLE_ADVERT_OFF_TIME 0x306
- #define GAPROLE_ADVERT_DATA 0x307
- #define GAPROLE_SCAN_RSP_DATA 0x308
- #define GAPROLE_ADV_EVENT_TYPE 0x309
- #define GAPROLE_ADV_DIRECT_TYPE 0x30A
- #define GAPROLE_ADV_DIRECT_ADDR 0x30B
- #define GAPROLE_ADV_CHANNEL_MAP 0x30C
- #define GAPROLE_ADV_FILTER_POLICY 0x30D
- #define GAPROLE_CONNHANDLE 0x30E
- #define GAPROLE_RSSI_READ_RATE 0x30F
- #define GAPROLE_PARAM_UPDATE_ENABLE 0x310
- #define GAPROLE_MIN_CONN_INTERVAL 0x311
- #define GAPROLE_MAX_CONN_INTERVAL 0x312
- #define GAPROLE_SLAVE_LATENCY 0x313
- #define GAPROLE_TIMEOUT_MULTIPLIER 0x314
- #define GAPROLE_CONN_BD_ADDR 0x315
- #define GAPROLE_CONN_INTERVAL 0x316
- #define GAPROLE_CONN_LATENCY 0x317
- #define GAPROLE_CONN_TIMEOUT 0x318
- #define GAPROLE_PARAM_UPDATE_REQ 0x319
- #define GAPROLE_STATE 0x31A
- #define GAPROLE_CONNECTION_INTERVAL 0x31B
- #define GAPROLE_CONNECTION_LATENCY 0x31C
- #ifdef EXT_ADV_ENABLE
- #define GAPROLE_EXT_ADVERT_ENABLED 0x0320
- #define GAPROLE_EXT_ADVERT_DATA 0x0321
- #define GAPROLE_EXT_SCAN_RSP_DATA 0x0322
- #define GAPROLE_EXT_ADV_EVENT_TYPE 0x0323
- #endif
- typedef enum
- {
- GAPROLE_INIT = 0,
- GAPROLE_STARTED,
- GAPROLE_ADVERTISING,
- GAPROLE_WAITING,
- GAPROLE_WAITING_AFTER_TIMEOUT,
- GAPROLE_CONNECTED,
- GAPROLE_CONNECTED_ADV,
- GAPROLE_ERROR
- } gaprole_States_t;
- #define GAPROLE_NO_ACTION 0
- #define GAPROLE_RESEND_PARAM_UPDATE 1
- #define GAPROLE_TERMINATE_LINK 2
- typedef void (*gapRolesParamUpdateCB_t)( uint16 connInterval,
- uint16 connSlaveLatency,
- uint16 connTimeout );
- typedef void (*gapRolesStateNotify_t)( gaprole_States_t newState );
- typedef void (*gapRolesRssiRead_t)( int8 newRSSI );
- typedef struct
- {
- gapRolesStateNotify_t pfnStateChange;
- gapRolesRssiRead_t pfnRssiRead;
- } gapRolesCBs_t;
- #ifdef EXT_ADV_ENABLE
- typedef unsigned int uintptr_t;
- typedef void (*pfnGapCB_t)
- (
- uint32_t event,
- void *pBuf,
- uintptr_t arg
- );
- typedef enum
- {
- GAP_ADV_DATA_TYPE_ADV,
- GAP_ADV_DATA_TYPE_SCAN_RSP
- } GapAdv_dataTypes_t;
- #endif
- extern bStatus_t GAPRole_SetParameter( uint16 param, uint8 len, void *pValue );
- extern bStatus_t GAPRole_GetParameter( uint16 param, void *pValue );
- #ifdef EXT_ADV_ENABLE
- extern bStatus_t GapRoleAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType,
- uint16 len, uint8 *pBuf);
-
- #endif
- extern bStatus_t GAPRole_StartDevice( gapRolesCBs_t *pAppCallbacks );
- extern bStatus_t GAPRole_TerminateConnection( void );
- extern bStatus_t GAPRole_SendUpdateParam( uint16 minConnInterval, uint16 maxConnInterval,
- uint16 latency, uint16 connTimeout, uint8 handleFailure );
- extern void GAPRole_RegisterAppCBs( gapRolesParamUpdateCB_t *pParamUpdateCB );
- extern void GAPRole_Init( uint8 task_id );
- extern uint16 GAPRole_ProcessEvent( uint8 task_id, uint16 events );
- #ifdef EXT_ADV_ENABLE
- extern bStatus_t GAP_UpdateExtAdvertisingData( uint8 taskID, uint16_t adType,
- uint8 dataLen, uint8 *pAdvertData );
-
- #define AE_NOTIFY_DISABLE_SCAN_REQUEST ~BV(0)
- #define AE_NOTIFY_ENABLE_SCAN_REQUEST BV(0)
- #define AE_NOTIFY
- #define AE_NOTIFY_DISABLE_ADV_SET_START ~BV(4)
- #define AE_NOTIFY_ENABLE_ADV_SET_START BV(4)
- #define AE_NOTIFY_DISABLE_ADV_START ~BV(5)
- #define AE_NOTIFY_ENABLE_ADV_START BV(5)
- #define AE_NOTIFY_DISABLE_ADV_END ~BV(6)
- #define AE_NOTIFY_ENABLE_ADV_END BV(6)
- #define AE_NOTIFY_DISABLE_ADV_SET_END ~BV(7)
- #define AE_NOTIFY_ENABLE_ADV_SET_END BV(7)
- typedef enum
- {
-
- GAP_ADV_EVT_MASK_SCAN_REQ_NOTI = AE_NOTIFY_ENABLE_SCAN_REQUEST,
-
- GAP_ADV_EVT_MASK_SET_TERMINATED = BV(1),
-
- GAP_ADV_EVT_MASK_START_AFTER_ENABLE = AE_NOTIFY_ENABLE_ADV_SET_START,
-
- GAP_ADV_EVT_MASK_START = AE_NOTIFY_ENABLE_ADV_START,
-
- GAP_ADV_EVT_MASK_END = AE_NOTIFY_ENABLE_ADV_END,
-
- GAP_ADV_EVT_MASK_END_AFTER_DISABLE = AE_NOTIFY_ENABLE_ADV_SET_END,
-
- GAP_ADV_EVT_MASK_ALL = GAP_ADV_EVT_MASK_SCAN_REQ_NOTI |
- GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
- GAP_ADV_EVT_MASK_START |
- GAP_ADV_EVT_MASK_END |
- GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
- GAP_ADV_EVT_MASK_SET_TERMINATED,
-
- GAP_ADV_EVT_MASK_RESERVED = BV(15)
- } GapAdv_eventMaskFlags_t;
- typedef enum
- {
-
- GAP_ADV_ENABLE_OPTIONS_USE_MAX,
-
- GAP_ADV_ENABLE_OPTIONS_USE_DURATION,
-
- GAP_ADV_ENABLE_OPTIONS_USE_MAX_EVENTS,
- } GapAdv_enableOptions_t;
-
- extern bStatus_t GapAdv_create(pfnGapCB_t *cb, Gap_ExtAdv_Param *advParam,
- uint8 *advHandle);
- bStatus_t GapAdv_loadByHandle(uint8 handle, GapAdv_dataTypes_t dataType,
- uint16 len, uint8 *pBuf);
- extern bStatus_t GapAdv_setEventMask(uint8 handle, GapAdv_eventMaskFlags_t mask);
- extern bStatus_t GapAdv_enable(uint8 handle,
- GapAdv_enableOptions_t enableOptions,
- uint16 durationOrMaxEvents);
- extern bStatus_t GapAdv_UpdateParameter(uint8 *pBuf);
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|