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. 4 5 #ifndef DEVICE_HID_HID_SERVICE_WIN_H_ 6 #define DEVICE_HID_HID_SERVICE_WIN_H_ 7 8 #include <map> 9 10 #include "device/hid/hid_device_info.h" 11 #include "device/hid/hid_service.h" 12 13 #if defined(OS_WIN) 14 15 #include <windows.h> 16 #include <hidclass.h> 17 18 extern "C" { 19 #include <hidsdi.h> 20 #include <hidpi.h> 21 } 22 23 #endif // defined(OS_WIN) 24 25 namespace device { 26 27 class HidConnection; 28 29 class HidServiceWin : public HidService { 30 public: 31 HidServiceWin(); 32 33 virtual void GetDevices(std::vector<HidDeviceInfo>* devices) OVERRIDE; 34 35 virtual scoped_refptr<HidConnection> Connect(const HidDeviceId& device_id) 36 OVERRIDE; 37 38 private: 39 virtual ~HidServiceWin(); 40 41 void Enumerate(); 42 static void CollectInfoFromButtonCaps(PHIDP_PREPARSED_DATA preparsed_data, 43 HIDP_REPORT_TYPE report_type, 44 USHORT button_caps_length, 45 HidCollectionInfo* collection_info); 46 static void CollectInfoFromValueCaps(PHIDP_PREPARSED_DATA preparsed_data, 47 HIDP_REPORT_TYPE report_type, 48 USHORT value_caps_length, 49 HidCollectionInfo* collection_info); 50 void PlatformAddDevice(const std::string& device_path); 51 void PlatformRemoveDevice(const std::string& device_path); 52 53 DISALLOW_COPY_AND_ASSIGN(HidServiceWin); 54 }; 55 56 } // namespace device 57 58 #endif // DEVICE_HID_HID_SERVICE_WIN_H_ 59