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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include "device/serial/serial_io_handler_win.h" | 7 #include "device/serial/serial_io_handler_win.h" |
8 | 8 |
9 namespace device { | 9 namespace device { |
10 | 10 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 } | 384 } |
385 serial::ConnectionInfoPtr info(serial::ConnectionInfo::New()); | 385 serial::ConnectionInfoPtr info(serial::ConnectionInfo::New()); |
386 info->bitrate = SpeedConstantToBitrate(config.BaudRate); | 386 info->bitrate = SpeedConstantToBitrate(config.BaudRate); |
387 info->data_bits = DataBitsConstantToEnum(config.ByteSize); | 387 info->data_bits = DataBitsConstantToEnum(config.ByteSize); |
388 info->parity_bit = ParityBitConstantToEnum(config.Parity); | 388 info->parity_bit = ParityBitConstantToEnum(config.Parity); |
389 info->stop_bits = StopBitsConstantToEnum(config.StopBits); | 389 info->stop_bits = StopBitsConstantToEnum(config.StopBits); |
390 info->cts_flow_control = config.fOutxCtsFlow != 0; | 390 info->cts_flow_control = config.fOutxCtsFlow != 0; |
391 return info.Pass(); | 391 return info.Pass(); |
392 } | 392 } |
393 | 393 |
394 bool SerialIoHandlerWin::SetBreak() { | |
395 return SetCommBreak(file().GetPlatformFile()) != 0; | |
Reilly Grant (use Gerrit)
2015/06/10 19:42:13
And here.
limasdf
2015/06/11 22:14:24
Done.
| |
396 } | |
397 | |
398 bool SerialIoHandlerWin::ClearBreak() { | |
399 return ClearCommBreak(file().GetPlatformFile()) != 0; | |
Reilly Grant (use Gerrit)
2015/06/10 19:42:13
And here.
limasdf
2015/06/11 22:14:24
Done.
| |
400 } | |
401 | |
394 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { | 402 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { |
395 // For COM numbers less than 9, CreateFile is called with a string such as | 403 // For COM numbers less than 9, CreateFile is called with a string such as |
396 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. | 404 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. |
397 if (port_name.length() > std::string("COM9").length()) | 405 if (port_name.length() > std::string("COM9").length()) |
398 return std::string("\\\\.\\").append(port_name); | 406 return std::string("\\\\.\\").append(port_name); |
399 | 407 |
400 return port_name; | 408 return port_name; |
401 } | 409 } |
402 | 410 |
403 } // namespace device | 411 } // namespace device |
OLD | NEW |