| Airoha M0 BLE API 1.0.5.4

ble_gap_links.h
1 /******************************************************************************
2 Copyright (c) Airoha 2016 - All rights reserved
3
4 FILE NAME
5 ble_gap_links.h
6 DESCRIPTION
7 NOTES
8 ********************************************************************************/
9 #ifndef __BLE_GAP_LINKS_HH
10 #define __BLE_GAP_LINKS_HH
11 #include <stdint.h>
12 #include <stdbool.h>
13
14 #ifdef _MSC_VER
15 __pragma(pack(push, 1))
16 #define __attribute__(x)
17 #endif
18
19
20 //Do not modify, begin!!
21 /*this structure is use for connect complete event*/
22 typedef struct
23 {
24 uint16_t connHandle;//:12;
25 uint8_t role;
26 uint8_t peerAddrType;
27 uint8_t peerAddr[6];
28 uint8_t connInterval[2];
29 uint8_t connLatency[2];
30 uint8_t supervisionTimeout[2];
31 uint8_t masterClockAccuracy;
32 } __attribute__((packed)) le_link_features;
33 //Do not modify, end!!
34
35 #ifdef _MSC_VER
36 __pragma(pack(pop))
37 #undef __attribute__
38 #endif
39
40 enum
41 {
42 MMI_CONN_STATE_NONE,
43 MMI_CONN_STATE_ACL_CONNECTING,
44 MMI_CONN_STATE_ACL_CONNECTED,
45 };
46
47 #define AUTH_NONE 0x00
48 #define AUTH_OK 0x01
49 #define AUTH_ERROR 0x02
50 #define AUTH_ONGOING 0x03
51
52 #define ENCRYPTED_NONE 0x00
53 #define ENCRYPTED_OK 0x01
54 #define ENCRYPTED_ERROR 0x02
55 #define ENCRYPTED_ONGOING 0x03
56
57
58 #define MAX_REMOTE_NAME_LEN 30
59
60 //add/del
61 void ble_gap_link_Add(uint8_t linkInd, uint8_t state);
62 void ble_gap_link_Del(uint8_t);
63 bool ble_gap_link_Add_Ex(le_link_features *features, ble_addr_type owner, uint8_t ower_addr[6], uint8_t state);
64
65 //condition
66 bool ble_gap_link_Is_ValidAddr(uint8_t * bdAddr);
67 bool ble_gap_link_Is_Active(uint8_t linkIndex);
68 bool ble_gap_link_Is_AnyActive(void);
69
70 //set
71 void ble_gap_link_SetAttr_Auth(uint8_t idx, uint8_t auth);
72 void ble_gap_link_SetAttr_Enc(uint8_t idx, uint8_t enc);
73 void ble_gap_link_SetAttr_State(uint8_t idx, uint8_t state);
74 void ble_gap_link_SetAttr_Role(uint8_t idx, uint8_t isSlave);
75 void ble_gap_link_SetAttr_Handle(uint8_t idx, uint16_t handle);
76 void ble_gap_link_SetAttr_BdAddr(uint8_t idx, uint8_t * addr);
77 void ble_gap_link_SetAttr_BdAddrType(uint8_t linkidx, uint8_t type);
78 void ble_gap_link_SetAttr_Clear(uint8_t idx);
79 void ble_gap_link_SetAttr_Data(uint8_t idx, void* data);
80
81 //get
82 uint8_t * ble_gap_link_GetAttr_RemoteName(uint8_t linkidx);
83 uint8_t ble_gap_link_GetAttr_Auth(uint8_t idx);
84 uint8_t ble_gap_link_GetAttr_Enc(uint8_t idx);
85 uint8_t ble_gap_link_GetActiveMask(void);
86 uint8_t ble_gap_link_GetAttr_State(uint8_t idx);
87 uint8_t * ble_gap_link_GetAttr_BdAddr(uint8_t linkidx);
88 uint8_t ble_gap_link_GetAttr_BdAddrType(uint8_t linkidx);
89 void * ble_gap_link_GetAttr_Data(uint8_t idx);
90 uint8_t ble_gap_link_GetAttr_Role(uint8_t idx);
91 uint16_t ble_gap_link_GetAttr_Handle(uint8_t linkIndex);
92 uint8_t ble_gap_link_GetAttr_OwnerType(uint8_t idx);
93 void ble_gap_link_GetAttr_OwnerAddr(uint8_t idx, uint8_t addr[6]);
94
95
96 //query
97 uint8_t ble_gap_link_GetIdx_ByHandle(uint16_t connHandle);
98 uint8_t ble_gap_link_GetIdx_ByBdAddr(uint8_t * bdAddr);
99 uint8_t ble_gap_link_GetIdx_Empty(void);
100
101
102 #endif
ble_addr_type
ble_addr_type
BLE ddress Type.
Definition: ble_gap.h:449