ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / device / hid / hid_device_info.h
blob8096546e8291a83d8aaf6435fc72d6d8d04e39b7
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef DEVICE_HID_HID_DEVICE_INFO_H_
6 #define DEVICE_HID_HID_DEVICE_INFO_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
12 #include "build/build_config.h"
13 #include "device/hid/hid_collection_info.h"
15 namespace device {
17 enum HidBusType {
18 kHIDBusTypeUSB = 0,
19 kHIDBusTypeBluetooth = 1,
22 typedef std::string HidDeviceId;
23 extern const char kInvalidHidDeviceId[];
25 class HidDeviceInfo : public base::RefCountedThreadSafe<HidDeviceInfo> {
26 public:
27 HidDeviceInfo(const HidDeviceId& device_id,
28 uint16_t vendor_id,
29 uint16_t product_id,
30 const std::string& product_name,
31 const std::string& serial_number,
32 HidBusType bus_type,
33 const std::vector<uint8> report_descriptor);
35 HidDeviceInfo(const HidDeviceId& device_id,
36 uint16_t vendor_id,
37 uint16_t product_id,
38 const std::string& product_name,
39 const std::string& serial_number,
40 HidBusType bus_type,
41 const HidCollectionInfo& collection,
42 size_t max_input_report_size,
43 size_t max_output_report_size,
44 size_t max_feature_report_size);
46 // Device identification.
47 const HidDeviceId& device_id() const { return device_id_; }
48 uint16_t vendor_id() const { return vendor_id_; }
49 uint16_t product_id() const { return product_id_; }
50 const std::string& product_name() const { return product_name_; }
51 const std::string& serial_number() const { return serial_number_; }
52 HidBusType bus_type() const { return bus_type_; }
54 // Top-Level Collections information.
55 const std::vector<HidCollectionInfo>& collections() const {
56 return collections_;
58 bool has_report_id() const { return has_report_id_; };
59 size_t max_input_report_size() const { return max_input_report_size_; }
60 size_t max_output_report_size() const { return max_output_report_size_; }
61 size_t max_feature_report_size() const { return max_feature_report_size_; }
63 // The raw HID report descriptor is not available on Windows.
64 const std::vector<uint8>& report_descriptor() const {
65 return report_descriptor_;
68 protected:
69 virtual ~HidDeviceInfo();
71 private:
72 friend class base::RefCountedThreadSafe<HidDeviceInfo>;
74 // Device identification.
75 HidDeviceId device_id_;
76 uint16_t vendor_id_;
77 uint16_t product_id_;
78 std::string product_name_;
79 std::string serial_number_;
80 HidBusType bus_type_;
81 std::vector<uint8> report_descriptor_;
83 // Top-Level Collections information.
84 std::vector<HidCollectionInfo> collections_;
85 bool has_report_id_;
86 size_t max_input_report_size_;
87 size_t max_output_report_size_;
88 size_t max_feature_report_size_;
90 DISALLOW_COPY_AND_ASSIGN(HidDeviceInfo);
93 } // namespace device
95 #endif // DEVICE_HID_HID_DEVICE_INFO_H_