Mistake on this page?
Report an issue in GitHub or email us
BLETypes.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2017-2017 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 BLE_TYPES_H_
18 #define BLE_TYPES_H_
19 
20 #include <stddef.h>
21 #include <stdint.h>
22 #include <string.h>
23 #include "ble/SafeEnum.h"
24 #include "ble/ArrayView.h"
25 #include "ble/gap/Types.h"
26 
27 /**
28  * @addtogroup ble
29  * @{
30  * @addtogroup common
31  * @{
32  */
33 
34 namespace ble {
35 
36 /** Special advertising set handle used for the legacy advertising set. */
38 
39 /** Special advertising set handle used as return or parameter to signify an invalid handle. */
41 
42 /** Maximum advertising data length that can fit in a legacy PDU. */
43 static const uint8_t LEGACY_ADVERTISING_MAX_SIZE = 0x1F;
44 
45 /** Features supported by the controller.
46  * @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 6, Part B - 4.6 */
47 struct controller_supported_features_t : SafeEnum<controller_supported_features_t, uint8_t> {
48  enum type {
49  LE_ENCRYPTION = 0,
50  CONNECTION_PARAMETERS_REQUEST_PROCEDURE,
51  EXTENDED_REJECT_INDICATION,
52  SLAVE_INITIATED_FEATURES_EXCHANGE,
53  LE_PING,
54  LE_DATA_PACKET_LENGTH_EXTENSION,
55  LL_PRIVACY,
56  EXTENDED_SCANNER_FILTER_POLICIES,
57  LE_2M_PHY,
58  STABLE_MODULATION_INDEX_TRANSMITTER,
59  STABLE_MODULATION_INDEX_RECEIVER,
60  LE_CODED_PHY,
61  LE_EXTENDED_ADVERTISING,
62  LE_PERIODIC_ADVERTISING,
63  CHANNEL_SELECTION_ALGORITHM_2,
64  LE_POWER_CLASS
65  };
66 
67  /**
68  * Construct a new instance of ControllerSupportedFeatures_t.
69  */
71 };
72 
73 /**
74  * Opaque reference to a connection.
75  *
76  * Internally a connection handle is an unsigned integer capable of holding a
77  * pointer.
78  *
79  * The real type (either a pointer to an object or an integer) is opaque for
80  * users and platform dependent.
81  */
82 typedef uintptr_t connection_handle_t;
83 
84 /**
85  * Reference to an attribute in a GATT database.
86  */
87 typedef uint16_t attribute_handle_t;
88 
89  /**
90  * Inclusive range of GATT attributes handles.
91  *
92  * @note Instances can be constructed with the help of the factory function
93  * attribute_handle_range().
94  */
96  /**
97  * Beginning of the range.
98  */
99  attribute_handle_t begin;
100 
101  /**
102  * End of the range.
103  */
104  attribute_handle_t end;
105 
106  /**
107  * Equal operator for attribute_handle_range_t.
108  *
109  * @param[in] lhs Left hand side of the expression.
110  * @param[in] rhs Right hand side of the expression.
111  *
112  * @return true if lhs is equal to rhs and false otherwise.
113  */
114  friend bool operator==(
116  ) {
117  return (lhs.begin == rhs.begin) && (lhs.end == rhs.end);
118  }
119 
120  /**
121  * Not equal operator for attribute_handle_range_t.
122  *
123  * @param[in] lhs Left hand side of the expression.
124  * @param[in] rhs Right hand side of the expression.
125  *
126  * @return true if lhs is not equal to rhs and false otherwise.
127  */
128  friend bool operator!=(
130  ) {
131  return !(lhs == rhs);
132  }
133 };
134 
135 
136 /**
137  * Construct an attribute_handle_range_t from its first and last attribute handle.
138  *
139  * @param[in] begin Handle at the beginning of the range.
140  * @param[in] end Handle at the end of the range.
141  *
142  * @return An instance of attribute_handle_range_t where
143  * attribute_handle_range_t::begin is equal to begin and
144  * attribute_handle_range_t::end is equal to end.
145  *
146  * @note This function is defined instead of a constructor to keep "POD-ness"
147  * of attribute_handle_range_t.
148  */
150  attribute_handle_t begin,
151  attribute_handle_t end
152 ) {
153  attribute_handle_range_t result = {
154  begin,
155  end
156  };
157  return result;
158 }
159 
160 /**
161  * Type that describes link's encryption state.
162  */
163 struct link_encryption_t : SafeEnum<link_encryption_t, uint8_t> {
164  /** struct scoped enum wrapped by the class */
165  enum type {
166  NOT_ENCRYPTED, /**< The link is not secured. */
167  ENCRYPTION_IN_PROGRESS, /**< Link security is being established. */
168  ENCRYPTED, /**< The link is secure. */
169  ENCRYPTED_WITH_MITM, /**< The link is secure and authenticated. */
170  ENCRYPTED_WITH_SC_AND_MITM /**< The link is secure and authenticated with a secure connection key. */
171  };
172 
173  /**
174  * Construct a new instance of link_encryption_t.
175  */
177 };
178 
179 /**
180  * Type that describe a pairing failure.
181  */
182 struct pairing_failure_t : SafeEnum<pairing_failure_t, uint8_t> {
183  /** struct scoped enum wrapped by the class */
184  enum type {
185  PASSKEY_ENTRY_FAILED = 0x01,
186  OOB_NOT_AVAILABLE = 0x02,
187  AUTHENTICATION_REQUIREMENTS = 0x03,
188  CONFIRM_VALUE_FAILED = 0x04,
189  PAIRING_NOT_SUPPORTED = 0x05,
190  ENCRYPTION_KEY_SIZE = 0x06,
191  COMMAND_NOT_SUPPORTED = 0x07,
192  UNSPECIFIED_REASON = 0x08,
193  REPEATED_ATTEMPTS = 0x09,
194  INVALID_PARAMETERS = 0x0A,
195  DHKEY_CHECK_FAILED = 0x0B,
196  NUMERIC_COMPARISON_FAILED = 0x0c,
197  BR_EDR_PAIRING_IN_PROGRESS = 0x0D,
198  CROSS_TRANSPORT_KEY_DERIVATION_OR_GENERATION_NOT_ALLOWED = 0x0E
199  };
200 
201  /**
202  * Construct a new instance of pairing_failure_t.
203  */
205 };
206 
207 
208 /**
209  * Type that describe the IO capability of a device; it is used during Pairing
210  * Feature exchange.
211  */
212 struct io_capability_t : SafeEnum<io_capability_t, uint8_t> {
213  enum type {
214  DISPLAY_ONLY = 0x00,
215  DISPLAY_YES_NO = 0x01,
216  KEYBOARD_ONLY = 0x02,
217  NO_INPUT_NO_OUTPUT = 0x03,
218  KEYBOARD_DISPLAY = 0x04
219  };
220 
221  /**
222  * Construct a new instance of io_capability_t.
223  */
224  io_capability_t(type value) : SafeEnum<io_capability_t, uint8_t>(value) { }
225 };
226 
227 /**
228  * Passkey stored as a number.
229  */
230 typedef uint32_t passkey_num_t;
231 
232 /**
233  * Passkey stored as a string of digits.
234  */
236 public:
237  static const uint8_t PASSKEY_LEN = 6;
238  static const uint8_t NUMBER_OFFSET = '0';
239 
240  /**
241  * Default to all zeroes
242  */
244  memset(ascii, NUMBER_OFFSET, PASSKEY_LEN);
245  }
246 
247  /**
248  * Initialize a data from a string.
249  *
250  * @param[in] passkey value of the data.
251  */
252  PasskeyAscii(const uint8_t* passkey) {
253  if (passkey) {
254  memcpy(ascii, passkey, PASSKEY_LEN);
255  } else {
256  memset(ascii, NUMBER_OFFSET, PASSKEY_LEN);
257  }
258  }
259 
260  /**
261  * Initialize a data from a number.
262  *
263  * @param[in] passkey value of the data.
264  */
265  PasskeyAscii(passkey_num_t passkey) {
266  for (int i = 5, m = 100000; i >= 0; --i, m /= 10) {
267  uint32_t result = passkey / m;
268  ascii[i] = NUMBER_OFFSET + result;
269  passkey -= result * m;
270  }
271  }
272 
273  /**
274  * Cast to number.
275  */
276  operator passkey_num_t() {
277  return to_num(ascii);
278  }
279 
280  /**
281  * Convert ASCII string of digits into a number.
282  * @param[in] ascii ASCII string of 6 digits stored as ASCII characters
283  * @return Passkey as a number.
284  */
285  static uint32_t to_num(const uint8_t *ascii) {
286  uint32_t passkey = 0;
287  for (size_t i = 0, m = 1; i < PASSKEY_LEN; ++i, m *= 10) {
288  passkey += (ascii[i] - NUMBER_OFFSET) * m;
289  }
290  return passkey;
291  }
292 
293  /**
294  * Return the pointer to the buffer holding the string.
295  */
296  uint8_t* value() {
297  return ascii;
298  }
299 private:
300  uint8_t ascii[PASSKEY_LEN];
301 };
302 
303 /**
304  * Returns true if every byte is equal to zero
305  */
306 template <class byte_array_class>
307 bool is_all_zeros(byte_array_class &byte_array) {
308  for (size_t i = 0; i < byte_array.size(); i++) {
309  if (byte_array[i] != 0) {
310  return false;
311  }
312  }
313  return true;
314 }
315 
316 /**
317  * Zero out all bytes
318  */
319 template <class byte_array_class>
320 void set_all_zeros(byte_array_class &byte_array) {
321  memset(&byte_array[0], 0x00, byte_array.size());
322 }
323 
324 /**
325  * Model fixed size array values.
326  * @tparam array_size The size of the array.
327  */
328 template <size_t array_size>
329 struct byte_array_t {
330  /**
331  * Size of the array; accessible at compile time.
332  */
333  static const size_t size_ = array_size;
334 
335  /**
336  * Default to all zeroes
337  */
339  memset(_value, 0x00, sizeof(_value));
340  }
341 
342  /**
343  * Initialize a data from an array of bytes.
344  *
345  * @param[in] input_value value of the data.
346  */
347  byte_array_t(const uint8_t *input_value) {
348  memcpy(_value, input_value, sizeof(_value));
349  }
350 
351  /**
352  * Initialize a data from an buffer of bytes.
353  *
354  * @param[in] input_value pointer to buffer.
355  * @param[in] size buffer size
356  */
357  byte_array_t(const uint8_t* input_value, size_t size) {
358  memcpy(_value, input_value, size);
359  }
360 
361  /**
362  * Equal operator between two octet types.
363  */
364  friend bool operator==(const byte_array_t& lhs, const byte_array_t& rhs) {
365  return memcmp(lhs._value, rhs._value, sizeof(lhs._value)) == 0;
366  }
367 
368  /**
369  * Non equal operator between two octet types.
370  */
371  friend bool operator!=(const byte_array_t& lhs, const byte_array_t& rhs) {
372  return !(lhs == rhs);
373  }
374 
375  /**
376  * Subscript operator to access data content
377  */
378  uint8_t& operator[](size_t i) {
379  return _value[i];
380  }
381 
382  /**
383  * Subscript operator to access data content
384  */
385  uint8_t operator[](size_t i) const {
386  return _value[i];
387  }
388 
389  /**
390  * Return the pointer to the buffer holding data.
391  */
392  const uint8_t* data() const {
393  return _value;
394  }
395 
396  /**
397  * Return the pointer to the buffer holding data.
398  */
399  uint8_t* data() {
400  return _value;
401  }
402 
403  /**
404  * Size in byte of a data.
405  */
406  static size_t size() {
407  return array_size;
408  }
409 
410 protected:
411  uint8_t _value[array_size];
412 };
413 
414 /**
415  * Construct a fixed size ArrayView from a byte_array_t.
416  *
417  * @param src byte_array_t to create a view from.
418  *
419  * @return An ArrayView to @p src.
420  */
421 template<size_t Size>
423 {
424  return ArrayView<uint8_t, Size>(src.data(), src.size());
425 }
426 
427 /**
428  * Construct a fixed size ArrayView from a const byte_array_t.
429  *
430  * @param src byte_array_t to create a view from.
431  *
432  * @return An ArrayView to @p src.
433  */
434 template<size_t Size>
436 {
437  return ArrayView<const uint8_t, Size>(src.data(), src.size());
438 }
439 
440 /** 128 bit keys used by paired devices */
442 typedef byte_array_t<16> csrk_t;
443 typedef byte_array_t<16> ltk_t;
444 
445 /** Used to identify LTK for legacy pairing connections */
447 typedef byte_array_t<8> rand_t;
448 
449 /** Out of band data exchanged during pairing */
450 typedef byte_array_t<16> oob_tk_t; /**< legacy pairing TK */
451 typedef byte_array_t<16> oob_lesc_value_t; /**< secure connections oob random 128 value */
452 typedef byte_array_t<16> oob_confirm_t; /**< secure connections oob confirmation value */
453 
454 /** data to be encrypted */
456 
457 /** public key coordinate, two of which define the public key */
459 
460 /** Diffie-Hellman key */
462 
463 /** counter for signed data writes done by GattClient */
464 typedef uint32_t sign_count_t;
465 
466 /**
467  * MAC address data type.
468  */
469 struct address_t : public byte_array_t<6> {
470  /**
471  * Create an invalid mac address, equal to 00:00:00:00:00:00
472  */
474  memset(_value, 0x00, sizeof(_value));
475  }
476 
477  /**
478  * Initialize a data from an array of bytes.
479  *
480  * @param[in] input_value value of the data.
481  */
482  address_t(const uint8_t *input_value) {
483  memcpy(_value, input_value, sizeof(_value));
484  }
485 };
486 
487 /**
488  * Type that describes a random device address type.
489  */
490 struct random_address_type_t : SafeEnum<random_address_type_t, uint8_t> {
491  /** struct scoped enum wrapped by the class */
492  enum type {
493  STATIC, /**< Random static device address. */
494  NON_RESOLVABLE_PRIVATE, /**< Random non resolvable private address. */
495  RESOLVABLE_PRIVATE /**< Random resolvable private address. */
496  };
497 
498  /**
499  * Construct a new instance of random_address_type_t.
500  */
502  SafeEnum<random_address_type_t, uint8_t>(value) { }
503 };
504 
505 /**
506  * Security requirement that can be attached to an attribute operation.
507  */
508 struct att_security_requirement_t : SafeEnum<att_security_requirement_t, uint8_t> {
509  /**
510  * Number of bits required to store the value.
511  *
512  * This value can be used to define a bitfield that host a value of this
513  * enum.
514  */
515  static const uint8_t size = 2;
516 
517  /** struct scoped enum wrapped by the class */
518  enum type {
519  /**
520  * The operation does not have security requirements.
521  *
522  * It is equivalent to: SecurityMode 1 level 1: No authentication, no
523  * encryption and no signing required.
524  *
525  * @note This security mode is not applicable for signed operation.
526  *
527  * @note Equivalent to SecurityManager::SECURITY_MODE_ENCRYPTION_OPEN_LINK.
528  */
530 
531  /**
532  * The operation requires security and there's no requirement towards
533  * peer authentication.
534  *
535  * @note Security can be achieved either by signing messages or
536  * encrypting the link.
537  *
538  * @note Signing is only applicable for signed write operations.
539  *
540  * @note Equivalent to SecurityManager::SECURITY_MODE_ENCRYPTION_NO_MITM
541  * or SecurityManager::SECURITY_MODE_SIGNED_NO_MITM.
542  */
544 
545  /**
546  * The operation requires security and the peer must be authenticated.
547  *
548  * @note Security can be achieved either by signing messages or
549  * encrypting the link.
550  *
551  * @note Equivalent to SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM
552  * or SecurityManager::SECURITY_MODE_SIGNED_WITH_MITM.
553  */
555 
556  /**
557  * The operation require encryption with an authenticated peer that
558  * paired using secure connection pairing.
559  *
560  * @note This security mode is not applicable for signed operation;
561  * security is achieved with link encryption.
562  */
563  SC_AUTHENTICATED
564  };
565 
566  /**
567  * Construct a new instance of att_security_requirement_t.
568  */
570  SafeEnum<att_security_requirement_t, uint8_t>(value) { }
571 };
572 
573 /**
574  * Type that describes a peer device address type.
575  */
576 struct peer_address_type_t :SafeEnum<peer_address_type_t, uint8_t> {
577  /** struct scoped enum wrapped by the class */
578  enum type {
579  /**
580  * Public device address.
581  */
582  PUBLIC = 0,
583 
584  /**
585  * Random address.
586  *
587  * Use Gap::getRandomAddressType to retrieve the type of the random
588  * address.
589  */
591 
592  /**
593  * A Public address used as a device identity address.
594  */
596 
597  /**
598  * A Random static address used as a device identity address.
599  */
601 
602  /**
603  * No address provided (anonymous advertisement).
604  */
605  ANONYMOUS = 0xFF
606  };
607 
608  /**
609  * Construct a new instance of peer_address_type_t.
610  */
612  SafeEnum<peer_address_type_t, uint8_t>(value) { }
613 
614  /**
615  * Default initialization of peer_address_type_t.
616  */
618  SafeEnum<peer_address_type_t, uint8_t>(PUBLIC) { }
619 };
620 
621 /**
622  * Type that describes a bluetooth PHY(sical) transport.
623  */
624 struct phy_t : SafeEnum<phy_t, uint8_t> {
625  /** struct scoped enum wrapped by the class */
626  enum type {
627  /**
628  * No phy selected.
629  *
630  * @note This value can be used to indicate the absence of phy
631  */
632  NONE = 0,
633 
634  /**
635  * 1Mbit/s LE.
636  *
637  * @note This physical transport was available since Bluetooth 4.0
638  */
639  LE_1M = 1,
640 
641  /**
642  * 2Mbit/s LE.
643  *
644  * Modulation is similar to LE_1M but differs in rate. Therefore range
645  * performances are in the same ballpark as LE_1M while the increased rate
646  * minimize time spent to transfer or receive a packet which leads to a
647  * better power consumption and/or faster transfer.
648  *
649  * @note This transport has been introduced with the Bluetooth 5.
650  * @note When operating at 2Mbit/s range is not exactly identical to the
651  * range at 1Mbit/s due to a loss in sensitivity.
652  */
653  LE_2M = 2,
654 
655  /**
656  * LE Coded PHY.
657  *
658  * This transport reuse the 1Mbit/s channel with different coding schemes.
659  * Either two (S=2) or eight (S=8) symbols can be used to represent a
660  * bit while the 1Mbit/s transport use 1 symbol to code 1 bit of data.
661  *
662  * Here is the data rate of the two coding schemes:
663  * - S=2: 500kbit/s
664  * - S=8: 125kbit/s
665  *
666  * The goal of the coded PHY is to increase the range of BLE devices.
667  * Of course given it takes more time to transfer data, transmission
668  * and reception last longer which leads to an increase in power
669  * consumption.
670  *
671  * @note This transport has been introduced with the Bluetooth 5.
672  */
673  LE_CODED
674  };
675 
676  /**
677  * Construct a new instance of phy_t.
678  */
680  SafeEnum<phy_t, uint8_t>(value) { }
681 
682  explicit phy_t(uint8_t raw_value) : SafeEnum(raw_value) { }
683 };
684 
685 /**
686  * Type that describe a set of PHY(sical) transports. This is used to
687  * indicate preference for the PHY transports set within it.
688  */
689 class phy_set_t {
690 public:
691  enum PhysFlags_t {
692  PHY_SET_1M = 0x01,
693  PHY_SET_2M = 0x02,
694  PHY_SET_CODED = 0x04
695  };
696 
697  /**
698  * Create set that indicates no preference.
699  */
700  phy_set_t() : _value(0) { }
701 
702  /**
703  * Create a set based on the mask specified in the Bluetooth spec.
704  *
705  * @param value Octet containing the set of preferred PHYs
706  */
707  phy_set_t(uint8_t value) : _value(value) { }
708 
709  /**
710  * Create a set based on individual settings.
711  *
712  * @param phy_1m Prefer LE 1M
713  * @param phy_2m Prefer LE 2M if avaiable
714  * @param phy_coded Prefer coded modulation if avaiable
715  */
716  phy_set_t(bool phy_1m, bool phy_2m, bool phy_coded) :
717  _value()
718  {
719  set_1m(phy_1m);
720  set_2m(phy_2m);
721  set_coded(phy_coded);
722  }
723 
724  /**
725  * Create a set from a single phy.
726  *
727  * @param phy The phy to add to the set.
728  */
729  phy_set_t(phy_t phy) : _value()
730  {
731  switch (phy.value()) {
732  case phy_t::LE_1M:
733  set_1m(true);
734  break;
735  case phy_t::LE_2M:
736  set_2m(true);
737  break;
738  case phy_t::LE_CODED:
739  set_coded(true);
740  break;
741  default:
742  break;
743  }
744  }
745 
746  /** Prefer 1M PHY. */
747  void set_1m(bool enabled = true) {
748  if (enabled) {
749  _value |= PHY_SET_1M;
750  } else {
751  _value &= ~PHY_SET_1M;
752  }
753  }
754 
755  /** Prefer 2M PHY. */
756  void set_2m(bool enabled = true) {
757  if (enabled) {
758  _value |= PHY_SET_2M;
759  } else {
760  _value &= ~PHY_SET_2M;
761  }
762  }
763 
764  /** Prefer coded PHY. */
765  void set_coded(bool enabled = true) {
766  if (enabled) {
767  _value |= PHY_SET_CODED;
768  } else {
769  _value &= ~PHY_SET_CODED;
770  }
771  }
772 
773  bool get_1m() const {
774  return (_value & PHY_SET_1M);
775  }
776 
777  bool get_2m() const {
778  return (_value & PHY_SET_2M);
779  }
780 
781  bool get_coded() const {
782  return (_value & PHY_SET_CODED);
783  }
784 
785  operator uint8_t() const {
786  return _value;
787  }
788 
789  uint8_t value() const {
790  return _value;
791  }
792 
793  uint8_t count() const {
794  return (get_1m() ? 1 : 0) + (get_2m() ? 1 : 0) + (get_coded() ? 1 : 0);
795  }
796 
797 private:
798  uint8_t _value;
799 };
800 
801 /**
802  * Type describing the number of symbols per bit in le coded PHY.
803  */
804 struct coded_symbol_per_bit_t :SafeEnum<coded_symbol_per_bit_t, uint8_t> {
805  /** struct scoped enum wrapped by the class */
806  enum type {
807  /**
808  * The Number of symbol used to code a bit is undefined.
809  */
811 
812  /**
813  * Two symbols to code a bit.
814  */
815  S2,
816 
817  /**
818  * Eight symbols to code a bit.
819  */
820  S8
821  };
822 
823  /**
824  * Construct a new instance of coded_symbol_per_bit_t.
825  */
827  SafeEnum<coded_symbol_per_bit_t, uint8_t>(value) { }
828 };
829 
830 } // namespace ble
831 
832 /**
833  * @}
834  * @}
835  */
836 
837 #endif /* BLE_TYPES_H_ */
static const advertising_handle_t INVALID_ADVERTISING_HANDLE
Special advertising set handle used as return or parameter to signify an invalid handle.
Definition: BLETypes.h:40
type
struct scoped enum wrapped by the class
Definition: BLETypes.h:626
byte_array_t(const uint8_t *input_value)
Initialize a data from an array of bytes.
Definition: BLETypes.h:347
byte_array_t< 32 > dhkey_t
Diffie-Hellman key.
Definition: BLETypes.h:461
ArrayView< T, Size > make_ArrayView(T(&elements)[Size])
Generate an array view from a reference to a C/C++ array.
Definition: ArrayView.h:336
byte_array_t()
Default to all zeroes.
Definition: BLETypes.h:338
phy_set_t(uint8_t value)
Create a set based on the mask specified in the Bluetooth spec.
Definition: BLETypes.h:707
address_t(const uint8_t *input_value)
Initialize a data from an array of bytes.
Definition: BLETypes.h:482
pairing_failure_t(type value)
Construct a new instance of pairing_failure_t.
Definition: BLETypes.h:204
uintptr_t connection_handle_t
Opaque reference to a connection.
Definition: BLETypes.h:82
random_address_type_t(type value)
Construct a new instance of random_address_type_t.
Definition: BLETypes.h:501
friend bool operator==(const attribute_handle_range_t &lhs, const attribute_handle_range_t &rhs)
Equal operator for attribute_handle_range_t.
Definition: BLETypes.h:114
address_t()
Create an invalid mac address, equal to 00:00:00:00:00:00.
Definition: BLETypes.h:473
friend bool operator==(const byte_array_t &lhs, const byte_array_t &rhs)
Equal operator between two octet types.
Definition: BLETypes.h:364
coded_symbol_per_bit_t(type value)
Construct a new instance of coded_symbol_per_bit_t.
Definition: BLETypes.h:826
Type that describes a random device address type.
Definition: BLETypes.h:490
Model fixed size array values.
Definition: BLETypes.h:329
const uint8_t * data() const
Return the pointer to the buffer holding data.
Definition: BLETypes.h:392
uint8_t * data()
Return the pointer to the buffer holding data.
Definition: BLETypes.h:399
Type describing the number of symbols per bit in le coded PHY.
Definition: BLETypes.h:804
Security requirement that can be attached to an attribute operation.
Definition: BLETypes.h:508
Immutable view to an array.
Definition: ArrayView.h:70
The Number of symbol used to code a bit is undefined.
Definition: BLETypes.h:810
The operation requires security and there&#39;s no requirement towards peer authentication.
Definition: BLETypes.h:543
Inclusive range of GATT attributes handles.
Definition: BLETypes.h:95
byte_array_t< 16 > encryption_block_t
data to be encrypted
Definition: BLETypes.h:455
phy_set_t()
Create set that indicates no preference.
Definition: BLETypes.h:700
peer_address_type_t(type value)
Construct a new instance of peer_address_type_t.
Definition: BLETypes.h:611
uint8_t value() const
Explicit access to the inner value of the SafeEnum instance.
Definition: SafeEnum.h:202
uint8_t & operator[](size_t i)
Subscript operator to access data content.
Definition: BLETypes.h:378
The operation does not have security requirements.
Definition: BLETypes.h:529
peer_address_type_t()
Default initialization of peer_address_type_t.
Definition: BLETypes.h:617
type
struct scoped enum wrapped by the class
Definition: BLETypes.h:518
LE Coded PHY.
Definition: BLETypes.h:673
A Random static address used as a device identity address.
Definition: BLETypes.h:600
Helper class used to define safe enumerations.
Definition: SafeEnum.h:109
byte_array_t(const uint8_t *input_value, size_t size)
Initialize a data from an buffer of bytes.
Definition: BLETypes.h:357
SafeEnum(uint8_t value)
Construction of an enumeration value.
Definition: SafeEnum.h:119
controller_supported_features_t(type value)
Construct a new instance of ControllerSupportedFeatures_t.
Definition: BLETypes.h:70
void set_2m(bool enabled=true)
Prefer 2M PHY.
Definition: BLETypes.h:756
Passkey stored as a string of digits.
Definition: BLETypes.h:235
type
struct scoped enum wrapped by the class
Definition: BLETypes.h:184
byte_array_t< 16 > oob_tk_t
Out of band data exchanged during pairing.
Definition: BLETypes.h:450
static const advertising_handle_t LEGACY_ADVERTISING_HANDLE
Special advertising set handle used for the legacy advertising set.
Definition: BLETypes.h:37
MAC address data type.
Definition: BLETypes.h:469
void set_all_zeros(byte_array_class &byte_array)
Zero out all bytes.
Definition: BLETypes.h:320
attribute_handle_t end
End of the range.
Definition: BLETypes.h:104
type
struct scoped enum wrapped by the class
Definition: BLETypes.h:806
PasskeyAscii(passkey_num_t passkey)
Initialize a data from a number.
Definition: BLETypes.h:265
Type that describes a bluetooth PHY(sical) transport.
Definition: BLETypes.h:624
io_capability_t(type value)
Construct a new instance of io_capability_t.
Definition: BLETypes.h:224
type
struct scoped enum wrapped by the class
Definition: BLETypes.h:492
Random non resolvable private address.
Definition: BLETypes.h:494
static const uint8_t LEGACY_ADVERTISING_MAX_SIZE
Maximum advertising data length that can fit in a legacy PDU.
Definition: BLETypes.h:43
byte_array_t< 32 > public_key_coord_t
public key coordinate, two of which define the public key
Definition: BLETypes.h:458
attribute_handle_t begin
Beginning of the range.
Definition: BLETypes.h:99
uint8_t advertising_handle_t
Handle of an advertising set.
Definition: Types.h:134
PasskeyAscii(const uint8_t *passkey)
Initialize a data from a string.
Definition: BLETypes.h:252
ArrayView< const T, Size > make_const_ArrayView(T(&elements)[Size])
Generate a const array view from a reference to a C/C++ array.
Definition: ArrayView.h:392
Two symbols to code a bit.
Definition: BLETypes.h:815
uint8_t operator[](size_t i) const
Subscript operator to access data content.
Definition: BLETypes.h:385
byte_array_t< 16 > oob_lesc_value_t
secure connections oob random 128 value
Definition: BLETypes.h:451
static size_t size()
Size in byte of a data.
Definition: BLETypes.h:406
friend bool operator!=(const attribute_handle_range_t &lhs, const attribute_handle_range_t &rhs)
Not equal operator for attribute_handle_range_t.
Definition: BLETypes.h:128
phy_t(type value)
Construct a new instance of phy_t.
Definition: BLETypes.h:679
uint32_t sign_count_t
counter for signed data writes done by GattClient
Definition: BLETypes.h:464
Type that describes a peer device address type.
Definition: BLETypes.h:576
friend bool operator!=(const byte_array_t &lhs, const byte_array_t &rhs)
Non equal operator between two octet types.
Definition: BLETypes.h:371
Type that describe a set of PHY(sical) transports.
Definition: BLETypes.h:689
A Public address used as a device identity address.
Definition: BLETypes.h:595
byte_array_t< 2 > ediv_t
Used to identify LTK for legacy pairing connections.
Definition: BLETypes.h:446
phy_set_t(bool phy_1m, bool phy_2m, bool phy_coded)
Create a set based on individual settings.
Definition: BLETypes.h:716
2Mbit/s LE.
Definition: BLETypes.h:653
1Mbit/s LE.
Definition: BLETypes.h:639
att_security_requirement_t(type value)
Construct a new instance of att_security_requirement_t.
Definition: BLETypes.h:569
bool is_all_zeros(byte_array_class &byte_array)
Returns true if every byte is equal to zero.
Definition: BLETypes.h:307
static attribute_handle_range_t attribute_handle_range(attribute_handle_t begin, attribute_handle_t end)
Construct an attribute_handle_range_t from its first and last attribute handle.
Definition: BLETypes.h:149
type
struct scoped enum wrapped by the class
Definition: BLETypes.h:578
The operation requires security and the peer must be authenticated.
Definition: BLETypes.h:554
void set_1m(bool enabled=true)
Prefer 1M PHY.
Definition: BLETypes.h:747
uint8_t * value()
Return the pointer to the buffer holding the string.
Definition: BLETypes.h:296
phy_set_t(phy_t phy)
Create a set from a single phy.
Definition: BLETypes.h:729
Type that describe a pairing failure.
Definition: BLETypes.h:182
byte_array_t< 16 > oob_confirm_t
secure connections oob confirmation value
Definition: BLETypes.h:452
void set_coded(bool enabled=true)
Prefer coded PHY.
Definition: BLETypes.h:765
Entry namespace for all BLE API definitions.
Definition: ArrayView.h:37
byte_array_t< 16 > irk_t
128 bit keys used by paired devices
Definition: BLETypes.h:441
static uint32_t to_num(const uint8_t *ascii)
Convert ASCII string of digits into a number.
Definition: BLETypes.h:285
uint16_t attribute_handle_t
Reference to an attribute in a GATT database.
Definition: BLETypes.h:87
Features supported by the controller.
Definition: BLETypes.h:47
Type that describe the IO capability of a device; it is used during Pairing Feature exchange...
Definition: BLETypes.h:212
uint32_t passkey_num_t
Passkey stored as a number.
Definition: BLETypes.h:230
Random static device address.
Definition: BLETypes.h:493
PasskeyAscii()
Default to all zeroes.
Definition: BLETypes.h:243
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.