Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: device/serial/serial_io_handler_win.cc

Issue 2644543003: Rename device.serial.ParityBit.NO to avoid a clash with NO in objective C. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_io_handler_win.h" 5 #include "device/serial/serial_io_handler_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <setupapi.h> 8 #include <setupapi.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return 8; 56 return 8;
57 } 57 }
58 } 58 }
59 59
60 int ParityBitEnumToConstant(serial::ParityBit parity_bit) { 60 int ParityBitEnumToConstant(serial::ParityBit parity_bit) {
61 switch (parity_bit) { 61 switch (parity_bit) {
62 case serial::ParityBit::EVEN: 62 case serial::ParityBit::EVEN:
63 return EVENPARITY; 63 return EVENPARITY;
64 case serial::ParityBit::ODD: 64 case serial::ParityBit::ODD:
65 return ODDPARITY; 65 return ODDPARITY;
66 case serial::ParityBit::NO: 66 case serial::ParityBit::NO_PARITY:
67 default: 67 default:
68 return NOPARITY; 68 return NOPARITY;
69 } 69 }
70 } 70 }
71 71
72 int StopBitsEnumToConstant(serial::StopBits stop_bits) { 72 int StopBitsEnumToConstant(serial::StopBits stop_bits) {
73 switch (stop_bits) { 73 switch (stop_bits) {
74 case serial::StopBits::TWO: 74 case serial::StopBits::TWO:
75 return TWOSTOPBITS; 75 return TWOSTOPBITS;
76 case serial::StopBits::ONE: 76 case serial::StopBits::ONE:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 serial::ParityBit ParityBitConstantToEnum(int parity_bit) { 120 serial::ParityBit ParityBitConstantToEnum(int parity_bit) {
121 switch (parity_bit) { 121 switch (parity_bit) {
122 case EVENPARITY: 122 case EVENPARITY:
123 return serial::ParityBit::EVEN; 123 return serial::ParityBit::EVEN;
124 case ODDPARITY: 124 case ODDPARITY:
125 return serial::ParityBit::ODD; 125 return serial::ParityBit::ODD;
126 case NOPARITY: 126 case NOPARITY:
127 default: 127 default:
128 return serial::ParityBit::NO; 128 return serial::ParityBit::NO_PARITY;
129 } 129 }
130 } 130 }
131 131
132 serial::StopBits StopBitsConstantToEnum(int stop_bits) { 132 serial::StopBits StopBitsConstantToEnum(int stop_bits) {
133 switch (stop_bits) { 133 switch (stop_bits) {
134 case TWOSTOPBITS: 134 case TWOSTOPBITS:
135 return serial::StopBits::TWO; 135 return serial::StopBits::TWO;
136 case ONESTOPBIT: 136 case ONESTOPBIT:
137 default: 137 default:
138 return serial::StopBits::ONE; 138 return serial::StopBits::ONE;
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { 526 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) {
527 // For COM numbers less than 9, CreateFile is called with a string such as 527 // For COM numbers less than 9, CreateFile is called with a string such as
528 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added. 528 // "COM1". For numbers greater than 9, a prefix of "\\\\.\\" must be added.
529 if (port_name.length() > std::string("COM9").length()) 529 if (port_name.length() > std::string("COM9").length())
530 return std::string("\\\\.\\").append(port_name); 530 return std::string("\\\\.\\").append(port_name);
531 531
532 return port_name; 532 return port_name;
533 } 533 }
534 534
535 } // namespace device 535 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_io_handler_posix.cc ('k') | extensions/browser/api/serial/serial_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698