forked from dsouzahansenfrancis/STBTLE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bluenrg_gap_aci.h
1286 lines (1225 loc) · 66.5 KB
/
bluenrg_gap_aci.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
* File Name : bluenrg_gap_aci.h
* Author : AMS - AAS
* Version : V1.0.0
* Date : 26-Jun-2014
* Description : Header file with GAP commands for BlueNRG FW6.3.
********************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
#ifndef __BLUENRG_GAP_ACI_H__
#define __BLUENRG_GAP_ACI_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
*@addtogroup GAP GAP
*@brief GAP layer.
*@{
*/
/**
*@defgroup GAP_Functions GAP functions
*@brief API for GAP layer.
*@{
*/
#ifdef BLUENRG_MS
///@cond BLUENRG_MS
/**
* @brief Initialize the GAP layer.
* @note Register the GAP service with the GATT.
* All the standard GAP characteristics will also be added:
* @li Device Name
* @li Appearance
* @li Peripheral Preferred Connection Parameters (peripheral role only)
* @code
tBleStatus ret;
uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
ret = aci_gap_init(1, 0, 0x07, &service_handle, &dev_name_char_handle, &appearance_char_handle);
if(ret){
PRINTF("GAP_Init failed.\n");
reboot();
}
const char *name = "BlueNRG";
ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, strlen(name), (uint8_t *)name);
if(ret){
PRINTF("aci_gatt_update_char_value failed.\n");
}
* @endcode
* @param role Bitmap of allowed roles: see @ref gap_roles "GAP roles".
* @param privacy_enabled Enable (1) or disable (0) privacy.
* @param device_name_char_len Length of the device name characteristic
* @param[out] service_handle Handle of the GAP service.
* @param[out] dev_name_char_handle Device Name Characteristic handle
* @param[out] appearance_char_handle Appearance Characteristic handle
* @retval tBleStatus Value indicating success or error code.
*/
tBleStatus aci_gap_init(uint8_t role, uint8_t privacy_enabled,
uint8_t device_name_char_len,
uint16_t* service_handle,
uint16_t* dev_name_char_handle,
uint16_t* appearance_char_handle);
///@endcond
#else
///@cond BLUENRG
/**
* @brief Initialize the GAP layer.
* @note Register the GAP service with the GATT.
* All the standard GAP characteristics will also be added:
* @li Device Name
* @li Appearance
* @li Peripheral Privacy Flag (peripheral role only)
* @li Reconnection Address (peripheral role only)
* @li Peripheral Preferred Connection Parameters (peripheral role only)
* @code
tBleStatus ret;
uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
ret = aci_gap_init(1, &service_handle, &dev_name_char_handle, &appearance_char_handle);
if(ret){
PRINTF("GAP_Init failed.\n");
reboot();
}
const char *name = "BlueNRG";
ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, strlen(name), (uint8_t *)name);
if(ret){
PRINTF("aci_gatt_update_char_value failed.\n");
}
* @endcode
* @param role One of the allowed roles: @ref GAP_PERIPHERAL_ROLE or @ref GAP_CENTRAL_ROLE. See @ref gap_roles "GAP roles".
* @param[out] service_handle Handle of the GAP service.
* @param[out] dev_name_char_handle Device Name Characteristic handle
* @param[out] appearance_char_handle Appearance Characteristic handle
* @retval tBleStatus Value indicating success or error code.
*/
tBleStatus aci_gap_init(uint8_t role,
uint16_t* service_handle,
uint16_t* dev_name_char_handle,
uint16_t* appearance_char_handle);
///@endcond
#endif
/**
* @brief Set the Device in non-discoverable mode.
* @note This command will disable the LL advertising.
* @retval tBleStatus Value indicating success or error code.
*/
tBleStatus aci_gap_set_non_discoverable(void);
/**
* @brief Put the device in limited discoverable mode
* (as defined in GAP specification volume 3, section 9.2.3).
* @note The device will be discoverable for TGAP (lim_adv_timeout) = 180 seconds.
* The advertising can be disabled at any time by issuing
* aci_gap_set_non_discoverable() command.
* The AdvIntervMin and AdvIntervMax parameters are optional. If both
* are set to 0, the GAP will use default values (250 ms and 500 ms respectively).
* Host can set the Local Name, a Service UUID list and the Slave Connection
* Minimum and Maximum. If provided, these data will be inserted into the
* advertising packet payload as AD data. These parameters are optional
* in this command. These values can be also set using aci_gap_update_adv_data()
* separately.
* The total size of data in advertising packet cannot exceed 31 bytes.
* With this command, the BLE Stack will also add automatically the following
* standard AD types:
* @li AD Flags
* @li TX Power Level
*
* When advertising timeout happens (i.e. limited discovery period has elapsed), controller generates
* @ref EVT_BLUE_GAP_LIMITED_DISCOVERABLE event.
*
* Example:
* @code
*
* #define ADV_INTERVAL_MIN_MS 100
* #define ADV_INTERVAL_MAX_MS 200
*
* tBleStatus ret;
*
* const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
* const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
*
* ret = aci_gap_set_limited_discoverable(ADV_IND, (ADV_INTERVAL_MIN_MS*1000)/0.625,
* (ADV_INTERVAL_MAX_MS*1000)/0.625,
* STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
* sizeof(local_name), local_name,
* sizeof(serviceUUIDList), serviceUUIDList,
* 0, 0);
* @endcode
*
* @param AdvType One of the advertising types:
* @arg @ref ADV_IND Connectable undirected advertising
* @arg @ref ADV_SCAN_IND Scannable undirected advertising
* @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
* @param AdvIntervMin Minimum advertising interval.
* Range: 0x0020 to 0x4000
* Default: 250 ms
* Time = N * 0.625 msec
* Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
* @param AdvIntervMax Maximum advertising interval.
* Range: 0x0020 to 0x4000
* Default: 500 ms
* Time = N * 0.625 msec
* Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
* @param OwnAddrType Type of our address used during advertising
* (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
* @param AdvFilterPolicy Filter policy:
* @arg NO_WHITE_LIST_USE
* @arg WHITE_LIST_FOR_ONLY_SCAN
* @arg WHITE_LIST_FOR_ONLY_CONN
* @arg WHITE_LIST_FOR_ALL
* @param LocalNameLen Length of LocalName array.
* @param LocalName Array containing the Local Name AD data. First byte is the AD type:
* @ref AD_TYPE_SHORTENED_LOCAL_NAME or @ref AD_TYPE_COMPLETE_LOCAL_NAME.
* @param ServiceUUIDLen Length of ServiceUUIDList array.
* @param ServiceUUIDList This is the list of the UUIDs AD Types as defined in Volume 3,
* Section 11.1.1 of GAP Specification. First byte is the AD Type.
* @arg @ref AD_TYPE_16_BIT_SERV_UUID
* @arg @ref AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST
* @arg @ref AD_TYPE_128_BIT_SERV_UUID
* @arg @ref AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST
* @param SlaveConnIntervMin Slave connection interval minimum value suggested by Peripheral.
* If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
* Slave Connection Interval Range AD structure will be added in advertising
* data.
* Connection interval is defined in the following manner:
* connIntervalmin = Slave_Conn_Interval_Min x 1.25ms
* Slave_Conn_Interval_Min range: 0x0006 to 0x0C80
* Value of 0xFFFF indicates no specific minimum.
* @param SlaveConnIntervMax Slave connection interval maximum value suggested by Peripheral.
* If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
* Slave Connection Interval Range AD structure will be added in advertising
* data.
* ConnIntervalmax = Slave_Conn_Interval_Max x 1.25ms
* Slave_Conn_Interval_Max range: 0x0006 to 0x0C80
* Slave_ Conn_Interval_Max shall be equal to or greater than the Slave_Conn_Interval_Min.
* Value of 0xFFFF indicates no specific maximum.
*
* @retval tBleStatus Value indicating success or error code.
*/
tBleStatus aci_gap_set_limited_discoverable(uint8_t AdvType, uint16_t AdvIntervMin, uint16_t AdvIntervMax,
uint8_t OwnAddrType, uint8_t AdvFilterPolicy, uint8_t LocalNameLen,
const char *LocalName, uint8_t ServiceUUIDLen, uint8_t* ServiceUUIDList,
uint16_t SlaveConnIntervMin, uint16_t SlaveConnIntervMax);
/**
* @brief Put the Device in general discoverable mode (as defined in GAP specification volume 3, section 9.2.4).
* @note The device will be discoverable until the Host issue Bluehci_Gap_Set_Non_Discoverable command.
* The Adv_Interval_Min and Adv_Interval_Max parameters are optional. If both are set to 0, the GAP uses
* the default values for advertising intervals\n:
* @cond BLUENRG
* @li Adv_Interval_Min = 1.28 s
* @li Adv_Interval_Max = 2.56 s
* @endcond
* @cond BLUENRG_MS
* When using connectable undirected advertising events:\n
* @li Adv_Interval_Min = 30 ms
* @li Adv_Interval_Max = 60 ms
* When using non-connectable advertising events or scannable undirected advertising events:\n
* @li Adv_Interval_Min = 100 ms
* @li Adv_Interval_Max = 150 ms
* @endcond
* Host can set the Local Name, a Service UUID list and the Slave Connection Interval Range. If provided,
* these data will be inserted into the advertising packet payload as AD data. These parameters are optional
* in this command. These values can be also set using aci_gap_update_adv_data() separately.
* The total size of data in advertising packet cannot exceed 31 bytes.
* With this command, the BLE Stack will also add automatically the following standard AD types:
* @li AD Flags
* @li TX Power Level
*
* Usage example:
*
* @code
*
* #define ADV_INTERVAL_MIN_MS 800
* #define ADV_INTERVAL_MAX_MS 900
* #define CONN_INTERVAL_MIN_MS 100
* #define CONN_INTERVAL_MAX_MS 300
*
* tBleStatus ret;
*
* const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
* const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
*
* ret = aci_gap_set_discoverable(ADV_IND, (ADV_INTERVAL_MIN_MS*1000)/625,
* (ADV_INTERVAL_MAX_MS*1000)/625,
* STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
* sizeof(local_name), local_name,
* 0, NULL,
* (CONN_INTERVAL_MIN_MS*1000)/1250,
* (CONN_INTERVAL_MAX_MS*1000)/1250);
* @endcode
*
* @param AdvType One of the advertising types:
* @arg @ref ADV_IND Connectable undirected advertising
* @arg @ref ADV_SCAN_IND Scannable undirected advertising
* @arg @ref ADV_NONCONN_IND Non connectable undirected advertising
* @param AdvIntervMin Minimum advertising interval.
* Range: 0x0020 to 0x4000
* Default: 1.28 s
* Time = N * 0.625 msec
* Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
* @param AdvIntervMax Maximum advertising interval.
* Range: 0x0020 to 0x4000
* Default: 2.56 s
* Time = N * 0.625 msec
* Time Range: 20 ms to 10.24 sec (minimum 100 ms for ADV_SCAN_IND or ADV_NONCONN_IND).
* @param OwnAddrType Type of our address used during advertising
* (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
* @param AdvFilterPolicy Filter policy:
* @arg @ref NO_WHITE_LIST_USE
* @arg @ref WHITE_LIST_FOR_ONLY_SCAN
* @arg @ref WHITE_LIST_FOR_ONLY_CONN
* @arg @ref WHITE_LIST_FOR_ALL
* @param LocalNameLen Length of LocalName array.
* @param LocalName Array containing the Local Name AD data. First byte is the AD type:
* @ref AD_TYPE_SHORTENED_LOCAL_NAME or @ref AD_TYPE_COMPLETE_LOCAL_NAME.
* @param ServiceUUIDLen Length of ServiceUUIDList array.
* @param ServiceUUIDList This is the list of the UUIDs AD Types as defined in Volume 3,
* Section 11.1.1 of GAP Specification. First byte is the AD Type.
* @arg @ref AD_TYPE_16_BIT_SERV_UUID
* @arg @ref AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST
* @arg @ref AD_TYPE_128_BIT_SERV_UUID
* @arg @ref AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST
* @param SlaveConnIntervMin Slave connection interval minimum value suggested by Peripheral.
* If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
* Slave Connection Interval Range AD structure will be added in advertising
* data.
* Connection interval is defined in the following manner:
* connIntervalmin = Slave_Conn_Interval_Min x 1.25ms
* Slave_Conn_Interval_Min range: 0x0006 to 0x0C80
* Value of 0xFFFF indicates no specific minimum.
* @param SlaveConnIntervMax Slave connection interval maximum value suggested by Peripheral.
* If SlaveConnIntervMin and SlaveConnIntervMax are not 0x0000,
* Slave Connection Interval Range AD structure will be added in advertising
* data.
* ConnIntervalmax = Slave_Conn_Interval_Max x 1.25ms
* Slave_Conn_Interval_Max range: 0x0006 to 0x0C80
* Slave_ Conn_Interval_Max shall be equal to or greater than the Slave_Conn_Interval_Min.
* Value of 0xFFFF indicates no specific maximum.
*
* @retval tBleStatus Value indicating success or error code.
*/
tBleStatus aci_gap_set_discoverable(uint8_t AdvType, uint16_t AdvIntervMin, uint16_t AdvIntervMax,
uint8_t OwnAddrType, uint8_t AdvFilterPolicy, uint8_t LocalNameLen,
const char *LocalName, uint8_t ServiceUUIDLen, uint8_t* ServiceUUIDList,
uint16_t SlaveConnIntervMin, uint16_t SlaveConnIntervMax);
#if BLUENRG_MS
///@cond BLUENRG_MS
/**
* @brief Set the Device in direct connectable mode (as defined in GAP specification Volume 3, Section 9.3.3).
* @note If the privacy is enabled, the reconnection address is used for advertising, otherwise the address
* of the type specified in OwnAddrType is used. The device will be in directed connectable mode only
* for 1.28 seconds. If no connection is established within this duration, the device enters non
* discoverable mode and advertising will have to be again enabled explicitly.
* The controller generates a @ref EVT_LE_CONN_COMPLETE event with the status set to @ref HCI_DIRECTED_ADV_TIMEOUT
* if the connection was not established and 0x00 if the connection was successfully established.
*
* Usage example:
* @code
*
* tBleStatus ret;
*
* const uint8_t central_address[] = {0x43,0x27,0x84,0xE1,0x80,0x02};
* ret = aci_gap_set_direct_connectable(PUBLIC_ADDR, HIGH_DUTY_CYCLE_DIRECTED_ADV, PUBLIC_ADDR, central_address);
* @endcode
*
*
*
* @param OwnAddrType Type of our address used during advertising (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
* @param directed_adv_type Type of directed advertising (@ref HIGH_DUTY_CYCLE_DIRECTED_ADV, @ref LOW_DUTY_CYCLE_DIRECTED_ADV).
* @param InitiatorAddrType Type of peer address (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
* @param InitiatorAddr Initiator's address (Little Endian).
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_direct_connectable(uint8_t own_addr_type, uint8_t directed_adv_type, uint8_t initiator_addr_type, const uint8_t *initiator_addr);
///@endcond
#else
///@cond BLUENRG
/**
* @brief Set the Device in direct connectable mode (as defined in GAP specification Volume 3, Section 9.3.3).
* @note If the privacy is enabled, the reconnection address is used for advertising, otherwise the address
* of the type specified in OwnAddrType is used. The device will be in directed connectable mode only
* for 1.28 seconds. If no connection is established within this duration, the device enters non
* discoverable mode and advertising will have to be again enabled explicitly.
* The controller generates a @ref EVT_LE_CONN_COMPLETE event with the status set to @ref HCI_DIRECTED_ADV_TIMEOUT
* if the connection was not established and 0x00 if the connection was successfully established.
*
* Usage example:
* @code
*
* tBleStatus ret;
*
* const uint8_t central_address = {0x43,0x27,0x84,0xE1,0x80,0x02};
* ret = aci_gap_set_direct_connectable(PUBLIC_ADDR, PUBLIC_ADDR, central_address);
* @endcode
*
*
*
* @param OwnAddrType Type of our address used during advertising (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
* @param InitiatorAddrType Type of peer address (@ref PUBLIC_ADDR,@ref STATIC_RANDOM_ADDR).
* @param InitiatorAddr Initiator's address (Little Endian).
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_direct_connectable(uint8_t own_addr_type, uint8_t initiator_addr_type, const uint8_t *initiator_addr);
///@endcond
#endif
/**
* @brief Set the IO capabilities of the device.
* @note This command has to be given only when the device is not in a connected state.
* @param io_capability One of the allowed codes for IO Capability:
* @arg @ref IO_CAP_DISPLAY_ONLY
* @arg @ref IO_CAP_DISPLAY_YES_NO
* @arg @ref IO_CAP_KEYBOARD_ONLY
* @arg @ref IO_CAP_NO_INPUT_NO_OUTPUT
* @arg @ref IO_CAP_KEYBOARD_DISPLAY
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_io_capability(uint8_t io_capability);
/**
* @brief Set the authentication requirements for the device.
* @note If the oob_enable is set to 0, oob_data will be ignored.
* This command has to be given only when the device is not in a connected state.
* @param mitm_mode MITM mode:
* @arg @ref MITM_PROTECTION_NOT_REQUIRED
* @arg @ref MITM_PROTECTION_REQUIRED
* @param oob_enable If OOB data are present or not:
* @arg @ref OOB_AUTH_DATA_ABSENT
* @arg @ref OOB_AUTH_DATA_PRESENT
* @param oob_data Out-Of-Band data
* @param min_encryption_key_size Minimum size of the encryption key to be used during the pairing process
* @param max_encryption_key_size Maximum size of the encryption key to be used during the pairing process
* @param use_fixed_pin If application wants to use a fixed pin or not:
* @arg @ref USE_FIXED_PIN_FOR_PAIRING
* @arg @ref DONOT_USE_FIXED_PIN_FOR_PAIRING
* If a fixed pin is not used, it has to be provided by the application with
* aci_gap_pass_key_response() after @ref EVT_BLUE_GAP_PASS_KEY_REQUEST event.
* @param fixed_pin If use_fixed_pin is USE_FIXED_PIN_FOR_PAIRING, this is the value of the pin that will
* be used during pairing if MIMT protection is enabled. Any value between 0 to 999999 is
* accepted.
* @param bonding_mode One of the bonding modes:
* @arg @ref BONDING
* @arg @ref NO_BONDING
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_auth_requirement(uint8_t mitm_mode,
uint8_t oob_enable,
uint8_t oob_data[16],
uint8_t min_encryption_key_size,
uint8_t max_encryption_key_size,
uint8_t use_fixed_pin,
uint32_t fixed_pin,
uint8_t bonding_mode);
/**
* @brief Set the authorization requirements of the device.
* @note This command has to be given only when the device is not in a connected state.
* @param conn_handle Handle of the connection in case BlueNRG is configured as a master (otherwise it can be also 0).
* @param authorization_enable @arg @ref AUTHORIZATION_NOT_REQUIRED : Authorization not required
* @arg @ref AUTHORIZATION_REQUIRED : Authorization required. This enables
* the authorization requirement in the device and when a remote device
* tries to connect to GATT server, @ref EVT_BLUE_GAP_AUTHORIZATION_REQUEST event
* will be sent to the Host.
*
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_author_requirement(uint16_t conn_handle, uint8_t authorization_enable);
/**
* @brief Provide the pass key that will be used during pairing.
* @note This command should be sent by the Host in response to @ref EVT_BLUE_GAP_PASS_KEY_REQUEST event.
* @param conn_handle Connection handle
* @param passkey Pass key that will be used during the pairing process. Must be a number between
* 0 and 999999.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_pass_key_response(uint16_t conn_handle, uint32_t passkey);
/**
* @brief Authorize a device to access attributes.
* @note Application should send this command after it has received a @ref EVT_BLUE_GAP_AUTHORIZATION_REQUEST.
*
* @param conn_handle Connection handle
* @param authorize @arg @ref CONNECTION_AUTHORIZED : Authorize (accept connection)
* @arg @ref CONNECTION_REJECTED : Reject (reject connection)
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_authorization_response(uint16_t conn_handle, uint8_t authorize);
#if BLUENRG_MS
///@cond BLUENRG_MS
/**
* @brief Put the device into non-connectable mode.
* @param adv_type One of the allowed advertising types:
* @arg @ref ADV_SCAN_IND : Scannable undirected advertising
* @arg @ref ADV_NONCONN_IND : Non-connectable undirected advertising
* @param own_address_type If Privacy is disabled, then the peripheral address can be
* @arg @ref PUBLIC_ADDR.
* @arg @ref STATIC_RANDOM_ADDR.
* If Privacy is enabled, then the peripheral address can be
* @arg @ref RESOLVABLE_PRIVATE_ADDR
* @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_non_connectable(uint8_t adv_type, uint8_t own_address_type);
///@endcond
#else
///@cond BLUENRG
/**
* @brief Put the device into non-connectable mode.
* @param adv_type One of the allowed advertising types:
* @arg @ref ADV_SCAN_IND : Scannable undirected advertising
* @arg @ref ADV_NONCONN_IND : Non-connectable undirected advertising
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_non_connectable(uint8_t adv_type);
///@endcond
#endif
/**
* @brief Put the device into undirected connectable mode.
* @note If privacy is enabled in the device, a resolvable private address is generated and used
* as the advertiser's address. If not, the address of the type specified in own_addr_type
* is used for advertising.
* @param own_addr_type Type of our address used during advertising:
* @cond BLUENRG
* @arg @ref PUBLIC_ADDR.
* @arg @ref STATIC_RANDOM_ADDR.
* @endcond
* @cond BLUENRG_MS
* If Privacy is disabled:
* @arg @ref PUBLIC_ADDR.
* @arg @ref STATIC_RANDOM_ADDR.
* If Privacy is enabled:
* @arg @ref RESOLVABLE_PRIVATE_ADDR
* @arg @ref NON_RESOLVABLE_PRIVATE_ADDR
* @endcond
* @param adv_filter_policy Filter policy:
* @arg @ref NO_WHITE_LIST_USE
* @arg @ref WHITE_LIST_FOR_ALL
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_set_undirected_connectable(uint8_t own_addr_type, uint8_t adv_filter_policy);
/**
* @brief Send a slave security request to the master.
* @note This command has to be issued to notify the master of the security requirements of the slave.
* The master may encrypt the link, initiate the pairing procedure, or reject the request.
* @param conn_handle Connection handle
* @param bonding One of the bonding modes:
* @arg @ref BONDING
* @arg @ref NO_BONDING
* @param mitm_protection If MITM protection is required or not:
* @arg @ref MITM_PROTECTION_NOT_REQUIRED
* @arg @ref MITM_PROTECTION_REQUIRED
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_slave_security_request(uint16_t conn_handle, uint8_t bonding, uint8_t mitm_protection);
/**
* @brief Update advertising data.
* @note This command can be used to update the advertising data for a particular AD type.
* If the AD type specified does not exist, then it is added to the advertising data.
* If the overall advertising data length is more than 31 octets after the update, then
* the command is rejected and the old data is retained.
* @param AdvLen Length of AdvData array
* @param AdvData Advertisement Data, formatted as specified in Bluetooth specification
* (Volume 3, Part C, 11), including data length. It can contain more than one AD type.
* Example
* @code
* tBleStatus ret;
* const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
* const uint8_t serviceUUIDList[] = {AD_TYPE_16_BIT_SERV_UUID,0x34,0x12};
* const uint8_t manuf_data[] = {4, AD_TYPE_MANUFACTURER_SPECIFIC_DATA, 0x05, 0x02, 0x01};
*
* ret = aci_gap_set_discoverable(ADV_IND, 0, 0, STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
* 8, local_name, 3, serviceUUIDList, 0, 0);
* ret = aci_gap_update_adv_data(5, manuf_data);
* @endcode
*
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_update_adv_data(uint8_t AdvLen, const uint8_t *AdvData);
/**
* @brief Delete an AD Type
* @note This command can be used to delete the specified AD type from the advertisement data if
* present.
* @param ad_type One of the allowed AD types (see @ref AD_Types)
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_delete_ad_type(uint8_t ad_type);
/**
* @brief Get the current security settings
* @note This command can be used to get the current security settings of the device.
* @param mitm_protection @arg 0: Not required
* @arg 1: Required
* @param bonding @arg 0: No bonding mode
* @arg 1: Bonding mode
* @param oob_data @arg 0: Data absent
* @arg 1: Data present
* @param passkey_required @arg 0: Not required
* @arg 1: Fixed pin is present which is being used
* @arg 2: Passkey required for pairing. An event will be generated
* when required.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_get_security_level(uint8_t* mitm_protection, uint8_t* bonding,
uint8_t* oob_data, uint8_t* passkey_required);
/**
* @brief Add addresses of bonded devices into the controller's whitelist.
* @note The command will return an error if there are no devices in the database or if it was unable
* to add the device into the whitelist.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_configure_whitelist(void);
/**
* @brief Terminate a connection.
* @note A @ref EVT_DISCONN_COMPLETE event will be generated when the link is disconnected.
* @param conn_handle Connection handle
* @param reason Reason for requesting disconnection. The error code can be any of ones as specified
* for the disconnected command in the HCI specification (See @ref HCI_Error_codes).
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_terminate(uint16_t conn_handle, uint8_t reason);
/**
* @brief Clear the security database.
* @note All the devices in the security database will be removed.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_clear_security_database(void);
#if BLUENRG_MS
///@cond BLUENRG_MS
/**
* @brief Allows the security manager to complete the pairing procedure and re-bond with the master.
* @note This command can be issued by the application if a @ref EVT_BLUE_GAP_BOND_LOST event is generated.
* @param conn_handle
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_allow_rebond(uint16_t conn_handle);
///@endcond
#else
///@cond BLUENRG
/**
* @brief Allows the security manager to complete the pairing procedure and re-bond with the master.
* @note This command can be issued by the application if a @ref EVT_BLUE_GAP_BOND_LOST event is generated.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_allow_rebond(void);
///@endcond
#endif
/**
* @brief Start the limited discovery procedure.
* @note The controller is commanded to start active scanning. When this procedure is started,
* only the devices in limited discoverable mode are returned to the upper layers.
* The procedure is terminated when either the upper layers issue a command to terminate the
* procedure by issuing the command aci_gap_terminate_gap_procedure() with the procedure code
* set to @ref GAP_LIMITED_DISCOVERY_PROC or a timeout happens. When the procedure is terminated
* due to any of the above reasons, @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with
* the procedure code set to @ref GAP_LIMITED_DISCOVERY_PROC.
* The device found when the procedure is ongoing is returned to the upper layers through the
* event @ref EVT_BLUE_GAP_DEVICE_FOUND.
* @param scanInterval Time interval from when the Controller started its last LE scan until it begins
* the subsequent LE scan. The scan interval should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
* or equal to Scan_Interval. The scan window should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param own_address_type Type of our address used during advertising (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
* @param filterDuplicates Duplicate filtering enabled or not.
* @arg 0x00: Do not filter the duplicates
* @arg 0x01: Filter duplicates
*
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_start_limited_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
uint8_t own_address_type, uint8_t filterDuplicates);
/**
* @brief Start the general discovery procedure.
* @note The controller is commanded to start active scanning. The procedure is terminated when
* either the upper layers issue a command to terminate the procedure by issuing the command
* aci_gap_terminate_gap_procedure() with the procedure code set to GAP_GENERAL_DISCOVERY_PROC
* or a timeout happens. When the procedure is terminated due to any of the above reasons,
* @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with the procedure code set to
* @ref GAP_GENERAL_DISCOVERY_PROC. The device found when the procedure is ongoing is returned to
* the upper layers through the event @ref EVT_BLUE_GAP_DEVICE_FOUND.
* @param scanInterval Time interval from when the Controller started its last LE scan until it begins
* the subsequent LE scan. The scan interval should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
* or equal to Scan_Interval. The scan window should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param own_address_type Type of our address used during advertising (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
* @param filterDuplicates Duplicate filtering enabled or not.
* @arg 0x00: Do not filter the duplicates
* @arg 0x01: Filter duplicates
*
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_start_general_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
uint8_t own_address_type, uint8_t filterDuplicates);
/**
* @brief Start the name discovery procedure.
* @note A LE_Create_Connection call will be made to the controller by GAP with the initiator filter
* policy set to ignore whitelist and process connectable advertising packets only for the
* specified device. Once a connection is established, GATT procedure is started to read the
* device name characteristic. When the read is completed (successfully or unsuccessfully),
* a @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is given to the upper layer. The event also
* contains the name of the device if the device name was read successfully.
* @param scanInterval Time interval from when the Controller started its last LE scan until it begins
* the subsequent LE scan. The scan interval should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
* or equal to Scan_Interval. The scan window should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param peer_bdaddr_type Type of the peer address (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
* @param peer_bdaddr Address of the peer device with which a connection has to be established.
* @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
* @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
* equal to Conn_Interval_Max.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
* equal to Conn_Interval_Min.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_latency Slave latency for the connection in number of connection events.\n
* Range: 0x0000 to 0x01F4
* @param supervision_timeout Supervision timeout for the LE Link.\n
* Range: 0x000A to 0x0C80\n
* Time = N x 10 msec\n
* Time Range: 100 msec to 32 seconds
* @param min_conn_length Minimum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @param max_conn_length Maximum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_start_name_discovery_proc(uint16_t scanInterval, uint16_t scanWindow,
uint8_t peer_bdaddr_type, tBDAddr peer_bdaddr,
uint8_t own_bdaddr_type, uint16_t conn_min_interval,
uint16_t conn_max_interval, uint16_t conn_latency,
uint16_t supervision_timeout, uint16_t min_conn_length,
uint16_t max_conn_length);
/**
* @brief Start the auto connection establishment procedure.
* @note The devices specified are added to the white list of the controller and a LE_Create_Connection
* call will be made to the controller by GAP with the initiator filter policy set to
* use whitelist to determine which advertiser to connect to. When a command is issued to
* terminate the procedure by upper layer, a LE_Create_Connection_Cancel call will be made to the
* controller by GAP.
* The procedure is terminated when either a connection is successfully established with one of
* the specified devices in the white list or the procedure is explicitly terminated by issuing
* the command aci_gap_terminate_gap_procedure() with the procedure code set to
* @ref GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC. A @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is returned with
* the procedure code set to @ref GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC.
* @param scanInterval Time interval from when the Controller started its last LE scan until it begins
* the subsequent LE scan. The scan interval should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
* or equal to Scan_Interval. The scan window should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
* @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
* equal to Conn_Interval_Max.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
* equal to Conn_Interval_Min.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_latency Slave latency for the connection in number of connection events.\n
* Range: 0x0000 to 0x01F4
* @param supervision_timeout Supervision timeout for the LE Link.\n
* Range: 0x000A to 0x0C80\n
* Time = N x 10 msec\n
* Time Range: 100 msec to 32 seconds
* @param min_conn_length Minimum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @param max_conn_length Maximum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @cond BLUENRG
* @param use_reconn_addr If 1, the provided reconnection address is used as our address during the procedure (the address
* has been previously notified to the application through @ref EVT_BLUE_GAP_RECONNECTION_ADDRESS event).\n
* @param reconn_addr Reconnection address used if use_reconn_addr is 1.
* @endcond
* @param num_whitelist_entries Number of devices that have to be added to the whitelist.
* @param addr_array addr_array will contain the addresses that have to be added into the whitelist. The
* format of the addr_array should be: address type followed by address.
* Example:
* @code
* uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
* PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
* @endcode
* @return Value indicating success or error code.
*/
#if BLUENRG_MS
///@cond BLUENRG_MS
tBleStatus aci_gap_start_auto_conn_establish_proc(uint16_t scanInterval, uint16_t scanWindow,
uint8_t own_bdaddr_type, uint16_t conn_min_interval,
uint16_t conn_max_interval, uint16_t conn_latency,
uint16_t supervision_timeout, uint16_t min_conn_length,
uint16_t max_conn_length,
uint8_t num_whitelist_entries,
const uint8_t *addr_array);
///@endcond
#else
///@cond BLUENRG
tBleStatus aci_gap_start_auto_conn_establish_proc(uint16_t scanInterval, uint16_t scanWindow,
uint8_t own_bdaddr_type, uint16_t conn_min_interval,
uint16_t conn_max_interval, uint16_t conn_latency,
uint16_t supervision_timeout, uint16_t min_conn_length,
uint16_t max_conn_length,
uint8_t use_reconn_addr,
const tBDAddr reconn_addr,
uint8_t num_whitelist_entries,
const uint8_t *addr_array);
///@endcond
#endif
/**
* @brief Start a general connection establishment procedure.
* @note The host enables scanning in the controller with the scanner filter policy set
* to accept all advertising packets and from the scanning results all the devices
* are sent to the upper layer using the event @ref EVT_BLUE_GAP_DEVICE_FOUND.
* The upper layer then has to select one of the devices to which it wants to connect
* by issuing the command aci_gap_create_connection(). The procedure is terminated
* when a connection is established or the upper layer terminates the procedure by
* issuing the command aci_gap_terminate_gap_procedure() with the procedure code set to
* @ref GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC. On completion of the procedure a
* @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is generated with the procedure code set to
* @ref GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC.
* @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
* @param scan_interval Time interval from when the Controller started its last LE scan until it begins
* the subsequent LE scan. The scan interval should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param scan_window Amount of time for the duration of the LE scan. Scan_Window shall be less than
* or equal to Scan_Interval. The scan window should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param own_address_type Type of our address used during active scanning (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
* @param filter_duplicates Duplicate filtering enabled or not.
* @arg 0x00: Do not filter the duplicates
* @arg 0x01: Filter duplicates
* @cond BLUENRG
* @param use_reconn_addr If 1, the provided reconnection address is used as our address during the procedure (the address
* has been previously notified to the application through @ref EVT_BLUE_GAP_RECONNECTION_ADDRESS event).\n
* @param reconn_addr Reconnection address used if use_reconn_addr is 1.
* @endcond
*
* @return Value indicating success or error code.
*/
#if BLUENRG_MS
///@cond BLUENRG_MS
tBleStatus aci_gap_start_general_conn_establish_proc(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
uint8_t own_address_type, uint8_t filter_duplicates);
///@endcond
#else
///@cond BLUENRG
tBleStatus aci_gap_start_general_conn_establish_proc(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
uint8_t own_address_type, uint8_t filter_duplicates, uint8_t use_reconn_addr, const tBDAddr reconn_addr);
///@endcond
#endif
/**
* @brief Start a selective connection establishment procedure.
* @note The GAP adds the specified device addresses into white list and enables scanning in
* the controller with the scanner filter policy set to accept packets only from
* devices in whitelist. All the devices found are sent to the upper layer by the
* event @ref EVT_BLUE_GAP_DEVICE_FOUND. The upper layer then has to select one of the
* devices to which it wants to connect by issuing the command aci_gap_create_connection().
* On completion of the procedure a @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is generated
* with the procedure code set to @ref GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC.
* The procedure is terminated when a connection is established or the upper layer terminates
* the procedure by issuing the command aci_gap_terminate_gap_procedure with the procedure
* code set to @ref GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC.
* @param scan_type Passive or active scanning (@ref PASSIVE_SCAN, @ref ACTIVE_SCAN)
* @param scan_interval Time interval from when the Controller started its last LE scan until it begins
* the subsequent LE scan. The scan interval should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param scan_window Amount of time for the duration of the LE scan. Scan_Window shall be less than
* or equal to Scan_Interval. The scan window should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param own_address_type Type of our address used during active scanning (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
* @param filter_duplicates Duplicate filtering enabled or not.
* @arg 0x00: Do not filter the duplicates
* @arg 0x01: Filter duplicates
* @param num_whitelist_entries Number of devices that have to be added to the whitelist.
* @param addr_array addr_array will contain the addresses that have to be added into the whitelist. The
* format of the addr_array should be: address type followed by address.
* Example:
* @code
* uint8_t addr_array[] = {PUBLIC_ADDR,0x01,0x00,0x00,0xe1,0x80,0x02,
* PUBLIC_ADDR,0x02,0x00,0x00,0xe1,0x80,0x02};
* @endcode
*
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_start_selective_conn_establish_proc(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window,
uint8_t own_address_type, uint8_t filter_duplicates, uint8_t num_whitelist_entries,
const uint8_t *addr_array);
/**
* @brief Start the direct connection establishment procedure.
* @note A LE_Create_Connection call will be made to the controller by GAP with the initiator filter
* policy set to ignore whitelist and process connectable advertising packets only for the
* specified device. The procedure can be terminated explicitly by the upper layer by issuing
* the command aci_gap_terminate_gap_procedure(). When a command is issued to terminate the
* procedure by upper layer, a LE_Create_Connection_Cancel call will be made to the controller
* by GAP.
* On termination of the procedure, a @ref EVT_LE_CONN_COMPLETE event is returned. The procedure can
* be explicitly terminated by the upper layer by issuing the command
* aci_gap_terminate_gap_procedure() with the procedure_code set to @ref GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC.
* @param scanInterval Time interval from when the Controller started its last LE scan until it begins
* the subsequent LE scan. The scan interval should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param scanWindow Amount of time for the duration of the LE scan. Scan_Window shall be less than
* or equal to Scan_Interval. The scan window should be a number in the range
* 0x0004 to 0x4000. This corresponds to a time range 2.5 msec to 10240 msec.
* For a number N, Time = N x 0.625 msec.
* @param peer_bdaddr_type Type of the peer address (@ref PUBLIC_ADDR, @ref STATIC_RANDOM_ADDR).
* @param peer_bdaddr Address of the peer device with which a connection has to be established.
* @param own_bdaddr_type Type of our address used during advertising (PUBLIC_ADDR,STATIC_RANDOM_ADDR).
* @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
* equal to Conn_Interval_Max.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
* equal to Conn_Interval_Min.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_latency Slave latency for the connection in number of connection events.\n
* Range: 0x0000 to 0x01F4
* @param supervision_timeout Supervision timeout for the LE Link.\n
* Range: 0x000A to 0x0C80\n
* Time = N x 10 msec\n
* Time Range: 100 msec to 32 seconds
* @param min_conn_length Minimum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @param max_conn_length Maximum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_create_connection(uint16_t scanInterval, uint16_t scanWindow,
uint8_t peer_bdaddr_type, tBDAddr peer_bdaddr,
uint8_t own_bdaddr_type, uint16_t conn_min_interval,
uint16_t conn_max_interval, uint16_t conn_latency,
uint16_t supervision_timeout, uint16_t min_conn_length,
uint16_t max_conn_length);
/**
* @brief Terminate the specified GATT procedure. @ref EVT_BLUE_GAP_PROCEDURE_COMPLETE event is
* returned with the procedure code set to the corresponding procedure.
* @param procedure_code One of the procedure codes (@ref gap_procedure_codes "GAP procedure codes").
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_terminate_gap_procedure(uint8_t procedure_code);
/**
* @brief Start the connection parameter update procedure.
* @note Allowed by the Central to update the connection parameter of the specified connection.
* A Link Layer Connection Update procedure is started on the controller.
* On completion of the procedure, a @ref EVT_LE_CONN_UPDATE_COMPLETE event is returned to
* the upper layer.
* @param conn_handle Handle of the connection for which the update procedure has to be started.
* @param conn_min_interval Minimum value for the connection event interval. This shall be less than or
* equal to Conn_Interval_Max.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_max_interval Maximum value for the connection event interval. This shall be greater than or
* equal to Conn_Interval_Min.\n
* Range: 0x0006 to 0x0C80\n
* Time = N x 1.25 msec\n
* Time Range: 7.5 msec to 4 seconds
* @param conn_latency Slave latency for the connection in number of connection events.\n
* Range: 0x0000 to 0x01F4
* @param supervision_timeout Supervision timeout for the LE Link.\n
* Range: 0x000A to 0x0C80\n
* Time = N x 10 msec\n
* Time Range: 100 msec to 32 seconds
* @param min_conn_length Minimum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @param max_conn_length Maximum length of connection needed for the LE connection.\n
* Range: 0x0000 - 0xFFFF\n
* Time = N x 0.625 msec.
* @return Value indicating success or error code.
*/
tBleStatus aci_gap_start_connection_update(uint16_t conn_handle, uint16_t conn_min_interval,
uint16_t conn_max_interval, uint16_t conn_latency,
uint16_t supervision_timeout, uint16_t min_conn_length,
uint16_t max_conn_length);