• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14 
15  * Description: GATT interfaces
16  */
17 
18 #ifndef OHOS_BT_GATT_H
19 #define OHOS_BT_GATT_H
20 
21 #include "ohos_bt_def.h"
22 
23 /* e.g. Legacy SCAN_RSP to an ADV_IND, 0x1B
24    OHOS_BLE_EVT_TYPE_LEGACY_ADV | OHOS_BLE_EVT_TYPE_SCAN_RESPONSE | OHOS_BLE_EVT_TYPE_SCANNABLE_ADV | */
25 
26 #define OHOS_BLE_EVT_TYPE_CONNECTABLE_ADV 0x01 /* bit[0] */
27 #define OHOS_BLE_EVT_TYPE_SCANNABLE_ADV 0x02 /* bit[1] */
28 #define OHOS_BLE_EVT_TYPE_DIRECTED_ADV 0x04 /* bit[2] */
29 #define OHOS_BLE_EVT_TYPE_SCAN_RESPONSE 0x08 /* bit[3] */
30 #define OHOS_BLE_EVT_TYPE_LEGACY_ADV 0x10 /* bit[4] */
31 #define OHOS_BLE_EVT_TYPE_DATA_STATUS_COMPLETE 0x00 /* bit[6:5] , 0b00:Complete */
32 #define OHOS_BLE_EVT_TYPE_DATA_STATUS_INCOMPLETE 0x20 /* bit[6:5], 0b01:Incomplete, more data to come */
33 /* bit[6:5], 0b10:Incomplete,data truncated, no more to come */
34 #define OHOS_BLE_EVT_TYPE_DATA_STATUS_INCOMPLETE_TRUNCATED 0x40
35 
36 typedef enum {
37     OHOS_BLE_ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY = 0x00,
38     OHOS_BLE_ADV_FILTER_ALLOW_SCAN_WLST_CON_ANY = 0x01,
39     OHOS_BLE_ADV_FILTER_ALLOW_SCAN_ANY_CON_WLST = 0x02,
40     OHOS_BLE_ADV_FILTER_ALLOW_SCAN_WLST_CON_WLST = 0x03,
41 } BleAdvFilter;
42 
43 /* BLUETOOTH CORE SPECIFICATION Version 5.2|Vol4,Part E, "HCI_LE_Set_Advertising_Parameters" */
44 typedef enum {
45     OHOS_BLE_ADV_IND = 0x00, /* Connectable and scannable undirected advertising (default) */
46     OHOS_BLE_ADV_DIRECT_IND_HIGH = 0x01, /* Connectable high duty cycle directed advertising */
47     OHOS_BLE_ADV_SCAN_IND = 0x02, /* Scannable undirected advertising */
48     OHOS_BLE_ADV_NONCONN_IND = 0x03, /* Non connectable undirected advertising */
49     OHOS_BLE_ADV_DIRECT_IND_LOW  = 0x04, /* Connectable low duty cycle directed advertising */
50 } BleAdvType;
51 
52 /* Local IO capability, shall be the same value defined in HCI Specification. */
53 typedef enum {
54     OHOS_BLE_IO_CAP_OUT = 0x00, /* DisplayOnly */
55     OHOS_BLE_IO_CAP_IO, /* DisplayYesNo */
56     OHOS_BLE_IO_CAP_IN, /* KeyboardOnly */
57     OHOS_BLE_IO_CAP_NONE, /* NoInputNoOutput */
58     OHOS_BLE_IO_CAP_KBDISP, /* Keyboard display */
59 } BleIoCapMode;
60 
61 typedef enum {
62     OHOS_BLE_AUTH_NO_BOND = 0x00,
63     OHOS_BLE_AUTH_BOND,
64     OHOS_BLE_AUTH_REQ_MITM,
65     OHOS_BLE_AUTH_REQ_SC_ONLY,
66     OHOS_BLE_AUTH_REQ_SC_BOND,
67     OHOS_BLE_AUTH_REQ_SC_MITM,
68     OHOS_BLE_AUTH_REQ_SC_MITM_BOND
69 } BleAuthReqMode;
70 
71 typedef enum {
72     OHOS_BLE_FILTER_ACTION_ADD = 0x00,
73     OHOS_BLE_FILTER_ACTION_DELETE,
74     OHOS_BLE_FILTER_ACTION_CLEAR
75 } BleFilterActionType;
76 
77 typedef enum {
78     OHOS_BLE_ADV_ADDRESS_FILTER_MASK = 0x01,
79     OHOS_BLE_SERVICE_DATA_CHANGE_FILTER_MASK = 0x02,
80     OHOS_BLE_SERVICE_UUID_CHECK_MASK = 0x04,
81     OHOS_BLE_SERVICE_SOLICITATION_UUID_CHECK_MASK = 0x08,
82     OHOS_BLE_LOCAL_NAME_CHECK_MASK = 0x10,
83     OHOS_BLE_MANUFACTURER_DATA_CHECK_MASK = 0x20,
84     OHOS_BLE_SERVICE_DATA_CHECK_MASK = 0x40
85 } BleFilterSelectMask;
86 
87 typedef enum {
88     OHOS_BLE_FILTER_LOGIC_OR = 0x00,
89     OHOS_BLE_FILTER_LOGIC_AND
90 } BleFilterLogicType;
91 
92 typedef enum {
93     OHOS_BLE_FILTER_IMMEDIATE_MODE = 0x00,
94     OHOS_BLE_FILTER_ON_FOUND_MODE,
95     OHOS_BLE_FILTER_BATCHED_MODE
96 } BleFilterDeliveryMode;
97 
98 typedef enum {
99     OHOS_BLE_ADV_ADDRESS_FILTER = 0x00,
100     OHOS_BLE_SERVICE_DATA_CHANGE_FILTER,
101     OHOS_BLE_SERVICE_UUID_CHECK_FILTER,
102     OHOS_BLE_SERVICE_SOLICITATION_UUID_CHECK_FILTER,
103     OHOS_BLE_LOCAL_NAME_CHECK_FILTER,
104     OHOS_BLE_MANUFACTURER_DATA_CHECK_FILTER,
105     OHOS_BLE_SERVICE_DATA_CHECK_FILTER
106 } BleFilterSelectType;
107 
108 typedef enum {
109     OHOS_BLE_FILTER_PUBLIC_ADDR = 0x00,
110     OHOS_BLE_FILTER_RANDOM_ADDR
111 } BleFilterAddrType;
112 
113 /* Ble scan type */
114 typedef enum {
115     OHOS_BLE_SCAN_TYPE_PASSIVE = 0x00, /* Passive Scanning. No scan request PDUs shall be sent. */
116     OHOS_BLE_SCAN_TYPE_ACTIVE, /* Active Scanning. Scan request PDUs may be sent. */
117 } BleScanType;
118 
119 /* Scan filter policy, possible values of BleScanParams::scanFilterPolicy
120    0-Accept all advertisement packets except directed advertising packets not addressed to this device (default);
121    1-Accept only advertisement packets from devices where the advertiser's address is in the White list.
122    Directed advertising packets which are not addressed for this device shall be ignored;
123    2-Accept all undirected advertisement packets, and all directed advertising packets where the initiator address
124    is a resolvable private address, and all directed advertising packets addressed to this device;
125    3-Accept all undirected advertisement packets from devices where the advertiser's address is in the White list,
126    and all directed advertising packets where the initiator address is a resolvable private address, and all
127    directed advertising packets addressed to this device. */
128 typedef enum {
129     OHOS_BLE_SCAN_FILTER_POLICY_ACCEPT_ALL = 0x00,
130     OHOS_BLE_SCAN_FILTER_POLICY_ONLY_WHITE_LIST,
131     OHOS_BLE_SCAN_FILTER_POLICY_ACCEPT_ALL_AND_RPA,
132     OHOS_BLE_SCAN_FILTER_POLICY_ONLY_WHITE_LIST_AND_RPA
133 } BleScanFilterPolicy;
134 
135 /* Extended Advertising Event Type, possible values of BtScanResultData::eventType */
136 typedef enum {
137     OHOS_BLE_EVT_NON_CONNECTABLE_NON_SCANNABLE = 0x00, /* Extended Non-Connectable and Non-Scannable undirected */
138     OHOS_BLE_EVT_NON_CONNECTABLE_NON_SCANNABLE_DIRECTED = 0x04, /* Extended NonConnectable and NonScannable directed */
139     OHOS_BLE_EVT_CONNECTABLE = 0x01, /* Extended Connectable undirected */
140     OHOS_BLE_EVT_CONNECTABLE_DIRECTED = 0x05, /* Extended Connectable directed */
141     OHOS_BLE_EVT_SCANNABLE = 0x02, /* Extended Scannable undirected */
142     OHOS_BLE_EVT_SCANNABLE_DIRECTED = 0x06, /* Extended Scannable directed */
143 
144     OHOS_BLE_EVT_LEGACY_NON_CONNECTABLE = 0x10, /* Legacy Non-Connectable undirected, ADV_NONCONN_IND */
145     OHOS_BLE_EVT_LEGACY_SCANNABLE = 0x12, /* Legacy Scannable undirected, ADV_SCAN_IND */
146     OHOS_BLE_EVT_LEGACY_CONNECTABLE = 0x13, /* Legacy Connectable & Scannable undirected, ADV_IND */
147     OHOS_BLE_EVT_LEGACY_CONNECTABLE_DIRECTED = 0x15, /* Legacy Connectable directed, ADV_DIRECT_IND */
148     OHOS_BLE_EVT_LEGACY_SCAN_RSP_TO_ADV_SCAN = 0x1A, /* Legacy SCAN_RSP to an ADV_SCAN_IND */
149     OHOS_BLE_EVT_LEGACY_SCAN_RSP_TO_ADV = 0x1B, /* Legacy SCAN_RSP to an ADV_IND */
150 } BleScanResultEvtType;
151 
152 /* Extended Advertising Data Status, possible values of BtScanResultData::dataStatus */
153 typedef enum {
154     OHOS_BLE_DATA_COMPLETE = 0x00, /* Complete data or final trunck */
155     OHOS_BLE_DATA_INCOMPLETE_MORE_TO_COME = 0x01, /* Incomplete data, more data to come */
156     OHOS_BLE_DATA_INCOMPLETE_TRUNCATED = 0x02, /* Incomplete data, truncated, no more data to come */
157 } BleScanResultDataStatus;
158 
159 /* Addr type of scan result, possible values of BtScanResultData::addrType */
160 typedef enum {
161     OHOS_BLE_PUBLIC_DEVICE_ADDRESS = 0x00, /* Public Device Address */
162     OHOS_BLE_RANDOM_DEVICE_ADDRESS = 0x01, /* Random Device Address */
163     OHOS_BLE_PUBLIC_IDENTITY_ADDRESS = 0x02, /* Public Identity Address (corresponds to Resolved Private Address) */
164     /* Random (static) Identity Address (corresponds to Resolved Private Address) */
165     OHOS_BLE_RANDOM_STATIC_IDENTITY_ADDRESS = 0x03,
166     OHOS_BLE_UNRESOLVABLE_RANDOM_DEVICE_ADDRESS = 0xFE,
167     OHOS_BLE_NO_ADDRESS = 0xFF, /* No address provided (anonymous advertisement) */
168 } BleScanResultAddrType;
169 
170 /**
171  * @brief BLE扫描结果PHY类型
172  *
173  * @since 3
174  */
175 typedef enum {
176     /** 无广播包 */
177     OHOS_BLE_SCAN_PHY_NO_PACKET = 0x00,
178     /** 1M PHY */
179     OHOS_BLE_SCAN_PHY_1M = 0x01,
180     /** 2M PHY */
181     OHOS_BLE_SCAN_PHY_2M = 0x02,
182     /** Coded PHY */
183     OHOS_BLE_SCAN_PHY_CODED = 0x03
184 } BleScanResultPhyType;
185 
186 /**
187  * @brief 设置BLE广播/扫描响应数据
188  *
189  * @since 3
190  */
191 typedef struct {
192     unsigned short advLength;
193     char *advData; /* advertising data */
194     unsigned short scanRspLength;
195     char *scanRspData; /* scan response data */
196 } BleConfigAdvData;
197 
198 typedef struct {
199     /* Minimum advertising interval for undirected and low duty cycle directed advertising. [N * 0.625ms] */
200     int minInterval;
201     /* Maximum advertising interval for undirected and low duty cycle directed advertising. [N * 0.625ms] */
202     int maxInterval;
203     BleAdvType advType;
204     unsigned char ownAddrType; /* Ref. Core spec Version 5.2|Vol 4,Part E, HCI_LE_Set_Advertising_Parameters */
205     unsigned char peerAddrType; /* Ref. Core spec Version 5.2|Vol 4,Part E, HCI_LE_Set_Advertising_Parameters */
206     BdAddr peerAddr;
207     int channelMap; /* channel used bit map, bit[0:2]->[37,38,39]. e.g. 0x01-only 37 used, 0x07-all used */
208     BleAdvFilter advFilterPolicy;
209     int txPower; /* dbm */
210     int duration; /* duration for sending BLE ADV. [N * 10 ms] */
211 } BleAdvParams;
212 
213 /* used to add or delete a filter specification or clear a filter list for onchip filtering */
214 typedef struct {
215     unsigned char clientId; /* APP identifier */
216     unsigned char action; /* BleFilterActionType, [0->add,1->delte,2->clear] */
217     unsigned char filtIndex; /* Filter index 0 ~ max_filter */
218     unsigned int featureSelection; /* BleFilterSelectMask, Bit masks for the selected features */
219     unsigned int listLogicType; /* BleFilterLogicType, Logic operation for each feature selected in featureSelection */
220     unsigned char filtLogicType; /* BleFilterLogicType */
221     unsigned char rssiHighThres; /* [In dBm] ignore the advertiser if the signal is lower than rssiHighThres */
222     unsigned char rssiLowThres; /* Valid only if delivery_mode is on_found [in dBm] */
223     unsigned char deliveryMode; /* BleFilterDeliveryMode */
224     /* Time for firmware to linger and collect additional advertisements before reporting.
225        (Valid only if deliveryMode is on_found)[in milliseconds] */
226     unsigned int onFoundTimeout;
227     /* If an advertisement, after being found, is not seen contiguously for the lost_timeout period,
228        it will be reported lost. (Valid only if deliveryMode is on_found)[in milliseconds] */
229     unsigned int onLostTimeout;
230     /* If an advertisement in onFound lingers in firmware for the onfound_timeout duration,
231        it will collect a few advertisements and the count is checked. If the count exceeds onFoundTimeoutCnt,
232        it's reported OnFound, immediately thereafter. Valid only if deliveryMode is on_found [count] */
233     unsigned char onFoundTimeoutCnt;
234     /* Total number of advertisers to track per filter. Valid only if delivery_mode is on_found [count] */
235     unsigned int numOfTrackingEntries;
236 } BleAdvScanFilterParam;
237 
238 typedef struct {
239     unsigned char clientId; /* APP identifier */
240     unsigned char action; /* BleFilterActionType, [0->add, 1->delte, 2->clear] */
241     unsigned char filtType; /* BleFilterSelectType */
242     unsigned char filtIndex; /* filter index */
243     int manufacturerId; /* manufacturer id  */
244     int manufacturerIdMask; /* the mask of manufacturer id */
245     BtUuid *uuid; /* uuid, 128bit */
246     BtUuid *uuidMask; /* mask of 128bit uuid */
247     BdAddr *bdAddr; /* address, e.g. "AA:BB:CC:DD:EE:FF" */
248     unsigned char addrType; /* BleFilterAddrType, [0->public, 1->random] */
249     unsigned int dataLen; /* length of value */
250     char *data; /* value */
251     unsigned int maskLen; /* length of mask */
252     char mask; /* mask */
253 } BleAdvScanFilterCondition;
254 
255 /* BLE scan parameter */
256 typedef struct {
257     /* Time interval from when the Controller started its last scan until it begins the subsequent scan.
258        [N=0xXX] Time = N * 0.625 ms */
259     unsigned short scanInterval;
260     /* Duration of the scan on the primary advertising physical channel. [N=0xXX] Time = N * 0.625 ms */
261     unsigned short scanWindow;
262     unsigned char scanType; /* one of BleScanType, [0->Passive, 1->Active] */
263     unsigned char scanPhy; /* [0->LE 1M phy, 1->LE 2M phy, 2->LE Coded phy] */
264     unsigned char scanFilterPolicy; /* one of BleScanFilterPolicy */
265 } BleScanParams;
266 
267 typedef struct {
268     unsigned char *advData;
269     unsigned int advDataLen;
270     unsigned char *rspData;
271     unsigned int rspDataLen;
272 } StartAdvRawData;
273 
274 typedef struct {
275     unsigned char eventType; /* Advertising event type, one of BleScanResultEvtType */
276     unsigned char dataStatus; /* Data status, one of BleScanResultDataStatus */
277     unsigned char addrType; /* one of BleScanResultAddrType, except 0xFE */
278     BdAddr addr;
279     unsigned char primaryPhy; /* 0x01->LE 1M phy, 0x03->LE Coded phy */
280     unsigned char secondaryPhy; /* 0x00->No packets, 0x01->LE 1M phy, 0x02->LE 2M phy, 0x03->LE Coded phy */
281     /* Value of the Advertising SID subfield in the ADI field of the PDU or, for scan responses,
282        in the ADI field of the original scannable advertisement, 0xFF->No ADI field provided */
283     unsigned char advSid;
284     char txPower; /* Range: -127 to +20dBm, 0x7F->Tx Power information not available */
285     char rssi; /* Range: -127 to +20dBm, 0x7F->RSSI is not available */
286     /* Interval of the periodic advertising, Time = N * 1.25 ms, 0x0000->No periodic advertising */
287     unsigned short periodicAdvInterval;
288     unsigned char directAddrType; /* one of BleScanResultAddrType, except 0xFF */
289     BdAddr directAddr; /* TargetA address for directed advertising event only */
290     unsigned char advLen;
291     unsigned char *advData;
292 } BtScanResultData;
293 
294 /* Callback invoked when start adv operation has completed */
295 typedef void (*AdvEnableCallback)(int advId, int status);
296 
297 /* Callback invoked when stop adv operation has completed */
298 typedef void (*AdvDisableCallback)(int advId, int status);
299 
300 /* Callback invoked when adv instance data set operation has completed */
301 typedef void (*AdvDataCallback)(int advId, int status);
302 
303 /* Callback invoked when adv param update operation has completed */
304 typedef void (*AdvUpdateCallback)(int advId, int status);
305 
306 /* Callback invoked when security response operation has completed */
307 typedef void (*SecurityRespondCallback)(const BdAddr *bdAddr);
308 
309 /* Callback for scan results */
310 typedef void (*ScanResultCallback)(BtScanResultData *scanResultdata);
311 
312 /* Callback invoked when a scan filter enable/disable has completed */
313 typedef void (*ScanFilterStatusCallback)(int enable, int clientId, int status);
314 
315 /* Callback invoked when a scan filter configuration command has completed */
316 typedef void (*ScanFilterCfgCallback)(int action, int clientId, int status, int filtType, int avblSpace);
317 
318 /* Callback invoked when a scan filter param setup has completed */
319 typedef void (*ScanFilterParamCallback)(int action, int clientId, int status, int avblSpace);
320 
321 /* Callback invoked when scan parameter set has completed */
322 typedef void (*ScanParameterSetCompletedCallback)(int clientId, int status);
323 
324 typedef struct {
325     AdvEnableCallback advEnableCb; /* start adv */
326     AdvDisableCallback advDisableCb; /* stop adv */
327     AdvDataCallback advDataCb;
328     AdvUpdateCallback advUpdateCb; /* update adv */
329     SecurityRespondCallback securityRespondCb;
330     ScanResultCallback scanResultCb;
331     ScanFilterCfgCallback scanFilterCfgCb;
332     ScanFilterParamCallback scanFilterParamCb;
333     ScanFilterStatusCallback scanFilterStatusCb;
334     ScanParameterSetCompletedCallback scanParamSetCb;
335 } BtGattCallbacks;
336 
337 /*
338  * @brief Initialize the Bluetooth protocol stack
339  * @param[in] void
340  * @return 0-success, other-fail
341  */
342 int InitBtStack(void);
343 
344 /*
345  * @brief Bluetooth protocol stack enable
346  * @param[in] void
347  * @return 0-success, other-fail
348  */
349 int EnableBtStack(void);
350 
351 /*
352  * @brief Bluetooth protocol stack disable
353  * @param[in] void
354  * @return 0-success, other-fail
355  */
356 int DisableBtStack(void);
357 
358 /*
359  * @brief set this device's name for friendly
360  * @param[in] <name> device name
361  * @param[in] <len> length
362  * @return 0-success, other-fail
363  */
364 int SetDeviceName(const char *name, unsigned int len);
365 
366 /*
367  * @brief set advertising data
368  * @param[in] <advId> specified by upper layer
369  * @param[in] <data> adv data or scan response
370  * @return 0-success, other-fail
371  */
372 int BleSetAdvData(int advId, const BleConfigAdvData *data);
373 
374 /*
375  * @brief start ble advertising
376  * @param[in] <advId> specified by upper layer
377  * @param[in] <param> ble advertising param list
378  * @return 0-success, other-fail
379  */
380 int BleStartAdv(int advId, const BleAdvParams *param);
381 
382 /*
383  * @brief stop ble advertising
384  * @param[in] <advId> specified by upper layer
385  * @return 0-success, other-fail
386  */
387 int BleStopAdv(int advId);
388 
389 /*
390  * @Update the parameters as per spec, user manual specified values and restart multi ADV
391  * @param[in] <advId> specified by upper layer
392  * @param[in] <param> ble advertising param list
393  * @return 0-success, other-fail
394  */
395 int BleUpdateAdv(int advId, const BleAdvParams *param);
396 
397 /*
398  * @brief set security IO capability
399  * @param[in] <mode> BleIoCapMode
400  * @return 0-success, other-fail
401  */
402 int BleSetSecurityIoCap(BleIoCapMode mode);
403 
404 /*
405  * @brief set security authority
406  * @param[in] <mode> BleAuthReqMode
407  * @return 0-success, other-fail
408  */
409 int BleSetSecurityAuthReq(BleAuthReqMode mode);
410 
411 /*
412  * @brief The device accept or reject the connection initiator.
413  * @param[in] <bdAddr> initiator's address
414  * @param[in] <accept> 0-reject, 1-accept
415  * @return 0-success, other-fail
416  */
417 int BleGattSecurityRsp(BdAddr bdAddr, bool accept);
418 
419 /*
420  * @brief read bt mac address
421  * @param[in] <mac> mac addr
422  * @param[in] <len> addr length
423  * @return 0-success, other-fail
424  */
425 int ReadBtMacAddr(unsigned char *mac, unsigned int len);
426 
427 /*
428  * @brief Setup scan filter params
429  * @param[in] <param> BleAdvScanFilterParam
430  * @return 0-success, other-fail
431  */
432 int BleScanFilterParamSetup(BleAdvScanFilterParam *param);
433 
434 /*
435  * @brief Configure a scan filter condition
436  * @param[in] <param> BleAdvScanFilterCondition
437  * @return 0-success, other-fail
438  */
439 int BleScanFilterAddRemove(BleAdvScanFilterCondition *param);
440 
441 /*
442  * @brief Clear all scan filter conditions for specific filter index
443  * @param[in] <clientId> client Id
444  * @param[in] <filterIndex> filter index
445  * @return 0-success, other-fail
446  */
447 int BleScanFilterClear(int clientId, int filterIndex);
448 
449 /*
450  * @brief Enable / disable scan filter feature
451  * @param[in] <clientId> client Id
452  * @param[in] <enable> 0-disable, 1-enable
453  * @return 0-success, other-fail
454  */
455 int BleScanFilterEnable(int clientId, bool enable);
456 
457 /*
458  * @brief Set BLE scan parameters
459  * @param[in] <clientId> client Id
460  * @param[in] <param> BleScanParams, include scanInterval,scanWindow and so on.
461  * @return 0-success, other-fail
462  */
463 int BleSetScanParameters(int clientId, BleScanParams *param);
464 
465 /*
466  * @brief Start Ble scan
467  * @return 0-success, other-fail
468  */
469 int BleStartScan(void);
470 
471 /*
472  * @brief Stop Ble scan
473  * @return 0-success, other-fail
474  */
475 int BleStopScan(void);
476 
477 /*
478  * @brief Callback invoked for gatt common function
479  * @param[in] <BtGattCallbacks> Callback funcs
480  * @return 0-success, other-fail
481  */
482 int BleGattRegisterCallbacks(BtGattCallbacks *func);
483 
484 /*
485  * @brief Start advertising include set adv data.
486  * This API will not described in the development manual, only for Hilink.
487  * @return 0-success, other-fail
488  */
489 int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advParam);
490 #endif
491