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_
11 #include "base/memory/ref_counted.h"
12 #include "build/build_config.h"
13 #include "device/hid/hid_collection_info.h"
19 kHIDBusTypeBluetooth
= 1,
22 typedef std::string HidDeviceId
;
23 extern const char kInvalidHidDeviceId
[];
25 class HidDeviceInfo
: public base::RefCountedThreadSafe
<HidDeviceInfo
> {
27 HidDeviceInfo(const HidDeviceId
& device_id
,
30 const std::string
& product_name
,
31 const std::string
& serial_number
,
33 const std::vector
<uint8
> report_descriptor
);
35 HidDeviceInfo(const HidDeviceId
& device_id
,
38 const std::string
& product_name
,
39 const std::string
& serial_number
,
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 {
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_
;
69 virtual ~HidDeviceInfo();
72 friend class base::RefCountedThreadSafe
<HidDeviceInfo
>;
74 // Device identification.
75 HidDeviceId device_id_
;
78 std::string product_name_
;
79 std::string serial_number_
;
81 std::vector
<uint8
> report_descriptor_
;
83 // Top-Level Collections information.
84 std::vector
<HidCollectionInfo
> collections_
;
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
);
95 #endif // DEVICE_HID_HID_DEVICE_INFO_H_