Mistake on this page?
Report an issue in GitHub or email us
GapAdvertisingData.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2006-2013 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MBED_GAP_ADVERTISING_DATA__LEGACY_H__
18 #define MBED_GAP_ADVERTISING_DATA__LEGACY_H__
19 
20 #include <stdint.h>
21 #include <string.h>
22 
23 #include "blecommon.h"
24 
25 /**
26  * @addtogroup ble
27  * @{
28  * @addtogroup gap
29  * @{
30  */
31 
32 #define GAP_ADVERTISING_DATA_MAX_PAYLOAD (31)
33 
34 /**
35  * GAP advertising data builder.
36  *
37  * Advertising data are used by broadcaster or peripheral to advertise state
38  * about the device. This class offers the function to add and update states present
39  * in an advertisement payload.
40  *
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  *
46  * Fields present in the payload can be retrieved by a call to the function
47  * findField.
48  *
49  * This class includes shorthand for the most common fields:
50  * - FLAGS: addFlags().
51  * - APPEARANCE: addAppearance().
52  * - TX_POWER_LEVEL: addTxPower().
53  *
54  * @code
55  *
56  * Gap &gap;
57  *
58  * static const uint8_t device_name[] = "HRM";
59  *
60  * // construct an empty advertising payload
61  * GapAdvertisingData advertising_data;
62  *
63  * // set the flags of the advertising device
64  * advertising_data.addFlags(
65  * GapAdvertisingData::LE_GENERAL_DISCOVERABLE |
66  * GapAdvertisingData::BREDR_NOT_SUPPORTED
67  * );
68  *
69  * // set the advertised name of the device
70  * advertising_data.addData(
71  * GapAdvertisingData::COMPLETE_LOCAL_NAME,
72  * device_name,
73  * sizeof(device_name)
74  * );
75  *
76  * // update the advertising data of the gap payload
77  * gap.setAdvertisingPayload(advertising_data);
78  *
79  * @endcode
80  *
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.
83  *
84  * @par Advertising and Scan Response Payloads
85  * Advertising data and scan response data are organized around a set of
86  * data types called 'AD types' in Bluetooth 4.0 (see the Bluetooth Core
87  * Specification v4.0, Vol. 3, Part C, Sections 11 and 18).
88  *
89  * @par
90  * Each AD type has its own standardized assigned number, as
91  * the Bluetooth SIG defines:
92  * https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile.
93  *
94  * @par
95  * For convenience, all appropriate AD types are encapsulated in
96  * GapAdvertisingData::DataType.
97  *
98  * @par
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
101  * follows:
102  *
103  * @li @c Record length (1 byte).
104  * @li @c AD Type (1 byte).
105  * @li @c AD payload (optional; only present if record length > 1).
106  *
107  * @par
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 such as adding an exclusive AD field twice in the advertising
111  * or scan response payload.
112  *
113  * @deprecated Use AdvertisingData instead.
114  * This version provides the buffer backing for the advertising data
115  * but it's only big enough for legacy advertising.
116  */
118 {
119 public:
120  /*!
121  * List of standard Advertising Data types.
122  *
123  * These AD types are used to describe the capabilities of the peripheral
124  * and are inserted inside the advertising or scan response payloads.
125  *
126  * @par Source
127  *
128  * @li @c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 11, 18.
129  * @li @c https://www.bluetooth.org/en-us/specification/assigned-numbers/generic-access-profile.
130  */
131  enum DataType_t {
132  /**
133  * Flags, refer to GapAdvertisingData::Flags_t.
134  */
135  FLAGS = 0x01,
136 
137  /**
138  * Incomplete list of 16-bit Service IDs.
139  */
141 
142  /**
143  * Complete list of 16-bit Service IDs.
144  */
146 
147  /**
148  * Incomplete list of 32-bit Service IDs (not relevant for Bluetooth 4.0).
149  */
151 
152  /**
153  * Complete list of 32-bit Service IDs (not relevant for Bluetooth 4.0).
154  */
156 
157  /**
158  * Incomplete list of 128-bit Service IDs.
159  */
161 
162  /**
163  * Complete list of 128-bit Service IDs.
164  */
166 
167  /**
168  * Shortened Local Name.
169  */
171 
172  /**
173  * Complete Local Name.
174  */
176 
177  /**
178  * TX Power Level (in dBm).
179  */
181 
182  /**
183  * Device ID.
184  */
185  DEVICE_ID = 0x10,
186 
187  /**
188  * Slave Connection Interval Range.
189  */
191 
192  /**
193  * List of 128-bit service UUIDs the device is looking for.
194  */
196 
197  /**
198  * Service Data.
199  */
200  SERVICE_DATA = 0x16,
201 
202  /**
203  * Appearance, refer to GapAdvertisingData::Appearance_t.
204  */
205  APPEARANCE = 0x19,
206 
207  /**
208  * Advertising Interval.
209  */
211 
212  /**
213  * Manufacturer Specific Data.
214  */
216 
217  };
218 
219  /**
220  * Alias for GapAdvertisingData::DataType_t.
221  *
222  * @deprecated Future releases will drop this type alias.
223  */
224  typedef enum DataType_t DataType;
225 
226  /**
227  * Enumeration of allowed flags for DataType_t::FLAGS.
228  *
229  * @note DataType_t::FLAGS may contain several flags that the bitwise
230  * and operator (ex.LE_GENERAL_DISCOVERABLE & BREDR_NOT_SUPPORTED) assembled.
231  *
232  * @par Source
233  *
234  * @li @c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 18.1.
235  */
236  enum Flags_t {
237  /**
238  * Peripheral device is discoverable for a limited period of time.
239  */
241 
242  /**
243  * Peripheral device is discoverable at any moment.
244  */
246 
247  /**
248  * Peripheral device is LE only and does not support Bluetooth Enhanced
249  * DataRate.
250  */
252 
253  /**
254  * Not relevant - dual mode only.
255  */
257 
258  /**
259  * Not relevant - dual mode only.
260  */
262 
263  };
264 
265  /**
266  * Alias for GapAdvertisingData::Flags_t.
267  *
268  * @deprecated Future releases will drop this type alias.
269  */
270  typedef enum Flags_t Flags;
271 
272  /**
273  * Enumeration of values for the DataType_t::APPEARANCE.
274  *
275  * These values describe the physical shape or appearance of the device.
276  *
277  * @par Source
278  *
279  * @li @c Bluetooth Core Specification Supplement, Part A, Section 1.12.
280  * @li @c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 12.2.
281  * @li @c https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml.
282  */
284  /**
285  * Unknown or unspecified appearance type.
286  */
287  UNKNOWN = 0,
288 
289  /**
290  * Generic Phone.
291  */
293 
294  /**
295  * Generic Computer.
296  */
298 
299  /**
300  * Generic Watch.
301  */
303 
304  /**
305  * Sports Watch.
306  */
308 
309  /**
310  * Generic Clock.
311  */
313 
314  /**
315  * Generic Display.
316  */
318 
319  /**
320  * Generic Remote Control.
321  */
323 
324  /**
325  * Generic Eye Glasses.
326  */
328 
329  /**
330  * Generic Tag.
331  */
332  GENERIC_TAG = 512,
333 
334  /**
335  * Generic Keyring.
336  */
338 
339  /**
340  * Generic Media Player.
341  */
343 
344  /**
345  * Generic Bar Code Scanner.
346  */
348 
349  /**
350  * Generic Thermometer.
351  */
353 
354  /**
355  * Ear Thermometer.
356  */
358 
359  /**
360  * Generic Heart Rate Sensor.
361  */
363 
364  /**
365  * Belt Heart Rate Sensor.
366  */
368 
369  /**
370  * Generic Blood Pressure.
371  */
373 
374  /**
375  * Arm Blood Pressure.
376  */
378 
379  /**
380  * Wrist Blood Pressure.
381  */
383 
384  /**
385  * Human Interface Device (HID).
386  */
388 
389  /**
390  * Keyboard.
391  */
392  KEYBOARD = 961,
393 
394  /**
395  * Mouse.
396  */
397  MOUSE = 962,
398 
399  /**
400  * Joystick.
401  */
402  JOYSTICK = 963,
403 
404  /**
405  * Gamepad.
406  */
407  GAMEPAD = 964,
408 
409  /**
410  * Digitizer Tablet.
411  */
413 
414  /**
415  * Card Reader.
416  */
417  CARD_READER = 966,
418 
419  /**
420  * Digital Pen.
421  */
422  DIGITAL_PEN = 967,
423 
424  /**
425  * Bar Code Scanner.
426  */
428 
429  /**
430  * Generic Glucose Meter.
431  */
433 
434  /**
435  * Generic Running/Walking Sensor.
436  */
438 
439  /**
440  * In Shoe Running/Walking Sensor.
441  */
443 
444  /**
445  * On Shoe Running/Walking Sensor.
446  */
448 
449  /**
450  * On Hip Running/Walking Sensor.
451  */
453 
454  /**
455  * Generic Cycling.
456  */
458 
459  /**
460  * Cycling Computer.
461  */
463 
464  /**
465  * Cycling Speed Sensor.
466  */
468 
469  /**
470  * Cycling Cadence Sensor.
471  */
473 
474  /**
475  * Cycling Power Sensor.
476  */
478 
479  /**
480  * Cycling Speed and Cadence Sensor.
481  */
483 
484  /**
485  * Generic Pulse Oximeter.
486  */
488 
489  /**
490  * Fingertip Pulse Oximeter.
491  */
493 
494  /**
495  * Wrist Worn Pulse Oximeter.
496  */
498 
499  /**
500  * Generic Weight Scale.
501  */
503 
504  /**
505  * Generic Outdoor.
506  */
508 
509  /**
510  * Outdoor Location Display Device.
511  */
513 
514  /**
515  * Outdoor Location and Navigation Display Device.
516  */
518 
519  /**
520  * Outdoor Location Pod.
521  */
523 
524  /**
525  * Outdoor Location and Navigation Pod.
526  */
528 
529  };
530 
531  /**
532  * Alias for GapAdvertisingData::Appearance_t.
533  *
534  * @deprecated Future releases will drop this type alias.
535  */
536  typedef enum Appearance_t Appearance;
537 
538  /**
539  * Construct a GapAdvertising instance with an empty payload.
540  */
542  _payload(),
543  _payloadLen(0),
544  _appearance(GENERIC_TAG) {
545  }
546 
547  /**
548  * Adds a new field into the payload.
549  *
550  * If the supplied advertising data type is already present in the
551  * advertising payload, then the value is updated.
552  *
553  * @param[in] advDataType The type of the field to add.
554  * @param[in] payload Pointer to the value of the field to add.
555  * @param[in] len Size in bytes of the value to add.
556  *
557  * @return BLE_ERROR_NONE on success.
558  * @return BLE_ERROR_BUFFER_OVERFLOW if the new value causes the advertising
559  * buffer to overflow.
560  *
561  * @note When the specified data type is INCOMPLETE_LIST_16BIT_SERVICE_IDS,
562  * COMPLETE_LIST_16BIT_SERVICE_IDS, INCOMPLETE_LIST_32BIT_SERVICE_IDS,
563  * COMPLETE_LIST_32BIT_SERVICE_IDS, INCOMPLETE_LIST_128BIT_SERVICE_IDS,
564  * COMPLETE_LIST_128BIT_SERVICE_IDS or LIST_128BIT_SOLICITATION_IDS, the
565  * supplied value is appended to the values present in the payload.
566  */
567  ble_error_t addData(DataType_t advDataType, const uint8_t *payload, uint8_t len)
568  {
569  /* Find field */
570  uint8_t* field = findField(advDataType);
571 
572  if (field) {
573  /* Field type already exists, either add to field or replace */
574  return addField(advDataType, payload, len, field);
575  } else {
576  /* Field doesn't exist, insert new */
577  return appendField(advDataType, payload, len);
578  }
579  }
580 
581  /**
582  * Update a specific field in the advertising payload.
583  *
584  * @param[in] advDataType The type of the field to update.
585  * @param[in] payload Pointer to the updated value of the field.
586  * @param[in] len Size of the new value in bytes.
587  *
588  * @return BLE_ERROR_NONE returned on success.
589  * @return BLE_ERROR_UNSPECIFIED if the specified field is not found,
590  * @return BLE_ERROR_BUFFER_OVERFLOW if the new value causes the
591  * advertising buffer to overflow.
592  */
593  ble_error_t updateData(DataType_t advDataType, const uint8_t *payload, uint8_t len)
594  {
595  /* Find field */
596  uint8_t* field = findField(advDataType);
597 
598  if (field) {
599  /* Field type already exists, replace field contents */
600  return updateField(advDataType, payload, len, field);
601  } else {
602  /* field doesn't exist, return an error */
603  return BLE_ERROR_UNSPECIFIED;
604  }
605  }
606 
607  /**
608  * Add device appearance in the advertising payload.
609  *
610  * @param[in] appearance The appearance to advertise.
611  *
612  * @return BLE_ERROR_NONE on success.
613  * @return BLE_ERROR_BUFFER_OVERFLOW if the specified data would cause the
614  * advertising buffer to overflow.
615  *
616  * @note This call is equivalent to calling addData() with
617  * GapAdvertisingData::APPEARANCE as the field type.
618  */
619  ble_error_t addAppearance(Appearance appearance = GENERIC_TAG)
620  {
621  _appearance = appearance;
622  return addData(GapAdvertisingData::APPEARANCE, (uint8_t *)&appearance, 2);
623  }
624 
625  /**
626  * Add BLE flags in the advertising payload.
627  *
628  * @param[in] flags Bitfield describing the capability of the device. See
629  * allowed flags in Flags_t.
630  *
631  * @return BLE_ERROR_NONE on success.
632  * @return BLE_ERROR_BUFFER_OVERFLOW if the specified data would cause the
633  * advertising buffer to overflow.
634  *
635  * @note This call is equivalent to calling addData() with
636  * GapAdvertisingData::FLAGS as the field type.
637  */
639  {
640  return addData(GapAdvertisingData::FLAGS, &flags, 1);
641  }
642 
643  /**
644  * Add the advertising TX in the advertising payload.
645  *
646  * @param[in] txPower Transmission power level in dB.
647  *
648  * @return BLE_ERROR_NONE on success.
649  * @return BLE_ERROR_BUFFER_OVERFLOW if the specified data would cause the
650  * advertising buffer to overflow.
651  *
652  * @note This call is equivalent to calling addData() with
653  * GapAdvertisingData::TX_POWER_LEVEL as the field type.
654  */
655  ble_error_t addTxPower(int8_t txPower)
656  {
657  /* To Do: Basic error checking to make sure txPower is in range. */
658  return addData(GapAdvertisingData::TX_POWER_LEVEL, (uint8_t *)&txPower, 1);
659  }
660 
661  /**
662  * Clears the advertising data payload.
663  *
664  * @post getPayloadLen() returns 0.
665  */
666  void clear(void)
667  {
668  memset(&_payload, 0, GAP_ADVERTISING_DATA_MAX_PAYLOAD);
669  _payloadLen = 0;
670  }
671 
672  /**
673  * Get the pointer to the advertising payload bytes.
674  *
675  * @return A pointer to the payload.
676  */
677  const uint8_t *getPayload(void) const
678  {
679  return _payload;
680  }
681 
682  /**
683  * Get the payload length.
684  *
685  * @return The payload length in bytes.
686  */
687  uint8_t getPayloadLen(void) const
688  {
689  return _payloadLen;
690  }
691 
692  /**
693  * Get the appearance set.
694  *
695  * If no value has been set, this function returns GENERIC_TAG.
696  *
697  * @return The appearance value set for this device.
698  */
699  uint16_t getAppearance(void) const
700  {
701  return (uint16_t)_appearance;
702  }
703 
704  /**
705  * Search advertisement data for a specific field.
706  *
707  * @param[in] type The type of the field to find.
708  *
709  * @return A pointer to the first element in the field if found. The first
710  * element being the length of the field followed by the value of the field.
711  * @return NULL if the field is not present in the payload.
712  */
713  const uint8_t* findField(DataType_t type) const
714  {
715  /* Scan through advertisement data */
716  for (uint8_t idx = 0; idx < _payloadLen; ) {
717  uint8_t fieldType = _payload[idx + 1];
718 
719  if (fieldType == type) {
720  return &_payload[idx];
721  }
722 
723  /* Advance to next field */
724  idx += _payload[idx] + 1;
725  }
726 
727  /* Field not found */
728  return NULL;
729  }
730 
731 private:
732  /**
733  * Append advertising data based on the specified type.
734  *
735  * @param[in] advDataType Type of the new data.
736  * @param[in] payload Pointer to the data to be appended to the advertising
737  * payload.
738  * @param[in] len Length of the data pointed to by @p payload.
739  *
740  * @return BLE_ERROR_NONE on success.
741  * @return BLE_ERROR_BUFFER_OVERFLOW if the specified data would cause the
742  * advertising buffer to overflow.
743  */
744  ble_error_t appendField(DataType advDataType, const uint8_t *payload, uint8_t len)
745  {
746  /* Make sure we don't exceed the 31-byte payload limit */
747  if (_payloadLen + len + 2 > GAP_ADVERTISING_DATA_MAX_PAYLOAD) {
749  }
750 
751  /* Field length. */
752  memset(&_payload[_payloadLen], len + 1, 1);
753  _payloadLen++;
754 
755  /* Field ID. */
756  memset(&_payload[_payloadLen], (uint8_t)advDataType, 1);
757  _payloadLen++;
758 
759  /* Payload. */
760  memcpy(&_payload[_payloadLen], payload, len);
761  _payloadLen += len;
762 
763  return BLE_ERROR_NONE;
764  }
765 
766  /**
767  * Search advertisement data for a specific field.
768  *
769  * @param[in] type The type of the field to find.
770  *
771  * @return A pointer to the first element in the field if found. The first
772  * element being the length of the field followed by the value of the field.
773  * @return NULL if the field is not present in the payload.
774  */
775  uint8_t* findField(DataType_t type)
776  {
777  return const_cast<uint8_t*>(
778  static_cast<const GapAdvertisingData*>(this)->findField(type)
779  );
780  }
781 
782  /**
783  * Update in place the value of a field in the advertising payload.
784  *
785  * @param[in] advDataType Type of the new data.
786  * @param[in] payload Pointer to the data to be added to the advertising
787  * payload.
788  * @param[in] len Length of the data pointed to by @p payload.
789  * @param[in] field Pointer to the field of type @p advDataType in the
790  * advertising buffer.
791  *
792  * @note When the specified AD type is INCOMPLETE_LIST_16BIT_SERVICE_IDS,
793  * COMPLETE_LIST_16BIT_SERVICE_IDS, INCOMPLETE_LIST_32BIT_SERVICE_IDS,
794  * COMPLETE_LIST_32BIT_SERVICE_IDS, INCOMPLETE_LIST_128BIT_SERVICE_IDS,
795  * COMPLETE_LIST_128BIT_SERVICE_IDS or LIST_128BIT_SOLICITATION_IDS, the
796  * supplied value is appended to the values previously added to the
797  * payload.
798  *
799  * @return BLE_ERROR_NONE on success.
800  */
801  ble_error_t addField(
802  DataType_t advDataType,
803  const uint8_t *payload,
804  uint8_t len,
805  uint8_t* field
806  ) {
808 
809  switch(advDataType) {
810  /* These fields have the new data appended if there is sufficient space. */
818  /* Check if data fits */
819  if ((_payloadLen + len) <= GAP_ADVERTISING_DATA_MAX_PAYLOAD) {
820  /*
821  * Make room for new field by moving the remainder of the
822  * advertisement payload "to the right" starting after the
823  * TYPE field.
824  */
825  uint8_t* end = &_payload[_payloadLen];
826 
827  while (&field[1] < end) {
828  end[len] = *end;
829  end--;
830  }
831 
832  /* Insert new data */
833  for (uint8_t idx = 0; idx < len; idx++) {
834  field[2 + idx] = payload[idx];
835  }
836 
837  /* Increment lengths */
838  field[0] += len;
839  _payloadLen += len;
840 
841  result = BLE_ERROR_NONE;
842  }
843 
844  break;
845  }
846  /* These fields are overwritten with the new value */
847  default: {
848  result = updateField(advDataType, payload, len, field);
849 
850  break;
851  }
852  }
853 
854  return result;
855  }
856 
857  /**
858  * Update in place the value of a field in the advertising payload.
859  *
860  * @param[in] advDataType Type of the new data.
861  * @param[in] payload Pointer to the data to be added to the advertising
862  * payload.
863  * @param[in] len Length of the data pointed to by @p payload.
864  * @param[in] field Pointer to the field of type @p advDataType in the
865  * advertising buffer.
866  *
867  * @return BLE_ERROR_NONE on success.
868  */
869  ble_error_t updateField(
870  DataType_t advDataType,
871  const uint8_t *payload,
872  uint8_t len,
873  uint8_t* field
874  ) {
876  uint8_t dataLength = field[0] - 1;
877 
878  /* New data has same length, do in-order replacement */
879  if (len == dataLength) {
880  for (uint8_t idx = 0; idx < dataLength; idx++) {
881  field[2 + idx] = payload[idx];
882  }
883 
884  result = BLE_ERROR_NONE;
885  } else {
886  /* Check if data fits */
887  if ((_payloadLen - dataLength + len) <= GAP_ADVERTISING_DATA_MAX_PAYLOAD) {
888 
889  /* Remove old field */
890  while ((field + dataLength + 2) < &_payload[_payloadLen]) {
891  *field = field[dataLength + 2];
892  field++;
893  }
894 
895  /* Reduce length */
896  _payloadLen -= dataLength + 2;
897 
898  /* Add new field */
899  result = appendField(advDataType, payload, len);
900  }
901  }
902 
903  return result;
904  }
905 
906  /**
907  * Advertising data buffer.
908  */
909  uint8_t _payload[GAP_ADVERTISING_DATA_MAX_PAYLOAD];
910 
911  /**
912  * Length of the data added to the advertising buffer.
913  */
914  uint8_t _payloadLen;
915 
916  /**
917  * Appearance value.
918  */
919  uint16_t _appearance;
920 };
921 
922 /**
923  * @}
924  * @}
925  */
926 
927 
928 #endif /* ifndef MBED_GAP_ADVERTISING_DATA__LEGACY_H__ */
Outdoor Location and Navigation Display Device.
Peripheral device is discoverable for a limited period of time.
Complete list of 32-bit Service IDs (not relevant for Bluetooth 4.0).
Peripheral device is discoverable at any moment.
uint16_t getAppearance(void) const
Get the appearance set.
uint8_t getPayloadLen(void) const
Get the payload length.
ble_error_t updateData(DataType_t advDataType, const uint8_t *payload, uint8_t len)
Update a specific field in the advertising payload.
Appearance, refer to GapAdvertisingData::Appearance_t.
ble_error_t addData(DataType_t advDataType, const uint8_t *payload, uint8_t len)
Adds a new field into the payload.
No error.
Definition: blecommon.h:151
GAP advertising data builder.
Incomplete list of 32-bit Service IDs (not relevant for Bluetooth 4.0).
const uint8_t * findField(DataType_t type) const
Search advertisement data for a specific field.
Appearance_t
Enumeration of values for the DataType_t::APPEARANCE.
Peripheral device is LE only and does not support Bluetooth Enhanced DataRate.
Flags_t
Enumeration of allowed flags for DataType_t::FLAGS.
enum Appearance_t Appearance
Alias for GapAdvertisingData::Appearance_t.
Unknown error.
Definition: blecommon.h:207
ble_error_t addTxPower(int8_t txPower)
Add the advertising TX in the advertising payload.
enum DataType_t DataType
Alias for GapAdvertisingData::DataType_t.
List of 128-bit service UUIDs the device is looking for.
ble_error_t addAppearance(Appearance appearance=GENERIC_TAG)
Add device appearance in the advertising payload.
const uint8_t * getPayload(void) const
Get the pointer to the advertising payload bytes.
enum Flags_t Flags
Alias for GapAdvertisingData::Flags_t.
Unknown or unspecified appearance type.
The requested action would cause a buffer overflow and has been aborted.
Definition: blecommon.h:156
Flags, refer to GapAdvertisingData::Flags_t.
GapAdvertisingData(void)
Construct a GapAdvertising instance with an empty payload.
Incomplete list of 128-bit Service IDs.
ble_error_t addFlags(uint8_t flags=LE_GENERAL_DISCOVERABLE)
Add BLE flags in the advertising payload.
void clear(void)
Clears the advertising data payload.
ble_error_t
Error codes for the BLE API.
Definition: blecommon.h:147
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.