BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
dis.hpp
1#ifndef BLUETOE_SERVICES_DIS_HPP
2#define BLUETOE_SERVICES_DIS_HPP
3
4#include <bluetoe/service.hpp>
5#include <bluetoe/characteristic.hpp>
6
7namespace bluetoe {
8
9 namespace dis {
10
14 using service_uuid = service_uuid16< 0x180A >;
15
16 using manufacturer_name_uuid = characteristic_uuid16< 0x2A29 >;
17 using model_number_uuid = characteristic_uuid16< 0x2A24 >;
18 using serial_number_uuid = characteristic_uuid16< 0x2A25 >;
19 using hardware_revision_uuid = characteristic_uuid16< 0x2A27 >;
20 using firmware_revision_uuid = characteristic_uuid16< 0x2A26 >;
21 using software_revision_uuid = characteristic_uuid16< 0x2A28 >;
22 using system_uuid = characteristic_uuid16< 0x2A23 >;
23 using ieee_11073_20601_regulatory_certification_data_list_uuid = characteristic_uuid16< 0x2A2A >;
24 using pnp_uuid = characteristic_uuid16< 0x2A50 >;
25
29 template < const char* Manufacturer >
30 using manufacturer_name =
33 manufacturer_name_uuid
34 >
35 ;
36
40 template < const char* ModelNumberString >
41 using model_number =
44 model_number_uuid
45 >
46 ;
47
51 template < const char* SerialNumberString >
52 using serial_number =
55 serial_number_uuid
56 >
57 ;
58
62 template < const char* HardwareRevisionString >
63 using hardware_revision =
66 hardware_revision_uuid
67 >
68 ;
69
73 template < const char* FirmwareRevisionString >
74 using firmware_revision =
77 firmware_revision_uuid
78 >
79 ;
80
84 template < const char* SoftwareRevisionString >
85 using software_revision =
88 software_revision_uuid
89 >
90 ;
91
95 template < std::uint64_t ManufacturerIdentifier, std::uint32_t OrganizationallyUniqueIdentifier >
96 struct system_id
97 {
98 };
99
103 template < typename Value >
105 {
106 };
107
111 enum class vendor_id_source_t : std::uint8_t
112 {
116 bluetooth = 1,
117
121 usb = 2
122 };
123
124 namespace details {
126 template < vendor_id_source_t VendorIDSource, std::uint16_t VendorID, std::uint16_t ProductID, std::uint16_t ProductVersion >
127 struct pnp_id_value : bluetoe::cstring_wrapper< pnp_id_value< VendorIDSource, VendorID, ProductID, ProductVersion > >
128 {
129 static constexpr std::size_t data_size = 7u;
130
131 static constexpr std::uint8_t data[ data_size ] = {
132 static_cast< std::uint8_t >( VendorIDSource ),
133 static_cast< std::uint8_t >( VendorID & 0xff ),
134 static_cast< std::uint8_t >( VendorID >> 8 ),
135 static_cast< std::uint8_t >( ProductID & 0xff ),
136 static_cast< std::uint8_t >( ProductID >> 8 ),
137 static_cast< std::uint8_t >( ProductVersion & 0xff),
138 static_cast< std::uint8_t >( ProductVersion >> 8 )
139 };
140
141 static constexpr std::uint8_t const * value()
142 {
143
144 static_assert( data_size == sizeof data, "" );
145
146 return data;
147 }
148
149 static constexpr std::size_t size()
150 {
151 return data_size;
152 }
153 };
154
155 template < vendor_id_source_t VendorIDSource, std::uint16_t VendorID, std::uint16_t ProductID, std::uint16_t ProductVersion >
156 constexpr std::uint8_t pnp_id_value< VendorIDSource, VendorID, ProductID, ProductVersion >::data[ data_size ];
158 }
159
163 template < vendor_id_source_t VendorIDSource, std::uint16_t VendorID, std::uint16_t ProductID, std::uint16_t ProductVersion >
164 using pnp_id =
166 details::pnp_id_value< VendorIDSource, VendorID, ProductID, ProductVersion >,
167 pnp_uuid
168 >
169 ;
170 }
171
185 template < typename ... Options >
186 using device_information_service = bluetoe::service<
187 dis::service_uuid,
188 Options...
189 >;
190}
191
192#endif
A characteristic is a typed value that is accessable by a GATT client hosted by a GATT server.
Definition: characteristic.hpp:160
a service with zero or more characteristics
Definition: service.hpp:150
a constant string characteristic with the value Name
Definition: characteristic_value.hpp:487
a constant string characteristic value
Definition: characteristic_value.hpp:429
Definition: dis.hpp:97