#include "services/device/serial/serial_port_impl.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/task/single_thread_task_runner.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "services/device/serial/serial_io_handler.h"
namespace device {
void SerialPortImpl::Open(
const base::FilePath& path,
mojom::SerialConnectionOptionsPtr options,
mojo::PendingRemote<mojom::SerialPortClient> client,
mojo::PendingRemote<mojom::SerialPortConnectionWatcher> watcher,
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
OpenCallback callback) { … }
void SerialPortImpl::OpenForTesting(
scoped_refptr<SerialIoHandler> io_handler,
mojom::SerialConnectionOptionsPtr options,
mojo::PendingRemote<mojom::SerialPortClient> client,
mojo::PendingRemote<mojom::SerialPortConnectionWatcher> watcher,
OpenCallback callback) { … }
SerialPortImpl::SerialPortImpl(
scoped_refptr<SerialIoHandler> io_handler,
mojo::PendingRemote<mojom::SerialPortClient> client,
mojo::PendingRemote<mojom::SerialPortConnectionWatcher> watcher)
: … { … }
SerialPortImpl::~SerialPortImpl() { … }
void SerialPortImpl::OpenPort(const mojom::SerialConnectionOptions& options,
OpenCallback callback) { … }
void SerialPortImpl::PortOpened(OpenCallback callback, bool success) { … }
void SerialPortImpl::StartWriting(mojo::ScopedDataPipeConsumerHandle consumer) { … }
void SerialPortImpl::StartReading(mojo::ScopedDataPipeProducerHandle producer) { … }
void SerialPortImpl::Flush(mojom::SerialPortFlushMode mode,
FlushCallback callback) { … }
void SerialPortImpl::Drain(DrainCallback callback) { … }
void SerialPortImpl::GetControlSignals(GetControlSignalsCallback callback) { … }
void SerialPortImpl::SetControlSignals(
mojom::SerialHostControlSignalsPtr signals,
SetControlSignalsCallback callback) { … }
void SerialPortImpl::ConfigurePort(mojom::SerialConnectionOptionsPtr options,
ConfigurePortCallback callback) { … }
void SerialPortImpl::GetPortInfo(GetPortInfoCallback callback) { … }
void SerialPortImpl::Close(bool flush, CloseCallback callback) { … }
void SerialPortImpl::WriteToPort(MojoResult result,
const mojo::HandleSignalsState& state) { … }
void SerialPortImpl::OnWriteToPortCompleted(uint32_t bytes_sent,
mojom::SerialSendError error) { … }
void SerialPortImpl::ReadFromPortAndWriteOut(
MojoResult result,
const mojo::HandleSignalsState& state) { … }
void SerialPortImpl::WriteToOutStream(uint32_t bytes_read,
mojom::SerialReceiveError error) { … }
void SerialPortImpl::PortClosed(CloseCallback callback) { … }
}