diff options
author | sammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-21 07:18:32 +0000 |
---|---|---|
committer | sammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-21 07:18:32 +0000 |
commit | b50715c5b5ed5b899a8276709de43f1a5716eded (patch) | |
tree | b3dbe8095c45851feb3a352f1aa8522bd7f3c89d /device/serial/serial_connection.h | |
parent | 25ef4f696a8421fee546a74b177f6fa9def50f68 (diff) | |
download | chromium_src-b50715c5b5ed5b899a8276709de43f1a5716eded.zip chromium_src-b50715c5b5ed5b899a8276709de43f1a5716eded.tar.gz chromium_src-b50715c5b5ed5b899a8276709de43f1a5716eded.tar.bz2 |
Add a partial Mojo serial connection interface and implementation.
This adds a Connect method to SerialService and a new partly complete
Connection interface. This change includes methods for:
- setting connection options
- getting connection info
- setting host control signals
- getting device control signals
- flushing buffers
BUG=389016
Review URL: https://codereview.chromium.org/401563002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284399 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/serial/serial_connection.h')
-rw-r--r-- | device/serial/serial_connection.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/device/serial/serial_connection.h b/device/serial/serial_connection.h new file mode 100644 index 0000000..e6909d2 --- /dev/null +++ b/device/serial/serial_connection.h @@ -0,0 +1,42 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DEVICE_SERIAL_SERIAL_CONNECTION_H_ +#define DEVICE_SERIAL_SERIAL_CONNECTION_H_ + +#include "base/memory/ref_counted.h" +#include "device/serial/serial.mojom.h" +#include "mojo/public/cpp/bindings/interface_impl.h" + +namespace device { + +class SerialIoHandler; + +class SerialConnection : public mojo::InterfaceImpl<serial::Connection> { + public: + explicit SerialConnection(scoped_refptr<SerialIoHandler> io_handler); + virtual ~SerialConnection(); + + // mojo::InterfaceImpl<serial::Connection> overrides. + virtual void GetInfo( + const mojo::Callback<void(serial::ConnectionInfoPtr)>& callback) OVERRIDE; + virtual void SetOptions(serial::ConnectionOptionsPtr options, + const mojo::Callback<void(bool)>& callback) OVERRIDE; + virtual void SetControlSignals( + serial::HostControlSignalsPtr signals, + const mojo::Callback<void(bool)>& callback) OVERRIDE; + virtual void GetControlSignals(const mojo::Callback< + void(serial::DeviceControlSignalsPtr)>& callback) OVERRIDE; + virtual void Flush(const mojo::Callback<void(bool)>& callback) OVERRIDE; + virtual void OnConnectionError() OVERRIDE; + + private: + scoped_refptr<SerialIoHandler> io_handler_; + + DISALLOW_COPY_AND_ASSIGN(SerialConnection); +}; + +} // namespace device + +#endif // DEVICE_SERIAL_SERIAL_CONNECTION_H_ |