35
35
* GAP advertising data builder.
36
36
*
37
37
* Advertising data are used by broadcaster or peripheral to advertise state
38
- * about the device. This class offers function to add and update states present
38
+ * about the device. This class offers the function to add and update states present
39
39
* in an advertisement payload.
40
40
*
41
- * After construction the advertising payload contained in instance of
42
- * GapAdvertisingData is empty. Adding new states also named fields can be
43
- * achieved by invoking the function addData() while updating existing state
44
- * involve calling the function updateData().
41
+ * After construction, the advertising payload contained in the instance of
42
+ * GapAdvertisingData is empty. Adding new states and named fields can be
43
+ * achieved by invoking the function addData(), and updating existing state
44
+ * involves calling the function updateData().
45
45
*
46
46
* Fields present in the payload can be retrieved by a call to the function
47
47
* findField.
48
48
*
49
49
* This class includes shorthand for the most common fields:
50
- * - FLAGS: addFlags()
51
- * - APPEARANCE: addAppearance()
52
- * - TX_POWER_LEVEL: addTxPower()
50
+ * - FLAGS: addFlags().
51
+ * - APPEARANCE: addAppearance().
52
+ * - TX_POWER_LEVEL: addTxPower().
53
53
*
54
54
* @code
55
55
*
79
79
* @endcode
80
80
*
81
81
* @note See Bluetooth Specification 4.0 (Vol. 3), Part C, Sections 11 and 18
82
- * for further information on Advertising and Scan Response data.
82
+ * for further information on advertising and scan response data.
83
83
*
84
84
* @par Advertising and Scan Response Payloads
85
- * Advertising data and Scan Response data are organized around a set of
85
+ * Advertising data and scan response data are organized around a set of
86
86
* data types called 'AD types' in Bluetooth 4.0 (see the Bluetooth Core
87
87
* Specification v4.0, Vol. 3, Part C, Sections 11 and 18).
88
88
*
89
89
* @par
90
- * Each AD type has its own standardized assigned number, as defined
91
- * by the Bluetooth SIG:
90
+ * Each AD type has its own standardized assigned number, as
91
+ * the Bluetooth SIG defines :
92
92
* https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile.
93
93
*
94
94
* @par
97
97
*
98
98
* @par
99
99
* Before the AD Types and their payload (if any) can be inserted into
100
- * the Advertising or Scan Response frames, they need to be formatted as
100
+ * the advertising or scan response frames, they need to be formatted as
101
101
* follows:
102
102
*
103
103
* @li @c Record length (1 byte).
106
106
*
107
107
* @par
108
108
* This class takes care of properly formatting the payload, performs
109
- * some basic checks on the payload length, and tries to avoid common
110
- * errors like adding an exclusive AD field twice in the Advertising
111
- * or Scan Response payload.
109
+ * some basic checks on the payload length and tries to avoid common
110
+ * errors such as adding an exclusive AD field twice in the advertising
111
+ * or scan response payload.
112
112
*/
113
113
class GapAdvertisingData
114
114
{
115
115
public:
116
116
/* !
117
117
* List of standard Advertising Data types.
118
118
*
119
- * These AD types are used to describe the capabilities of the peripheral,
119
+ * These AD types are used to describe the capabilities of the peripheral
120
120
* and are inserted inside the advertising or scan response payloads.
121
121
*
122
122
* @par Source
@@ -186,7 +186,7 @@ class GapAdvertisingData
186
186
SLAVE_CONNECTION_INTERVAL_RANGE = 0x12 ,
187
187
188
188
/* *
189
- * List of 128 bit service UUIDs the device is looking for.
189
+ * List of 128- bit service UUIDs the device is looking for.
190
190
*/
191
191
LIST_128BIT_SOLICITATION_IDS = 0x15 ,
192
192
@@ -215,15 +215,15 @@ class GapAdvertisingData
215
215
/* *
216
216
* Alias for GapAdvertisingData::DataType_t.
217
217
*
218
- * @deprecated This type alias will be dropped in future releases .
218
+ * @deprecated Future releases will drop this type alias .
219
219
*/
220
220
typedef enum DataType_t DataType;
221
221
222
222
/* *
223
223
* Enumeration of allowed flags for DataType_t::FLAGS.
224
224
*
225
- * @note DataType_t::FLAGS may contain several flags assembled by the
226
- * bitwise and operator (ex.LE_GENERAL_DISCOVERABLE & BREDR_NOT_SUPPORTED).
225
+ * @note DataType_t::FLAGS may contain several flags that the bitwise
226
+ * and operator (ex.LE_GENERAL_DISCOVERABLE & BREDR_NOT_SUPPORTED) assembled .
227
227
*
228
228
* @par Source
229
229
*
@@ -242,7 +242,7 @@ class GapAdvertisingData
242
242
243
243
/* *
244
244
* Peripheral device is LE only and does not support Bluetooth Enhanced
245
- * DataRate
245
+ * DataRate.
246
246
*/
247
247
BREDR_NOT_SUPPORTED = 0x04 ,
248
248
@@ -261,7 +261,7 @@ class GapAdvertisingData
261
261
/* *
262
262
* Alias for GapAdvertisingData::Flags_t.
263
263
*
264
- * @deprecated This type alias will be dropped in future releases .
264
+ * @deprecated Future releases will drop this type alias .
265
265
*/
266
266
typedef enum Flags_t Flags;
267
267
@@ -338,7 +338,7 @@ class GapAdvertisingData
338
338
GENERIC_MEDIA_PLAYER = 640 ,
339
339
340
340
/* *
341
- * Generic Barcode Scanner.
341
+ * Generic Bar Code Scanner.
342
342
*/
343
343
GENERIC_BARCODE_SCANNER = 704 ,
344
344
@@ -418,7 +418,7 @@ class GapAdvertisingData
418
418
DIGITAL_PEN = 967 ,
419
419
420
420
/* *
421
- * Barcode Scanner.
421
+ * Bar Code Scanner.
422
422
*/
423
423
BARCODE_SCANNER = 968 ,
424
424
@@ -527,7 +527,7 @@ class GapAdvertisingData
527
527
/* *
528
528
* Alias for GapAdvertisingData::Appearance_t.
529
529
*
530
- * @deprecated This type alias will be dropped in future releases .
530
+ * @deprecated Future releases will drop this type alias .
531
531
*/
532
532
typedef enum Appearance_t Appearance;
533
533
@@ -557,7 +557,7 @@ class GapAdvertisingData
557
557
* @note When the specified data type is INCOMPLETE_LIST_16BIT_SERVICE_IDS,
558
558
* COMPLETE_LIST_16BIT_SERVICE_IDS, INCOMPLETE_LIST_32BIT_SERVICE_IDS,
559
559
* COMPLETE_LIST_32BIT_SERVICE_IDS, INCOMPLETE_LIST_128BIT_SERVICE_IDS,
560
- * COMPLETE_LIST_128BIT_SERVICE_IDS or LIST_128BIT_SOLICITATION_IDS the
560
+ * COMPLETE_LIST_128BIT_SERVICE_IDS or LIST_128BIT_SOLICITATION_IDS, the
561
561
* supplied value is appended to the values present in the payload.
562
562
*/
563
563
ble_error_t addData (DataType_t advDataType, const uint8_t *payload, uint8_t len)
@@ -566,10 +566,10 @@ class GapAdvertisingData
566
566
uint8_t * field = findField (advDataType);
567
567
568
568
if (field) {
569
- /* Field type already exist , either add to field or replace */
569
+ /* Field type already exists , either add to field or replace */
570
570
return addField (advDataType, payload, len, field);
571
571
} else {
572
- /* Field doesn't exists , insert new */
572
+ /* Field doesn't exist , insert new */
573
573
return appendField (advDataType, payload, len);
574
574
}
575
575
}
@@ -592,10 +592,10 @@ class GapAdvertisingData
592
592
uint8_t * field = findField (advDataType);
593
593
594
594
if (field) {
595
- /* Field type already exist , replace field contents */
595
+ /* Field type already exists , replace field contents */
596
596
return updateField (advDataType, payload, len, field);
597
597
} else {
598
- /* field doesn't exists , return an error */
598
+ /* field doesn't exist , return an error */
599
599
return BLE_ERROR_UNSPECIFIED;
600
600
}
601
601
}
@@ -688,7 +688,7 @@ class GapAdvertisingData
688
688
/* *
689
689
* Get the appearance set.
690
690
*
691
- * If no value has been set this function returns GENERIC_TAG.
691
+ * If no value has been set, this function returns GENERIC_TAG.
692
692
*
693
693
* @return The appearance value set for this device.
694
694
*/
@@ -739,7 +739,7 @@ class GapAdvertisingData
739
739
*/
740
740
ble_error_t appendField (DataType advDataType, const uint8_t *payload, uint8_t len)
741
741
{
742
- /* Make sure we don't exceed the 31 byte payload limit */
742
+ /* Make sure we don't exceed the 31- byte payload limit */
743
743
if (_payloadLen + len + 2 > GAP_ADVERTISING_DATA_MAX_PAYLOAD) {
744
744
return BLE_ERROR_BUFFER_OVERFLOW;
745
745
}
@@ -788,7 +788,7 @@ class GapAdvertisingData
788
788
* @note When the specified AD type is INCOMPLETE_LIST_16BIT_SERVICE_IDS,
789
789
* COMPLETE_LIST_16BIT_SERVICE_IDS, INCOMPLETE_LIST_32BIT_SERVICE_IDS,
790
790
* COMPLETE_LIST_32BIT_SERVICE_IDS, INCOMPLETE_LIST_128BIT_SERVICE_IDS,
791
- * COMPLETE_LIST_128BIT_SERVICE_IDS or LIST_128BIT_SOLICITATION_IDS the
791
+ * COMPLETE_LIST_128BIT_SERVICE_IDS or LIST_128BIT_SOLICITATION_IDS, the
792
792
* supplied value is appended to the values previously added to the
793
793
* payload.
794
794
*
@@ -803,7 +803,7 @@ class GapAdvertisingData
803
803
ble_error_t result = BLE_ERROR_BUFFER_OVERFLOW;
804
804
805
805
switch (advDataType) {
806
- /* These fields will have the new data appended if there is sufficient space */
806
+ /* These fields have the new data appended if there is sufficient space. */
807
807
case INCOMPLETE_LIST_16BIT_SERVICE_IDS:
808
808
case COMPLETE_LIST_16BIT_SERVICE_IDS:
809
809
case INCOMPLETE_LIST_32BIT_SERVICE_IDS:
@@ -839,7 +839,7 @@ class GapAdvertisingData
839
839
840
840
break ;
841
841
}
842
- /* These fields will be overwritten with the new value */
842
+ /* These fields are overwritten with the new value */
843
843
default : {
844
844
result = updateField (advDataType, payload, len, field);
845
845
@@ -900,7 +900,7 @@ class GapAdvertisingData
900
900
}
901
901
902
902
/* *
903
- * Advertising data buffer
903
+ * Advertising data buffer.
904
904
*/
905
905
uint8_t _payload[GAP_ADVERTISING_DATA_MAX_PAYLOAD];
906
906
0 commit comments