Chromium Code Reviews| Index: device/serial/serial_io_handler_posix.h |
| diff --git a/device/serial/serial_io_handler_posix.h b/device/serial/serial_io_handler_posix.h |
| index c9c5fb5416472c0d7edae75c630705cf2f3e49df..55741f83a2f8004cd16aa5b86c56e942ce07f4e6 100644 |
| --- a/device/serial/serial_io_handler_posix.h |
| +++ b/device/serial/serial_io_handler_posix.h |
| @@ -12,6 +12,11 @@ |
| namespace device { |
| +// Linux reports breaks and parity errors by inserting the sequence '\377\0x' |
| +// into the byte stream where 'x' is '\0' for a break and the corrupted byte for |
| +// a parity error. |
| +enum ErrorDetectState { NO_ERROR, MARK_377_SEEN, MARK_0_SEEN }; |
|
Reilly Grant (use Gerrit)
2015/07/29 17:34:18
This needs to be an enum class to use short names
juncai
2015/07/29 23:29:36
Done.
|
| + |
| class SerialIoHandlerPosix : public SerialIoHandler, |
| public base::MessageLoopForIO::Watcher { |
| protected: |
| @@ -28,9 +33,15 @@ class SerialIoHandlerPosix : public SerialIoHandler, |
| serial::ConnectionInfoPtr GetPortInfo() const override; |
| bool SetBreak() override; |
| bool ClearBreak() override; |
| + int CheckReceiveError(char* buffer, |
| + int buffer_len, |
| + int bytes_read, |
| + bool& break_detected, |
| + bool& parity_error_detected); |
| private: |
| friend class SerialIoHandler; |
| + friend class SerialIoHandlerPosixTest; |
| SerialIoHandlerPosix( |
| scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| @@ -51,6 +62,11 @@ class SerialIoHandlerPosix : public SerialIoHandler, |
| bool is_watching_reads_; |
| bool is_watching_writes_; |
| + ErrorDetectState error_detect_state_; |
| + bool parity_check_enabled_; |
| + char chars_ignored_[2]; |
| + int num_chars_ignored_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerPosix); |
| }; |