My Project
 All Classes Functions Variables Pages
BLE2904.h
1 /*
2  * BLE2904.h
3  *
4  * Created on: Dec 23, 2017
5  * Author: kolban
6  */
7 
8 #ifndef COMPONENTS_CPP_UTILS_BLE2904_H_
9 #define COMPONENTS_CPP_UTILS_BLE2904_H_
10 #include "sdkconfig.h"
11 #if defined(CONFIG_BT_ENABLED)
12 
13 #include "BLEDescriptor.h"
14 
15 struct BLE2904_Data {
16  uint8_t m_format;
17  int8_t m_exponent;
18  uint16_t m_unit; // See https://www.bluetooth.com/specifications/assigned-numbers/units
19  uint8_t m_namespace;
20  uint16_t m_description;
21 
22 } __attribute__((packed));
23 
32 class BLE2904: public BLEDescriptor {
33 public:
34  BLE2904();
35  static const uint8_t FORMAT_BOOLEAN = 1;
36  static const uint8_t FORMAT_UINT2 = 2;
37  static const uint8_t FORMAT_UINT4 = 3;
38  static const uint8_t FORMAT_UINT8 = 4;
39  static const uint8_t FORMAT_UINT12 = 5;
40  static const uint8_t FORMAT_UINT16 = 6;
41  static const uint8_t FORMAT_UINT24 = 7;
42  static const uint8_t FORMAT_UINT32 = 8;
43  static const uint8_t FORMAT_UINT48 = 9;
44  static const uint8_t FORMAT_UINT64 = 10;
45  static const uint8_t FORMAT_UINT128 = 11;
46  static const uint8_t FORMAT_SINT8 = 12;
47  static const uint8_t FORMAT_SINT12 = 13;
48  static const uint8_t FORMAT_SINT16 = 14;
49  static const uint8_t FORMAT_SINT24 = 15;
50  static const uint8_t FORMAT_SINT32 = 16;
51  static const uint8_t FORMAT_SINT48 = 17;
52  static const uint8_t FORMAT_SINT64 = 18;
53  static const uint8_t FORMAT_SINT128 = 19;
54  static const uint8_t FORMAT_FLOAT32 = 20;
55  static const uint8_t FORMAT_FLOAT64 = 21;
56  static const uint8_t FORMAT_SFLOAT16 = 22;
57  static const uint8_t FORMAT_SFLOAT32 = 23;
58  static const uint8_t FORMAT_IEEE20601 = 24;
59  static const uint8_t FORMAT_UTF8 = 25;
60  static const uint8_t FORMAT_UTF16 = 26;
61  static const uint8_t FORMAT_OPAQUE = 27;
62 
63  void setDescription(uint16_t);
64  void setExponent(int8_t exponent);
65  void setFormat(uint8_t format);
66  void setNamespace(uint8_t namespace_value);
67  void setUnit(uint16_t unit);
68 
69 private:
70  BLE2904_Data m_data;
71 }; // BLE2904
72 
73 #endif /* CONFIG_BT_ENABLED */
74 #endif /* COMPONENTS_CPP_UTILS_BLE2904_H_ */