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_SERIAL_SERIAL_CONNECTION_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_CONNECTION_H_ |
6 #define DEVICE_SERIAL_SERIAL_CONNECTION_H_ | 6 #define DEVICE_SERIAL_SERIAL_CONNECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 14 matching lines...) Expand all Loading... |
25 class SerialConnection : public serial::Connection { | 25 class SerialConnection : public serial::Connection { |
26 public: | 26 public: |
27 SerialConnection(scoped_refptr<SerialIoHandler> io_handler, | 27 SerialConnection(scoped_refptr<SerialIoHandler> io_handler, |
28 mojo::InterfaceRequest<serial::DataSink> sink, | 28 mojo::InterfaceRequest<serial::DataSink> sink, |
29 mojo::InterfaceRequest<serial::DataSource> source, | 29 mojo::InterfaceRequest<serial::DataSource> source, |
30 mojo::InterfacePtr<serial::DataSourceClient> source_client, | 30 mojo::InterfacePtr<serial::DataSourceClient> source_client, |
31 mojo::InterfaceRequest<serial::Connection> request); | 31 mojo::InterfaceRequest<serial::Connection> request); |
32 ~SerialConnection() override; | 32 ~SerialConnection() override; |
33 | 33 |
34 // serial::Connection overrides. | 34 // serial::Connection overrides. |
35 void GetInfo( | 35 void GetInfo(const GetInfoCallback& callback) override; |
36 const mojo::Callback<void(serial::ConnectionInfoPtr)>& callback) override; | |
37 void SetOptions(serial::ConnectionOptionsPtr options, | 36 void SetOptions(serial::ConnectionOptionsPtr options, |
38 const mojo::Callback<void(bool)>& callback) override; | 37 const SetOptionsCallback& callback) override; |
39 void SetControlSignals(serial::HostControlSignalsPtr signals, | 38 void SetControlSignals(serial::HostControlSignalsPtr signals, |
40 const mojo::Callback<void(bool)>& callback) override; | 39 const SetControlSignalsCallback& callback) override; |
41 void GetControlSignals( | 40 void GetControlSignals(const GetControlSignalsCallback& callback) override; |
42 const mojo::Callback<void(serial::DeviceControlSignalsPtr)>& callback) | 41 void Flush(const FlushCallback& callback) override; |
43 override; | |
44 void Flush(const mojo::Callback<void(bool)>& callback) override; | |
45 | 42 |
46 private: | 43 private: |
47 void OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer); | 44 void OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer); |
48 void OnSendCancelled(int32_t error); | 45 void OnSendCancelled(int32_t error); |
49 void OnReceivePipeReady(std::unique_ptr<WritableBuffer> buffer); | 46 void OnReceivePipeReady(std::unique_ptr<WritableBuffer> buffer); |
50 | 47 |
51 scoped_refptr<SerialIoHandler> io_handler_; | 48 scoped_refptr<SerialIoHandler> io_handler_; |
52 scoped_refptr<DataSinkReceiver> receiver_; | 49 scoped_refptr<DataSinkReceiver> receiver_; |
53 scoped_refptr<DataSourceSender> sender_; | 50 scoped_refptr<DataSourceSender> sender_; |
54 | 51 |
55 mojo::StrongBinding<serial::Connection> binding_; | 52 mojo::StrongBinding<serial::Connection> binding_; |
56 | 53 |
57 DISALLOW_COPY_AND_ASSIGN(SerialConnection); | 54 DISALLOW_COPY_AND_ASSIGN(SerialConnection); |
58 }; | 55 }; |
59 | 56 |
60 } // namespace device | 57 } // namespace device |
61 | 58 |
62 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_H_ | 59 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_H_ |
OLD | NEW |