| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_HID_HID_REPORT_DESCRIPTOR_H_ | 5 #ifndef DEVICE_HID_HID_REPORT_DESCRIPTOR_H_ |
| 6 #define DEVICE_HID_HID_REPORT_DESCRIPTOR_H_ | 6 #define DEVICE_HID_HID_REPORT_DESCRIPTOR_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <vector> | 11 #include <vector> |
| 9 | 12 |
| 10 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 11 #include "device/hid/hid_collection_info.h" | 14 #include "device/hid/hid_collection_info.h" |
| 12 #include "device/hid/hid_report_descriptor_item.h" | 15 #include "device/hid/hid_report_descriptor_item.h" |
| 13 | 16 |
| 14 namespace device { | 17 namespace device { |
| 15 | 18 |
| 16 // HID report descriptor. | 19 // HID report descriptor. |
| 17 // See section 6.2.2 of HID specifications (v1.11). | 20 // See section 6.2.2 of HID specifications (v1.11). |
| 18 class HidReportDescriptor { | 21 class HidReportDescriptor { |
| 19 | 22 |
| 20 public: | 23 public: |
| 21 HidReportDescriptor(const std::vector<uint8>& bytes); | 24 HidReportDescriptor(const std::vector<uint8_t>& bytes); |
| 22 ~HidReportDescriptor(); | 25 ~HidReportDescriptor(); |
| 23 | 26 |
| 24 const std::vector<linked_ptr<HidReportDescriptorItem> >& items() const { | 27 const std::vector<linked_ptr<HidReportDescriptorItem> >& items() const { |
| 25 return items_; | 28 return items_; |
| 26 } | 29 } |
| 27 | 30 |
| 28 // Returns top-level collections present in the descriptor, | 31 // Returns top-level collections present in the descriptor, |
| 29 // together with max report sizes | 32 // together with max report sizes |
| 30 void GetDetails(std::vector<HidCollectionInfo>* top_level_collections, | 33 void GetDetails(std::vector<HidCollectionInfo>* top_level_collections, |
| 31 bool* has_report_id, | 34 bool* has_report_id, |
| 32 size_t* max_input_report_size, | 35 size_t* max_input_report_size, |
| 33 size_t* max_output_report_size, | 36 size_t* max_output_report_size, |
| 34 size_t* max_feature_report_size); | 37 size_t* max_feature_report_size); |
| 35 | 38 |
| 36 private: | 39 private: |
| 37 std::vector<linked_ptr<HidReportDescriptorItem> > items_; | 40 std::vector<linked_ptr<HidReportDescriptorItem> > items_; |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 } // namespace device | 43 } // namespace device |
| 41 | 44 |
| 42 #endif // DEVICE_HID_HID_REPORT_DESCRIPTOR_H_ | 45 #endif // DEVICE_HID_HID_REPORT_DESCRIPTOR_H_ |
| OLD | NEW |