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 #if defined(OS_MACOSX)
23 typedef uint64_t HidDeviceId
;
24 const uint64_t kInvalidHidDeviceId
= -1;
26 typedef std::string HidDeviceId
;
27 extern const char kInvalidHidDeviceId
[];
30 class HidDeviceInfo
: public base::RefCountedThreadSafe
<HidDeviceInfo
> {
32 HidDeviceInfo(const HidDeviceId
& device_id
,
35 const std::string
& product_name
,
36 const std::string
& serial_number
,
38 const std::vector
<uint8
> report_descriptor
);
40 HidDeviceInfo(const HidDeviceId
& device_id
,
43 const std::string
& product_name
,
44 const std::string
& serial_number
,
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 {
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_
;
74 virtual ~HidDeviceInfo();
77 friend class base::RefCountedThreadSafe
<HidDeviceInfo
>;
79 // Device identification.
80 HidDeviceId device_id_
;
83 std::string product_name_
;
84 std::string serial_number_
;
86 std::vector
<uint8
> report_descriptor_
;
88 // Top-Level Collections information.
89 std::vector
<HidCollectionInfo
> collections_
;
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
);
100 #endif // DEVICE_HID_HID_DEVICE_INFO_H_