BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
hid.hpp
1#ifndef BLUETOE_SERVICES_HID_HPP
2#define BLUETOE_SERVICES_HID_HPP
3
4#include <bluetoe/service.hpp>
5#include <bluetoe/characteristic.hpp>
6
7namespace bluetoe {
8
9 namespace hid {
13 using service_uuid = service_uuid16< 0x1812 >;
14
15 using protocol_mode_uuid = characteristic_uuid16< 0x2A4E >;
16 using report_uuid = characteristic_uuid16< 0x2A4D >;
17 using report_map_uuid = characteristic_uuid16< 0x2A4B >;
18 using boot_keyboard_input_report_uuid = characteristic_uuid16< 0x2A22 >;
19 using boot_keyboard_output_report_uuid = characteristic_uuid16< 0x2A32 >;
20 using boot_mouse_input_report_uuid = characteristic_uuid16< 0x2A33 >;
21 using hid_information_uuid = characteristic_uuid16< 0x2A4A >;
22 using hid_control_point_uuid = characteristic_uuid16< 0x2A4C >;
23
24 static constexpr std::uint16_t report_reference_descriptor_uuid = 0x2908;
25
26 enum class report_type : std::uint8_t {
27 input = 1,
28 output = 2,
29 feature = 3
30 };
31
32 namespace details {
33 template < std::uint8_t ReportID, report_type Type >
34 struct report_reference_impl {
35 static const std::uint8_t data[ 2 ];
36
37 using descriptor = bluetoe::descriptor< report_reference_descriptor_uuid, data, sizeof( data ) >;
38 };
39
40 template < std::uint8_t ReportID, report_type Type >
41 const std::uint8_t report_reference_impl< ReportID, Type >::data[ 2 ] = { ReportID, static_cast< std::uint8_t >( Type ) };
42
43 }
44
48 template < std::uint8_t ReportID >
49 using input_report_reference = typename details::report_reference_impl< ReportID, report_type::input >::descriptor;
50
54 template < std::uint8_t ReportID >
55 using output_report_reference = typename details::report_reference_impl< ReportID, report_type::output >::descriptor;
56
60 template < std::uint8_t ReportID >
61 using feature_report_reference = typename details::report_reference_impl< ReportID, report_type::feature >::descriptor;
62 }
63}
64
65#endif
User defined descriptor.
Definition: descriptor.hpp:22