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/serial_connection_factory.h" | 5 #include "device/serial/serial_connection_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "device/serial/serial_connection.h" | 12 #include "device/serial/serial_connection.h" |
13 #include "device/serial/serial_io_handler.h" | 13 #include "device/serial/serial_io_handler.h" |
14 | 14 |
15 namespace device { | 15 namespace device { |
16 namespace { | 16 namespace { |
17 | 17 |
18 void FillDefaultConnectionOptions(serial::ConnectionOptions* options) { | 18 void FillDefaultConnectionOptions(serial::ConnectionOptions* options) { |
19 if (!options->bitrate) | 19 if (!options->bitrate) |
20 options->bitrate = 9600; | 20 options->bitrate = 9600; |
21 if (options->data_bits == serial::DATA_BITS_NONE) | 21 if (options->data_bits == serial::DataBits::NONE) |
22 options->data_bits = serial::DATA_BITS_EIGHT; | 22 options->data_bits = serial::DataBits::EIGHT; |
23 if (options->stop_bits == serial::STOP_BITS_NONE) | 23 if (options->stop_bits == serial::StopBits::NONE) |
24 options->stop_bits = serial::STOP_BITS_ONE; | 24 options->stop_bits = serial::StopBits::ONE; |
25 if (options->parity_bit == serial::PARITY_BIT_NONE) | 25 if (options->parity_bit == serial::ParityBit::NONE) |
26 options->parity_bit = serial::PARITY_BIT_NO; | 26 options->parity_bit = serial::ParityBit::NO; |
27 if (!options->has_cts_flow_control) { | 27 if (!options->has_cts_flow_control) { |
28 options->has_cts_flow_control = true; | 28 options->has_cts_flow_control = true; |
29 options->cts_flow_control = false; | 29 options->cts_flow_control = false; |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 class SerialConnectionFactory::ConnectTask | 35 class SerialConnectionFactory::ConnectTask |
36 : public base::RefCountedThreadSafe<SerialConnectionFactory::ConnectTask> { | 36 : public base::RefCountedThreadSafe<SerialConnectionFactory::ConnectTask> { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if (!success) { | 127 if (!success) { |
128 return; | 128 return; |
129 } | 129 } |
130 | 130 |
131 new SerialConnection(io_handler_, std::move(sink_), std::move(source_), | 131 new SerialConnection(io_handler_, std::move(sink_), std::move(source_), |
132 mojo::MakeProxy(std::move(source_client_)), | 132 mojo::MakeProxy(std::move(source_client_)), |
133 std::move(connection_request_)); | 133 std::move(connection_request_)); |
134 } | 134 } |
135 | 135 |
136 } // namespace device | 136 } // namespace device |
OLD | NEW |