Add ICU message format support
[chromium-blink-merge.git] / device / hid / hid_device_info.h
blobbc89832229c24827c3abac05ff5783f645fd32f2
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 #if defined(OS_MACOSX)
23 typedef uint64_t HidDeviceId;
24 const uint64_t kInvalidHidDeviceId = -1;
25 #else
26 typedef std::string HidDeviceId;
27 extern const char kInvalidHidDeviceId[];
28 #endif
30 class HidDeviceInfo : public base::RefCountedThreadSafe<HidDeviceInfo> {
31 public:
32 HidDeviceInfo(const HidDeviceId& device_id,
33 uint16_t vendor_id,
34 uint16_t product_id,
35 const std::string& product_name,
36 const std::string& serial_number,
37 HidBusType bus_type,
38 const std::vector<uint8> report_descriptor);
40 HidDeviceInfo(const HidDeviceId& device_id,
41 uint16_t vendor_id,
42 uint16_t product_id,
43 const std::string& product_name,
44 const std::string& serial_number,
45 HidBusType bus_type,
46 const HidCollectionInfo& collection,
47 size_t max_input_report_size,
48 size_t max_output_report_size,
49 size_t max_feature_report_size);
51 // Device identification.
52 const HidDeviceId& device_id() const { return device_id_; }
53 uint16_t vendor_id() const { return vendor_id_; }
54 uint16_t product_id() const { return product_id_; }
55 const std::string& product_name() const { return product_name_; }
56 const std::string& serial_number() const { return serial_number_; }
57 HidBusType bus_type() const { return bus_type_; }
59 // Top-Level Collections information.
60 const std::vector<HidCollectionInfo>& collections() const {
61 return collections_;
63 bool has_report_id() const { return has_report_id_; };
64 size_t max_input_report_size() const { return max_input_report_size_; }
65 size_t max_output_report_size() const { return max_output_report_size_; }
66 size_t max_feature_report_size() const { return max_feature_report_size_; }
68 // The raw HID report descriptor is not available on Windows.
69 const std::vector<uint8>& report_descriptor() const {
70 return report_descriptor_;
73 protected:
74 virtual ~HidDeviceInfo();
76 private:
77 friend class base::RefCountedThreadSafe<HidDeviceInfo>;
79 // Device identification.
80 HidDeviceId device_id_;
81 uint16_t vendor_id_;
82 uint16_t product_id_;
83 std::string product_name_;
84 std::string serial_number_;
85 HidBusType bus_type_;
86 std::vector<uint8> report_descriptor_;
88 // Top-Level Collections information.
89 std::vector<HidCollectionInfo> collections_;
90 bool has_report_id_;
91 size_t max_input_report_size_;
92 size_t max_output_report_size_;
93 size_t max_feature_report_size_;
95 DISALLOW_COPY_AND_ASSIGN(HidDeviceInfo);
98 } // namespace device
100 #endif // DEVICE_HID_HID_DEVICE_INFO_H_