| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 default: | 46 default: |
| 47 return 8; | 47 return 8; |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 int ParityBitEnumToConstant(serial::ParityBit parity_bit) { | 51 int ParityBitEnumToConstant(serial::ParityBit parity_bit) { |
| 52 switch (parity_bit) { | 52 switch (parity_bit) { |
| 53 case serial::PARITY_BIT_EVEN: | 53 case serial::PARITY_BIT_EVEN: |
| 54 return EVENPARITY; | 54 return EVENPARITY; |
| 55 case serial::PARITY_BIT_ODD: | 55 case serial::PARITY_BIT_ODD: |
| 56 return SPACEPARITY; | 56 return ODDPARITY; |
| 57 case serial::PARITY_BIT_NO: | 57 case serial::PARITY_BIT_NO: |
| 58 default: | 58 default: |
| 59 return NOPARITY; | 59 return NOPARITY; |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 int StopBitsEnumToConstant(serial::StopBits stop_bits) { | 63 int StopBitsEnumToConstant(serial::StopBits stop_bits) { |
| 64 switch (stop_bits) { | 64 switch (stop_bits) { |
| 65 case serial::STOP_BITS_TWO: | 65 case serial::STOP_BITS_TWO: |
| 66 return TWOSTOPBITS; | 66 return TWOSTOPBITS; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { | 372 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { |
| 373 // For COM numbers less than 9, CreateFile is called with a string such as | 373 // For COM numbers less than 9, CreateFile is called with a string such as |
| 374 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. | 374 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. |
| 375 if (port_name.length() > std::string("COM9").length()) | 375 if (port_name.length() > std::string("COM9").length()) |
| 376 return std::string("\\\\.\\").append(port_name); | 376 return std::string("\\\\.\\").append(port_name); |
| 377 | 377 |
| 378 return port_name; | 378 return port_name; |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace device | 381 } // namespace device |
| OLD | NEW |