Some additional network settings cleanup
[chromium-blink-merge.git] / device / hid / hid_connection_linux.h
blob1944a5bbab8d890d40679e900d8f1448a012136c
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_LINUX_H_
6 #define DEVICE_HID_HID_CONNECTION_LINUX_H_
8 #include <queue>
10 #include "base/files/file.h"
11 #include "base/message_loop/message_pump_libevent.h"
12 #include "device/hid/hid_connection.h"
14 namespace device {
16 class HidConnectionLinux : public HidConnection,
17 public base::MessagePumpLibevent::Watcher {
18 public:
19 HidConnectionLinux(HidDeviceInfo device_info, std::string dev_node);
21 private:
22 friend class base::RefCountedThreadSafe<HidConnectionLinux>;
23 virtual ~HidConnectionLinux();
25 // HidConnection implementation.
26 virtual void PlatformRead(const ReadCallback& callback) OVERRIDE;
27 virtual void PlatformWrite(scoped_refptr<net::IOBuffer> buffer,
28 size_t size,
29 const WriteCallback& callback) OVERRIDE;
30 virtual void PlatformGetFeatureReport(uint8_t report_id,
31 const ReadCallback& callback) OVERRIDE;
32 virtual void PlatformSendFeatureReport(
33 scoped_refptr<net::IOBuffer> buffer,
34 size_t size,
35 const WriteCallback& callback) OVERRIDE;
37 // base::MessagePumpLibevent::Watcher implementation.
38 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
39 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
41 void Disconnect();
43 void Flush();
44 void ProcessInputReport(scoped_refptr<net::IOBuffer> buffer, size_t size);
45 void ProcessReadQueue();
47 base::File device_file_;
48 base::MessagePumpLibevent::FileDescriptorWatcher device_file_watcher_;
50 std::queue<PendingHidReport> pending_reports_;
51 std::queue<PendingHidRead> pending_reads_;
53 DISALLOW_COPY_AND_ASSIGN(HidConnectionLinux);
56 } // namespace device
58 #endif // DEVICE_HID_HID_CONNECTION_LINUX_H_