| OLD | NEW |
| (Empty) |
| 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_SERIAL_SERIAL_CONNECTION_H_ | |
| 6 #define DEVICE_SERIAL_SERIAL_CONNECTION_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "device/serial/serial.mojom.h" | |
| 15 | |
| 16 namespace device { | |
| 17 | |
| 18 class DataSinkReceiver; | |
| 19 class DataSourceSender; | |
| 20 class ReadOnlyBuffer; | |
| 21 class SerialIoHandler; | |
| 22 class WritableBuffer; | |
| 23 | |
| 24 class SerialConnection : public serial::Connection { | |
| 25 public: | |
| 26 SerialConnection(scoped_refptr<SerialIoHandler> io_handler, | |
| 27 mojo::InterfaceRequest<serial::DataSink> sink, | |
| 28 mojo::InterfaceRequest<serial::DataSource> source, | |
| 29 mojo::InterfacePtr<serial::DataSourceClient> source_client); | |
| 30 ~SerialConnection() override; | |
| 31 | |
| 32 // serial::Connection overrides. | |
| 33 void GetInfo(const GetInfoCallback& callback) override; | |
| 34 void SetOptions(serial::ConnectionOptionsPtr options, | |
| 35 const SetOptionsCallback& callback) override; | |
| 36 void SetControlSignals(serial::HostControlSignalsPtr signals, | |
| 37 const SetControlSignalsCallback& callback) override; | |
| 38 void GetControlSignals(const GetControlSignalsCallback& callback) override; | |
| 39 void Flush(const FlushCallback& callback) override; | |
| 40 | |
| 41 private: | |
| 42 void OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer); | |
| 43 void OnSendCancelled(int32_t error); | |
| 44 void OnReceivePipeReady(std::unique_ptr<WritableBuffer> buffer); | |
| 45 | |
| 46 scoped_refptr<SerialIoHandler> io_handler_; | |
| 47 scoped_refptr<DataSinkReceiver> receiver_; | |
| 48 scoped_refptr<DataSourceSender> sender_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(SerialConnection); | |
| 51 }; | |
| 52 | |
| 53 } // namespace device | |
| 54 | |
| 55 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_H_ | |
| OLD | NEW |