1 // Copyright (c) 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_CONNECTION_WIN_H_
6 #define DEVICE_HID_HID_CONNECTION_WIN_H_
12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/message_loop/message_loop.h"
15 #include "base/threading/thread_checker.h"
16 #include "device/hid/hid_connection.h"
17 #include "device/hid/hid_device_info.h"
21 struct PendingHidTransfer
;
23 class HidConnectionWin
: public HidConnection
{
25 explicit HidConnectionWin(const HidDeviceInfo
& device_info
);
27 bool available() const;
29 virtual void Read(scoped_refptr
<net::IOBufferWithSize
> buffer
,
30 const IOCallback
& callback
) OVERRIDE
;
31 virtual void Write(uint8_t report_id
,
32 scoped_refptr
<net::IOBufferWithSize
> buffer
,
33 const IOCallback
& callback
) OVERRIDE
;
34 virtual void GetFeatureReport(uint8_t report_id
,
35 scoped_refptr
<net::IOBufferWithSize
> buffer
,
36 const IOCallback
& callback
) OVERRIDE
;
37 virtual void SendFeatureReport(uint8_t report_id
,
38 scoped_refptr
<net::IOBufferWithSize
> buffer
,
39 const IOCallback
& callback
) OVERRIDE
;
41 void OnTransferFinished(scoped_refptr
<PendingHidTransfer
> transfer
);
42 void OnTransferCanceled(scoped_refptr
<PendingHidTransfer
> transfer
);
47 base::win::ScopedHandle file_
;
48 std::set
<scoped_refptr
<PendingHidTransfer
> > transfers_
;
50 base::ThreadChecker thread_checker_
;
52 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin
);
57 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_