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 #include "device/serial/test_serial_io_handler.h" | 5 #include "device/serial/test_serial_io_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 info_.data_bits = options().data_bits; | 74 info_.data_bits = options().data_bits; |
75 info_.parity_bit = options().parity_bit; | 75 info_.parity_bit = options().parity_bit; |
76 info_.stop_bits = options().stop_bits; | 76 info_.stop_bits = options().stop_bits; |
77 info_.cts_flow_control = options().cts_flow_control; | 77 info_.cts_flow_control = options().cts_flow_control; |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 serial::DeviceControlSignalsPtr TestSerialIoHandler::GetControlSignals() const { | 81 serial::DeviceControlSignalsPtr TestSerialIoHandler::GetControlSignals() const { |
82 serial::DeviceControlSignalsPtr signals(serial::DeviceControlSignals::New()); | 82 serial::DeviceControlSignalsPtr signals(serial::DeviceControlSignals::New()); |
83 *signals = device_control_signals_; | 83 *signals = device_control_signals_; |
84 return signals.Pass(); | 84 return signals; |
85 } | 85 } |
86 | 86 |
87 serial::ConnectionInfoPtr TestSerialIoHandler::GetPortInfo() const { | 87 serial::ConnectionInfoPtr TestSerialIoHandler::GetPortInfo() const { |
88 serial::ConnectionInfoPtr info(serial::ConnectionInfo::New()); | 88 serial::ConnectionInfoPtr info(serial::ConnectionInfo::New()); |
89 *info = info_; | 89 *info = info_; |
90 return info.Pass(); | 90 return info; |
91 } | 91 } |
92 | 92 |
93 bool TestSerialIoHandler::Flush() const { | 93 bool TestSerialIoHandler::Flush() const { |
94 flushes_++; | 94 flushes_++; |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 bool TestSerialIoHandler::SetControlSignals( | 98 bool TestSerialIoHandler::SetControlSignals( |
99 const serial::HostControlSignals& signals) { | 99 const serial::HostControlSignals& signals) { |
100 if (signals.has_dtr) | 100 if (signals.has_dtr) |
101 dtr_ = signals.dtr; | 101 dtr_ = signals.dtr; |
102 if (signals.has_rts) | 102 if (signals.has_rts) |
103 rts_ = signals.rts; | 103 rts_ = signals.rts; |
104 return true; | 104 return true; |
105 } | 105 } |
106 | 106 |
107 bool TestSerialIoHandler::SetBreak() { | 107 bool TestSerialIoHandler::SetBreak() { |
108 return true; | 108 return true; |
109 } | 109 } |
110 | 110 |
111 bool TestSerialIoHandler::ClearBreak() { | 111 bool TestSerialIoHandler::ClearBreak() { |
112 return true; | 112 return true; |
113 } | 113 } |
114 | 114 |
115 TestSerialIoHandler::~TestSerialIoHandler() { | 115 TestSerialIoHandler::~TestSerialIoHandler() { |
116 } | 116 } |
117 | 117 |
118 } // namespace device | 118 } // namespace device |
OLD | NEW |