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

Unified Diff: device/serial/serial_io_handler.h

Issue 873903002: Set serial connection parameters immediately on connect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a comment explaing the "set" notation. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/serial/serial_connection_factory.cc ('k') | device/serial/serial_io_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/serial_io_handler.h
diff --git a/device/serial/serial_io_handler.h b/device/serial/serial_io_handler.h
index 46e0ed0fa2be1efd29b34935617ada01426c4a05..5f93d63270b0ffcc8f4a31db94d21054a90a1a2c 100644
--- a/device/serial/serial_io_handler.h
+++ b/device/serial/serial_io_handler.h
@@ -31,6 +31,7 @@ class SerialIoHandler : public base::NonThreadSafe,
// Initiates an asynchronous Open of the device.
virtual void Open(const std::string& port,
+ const serial::ConnectionOptions& options,
const OpenCompleteCallback& callback);
// Signals that the access request for |port| is complete.
@@ -74,7 +75,7 @@ class SerialIoHandler : public base::NonThreadSafe,
// Performs platform-specific port configuration. Returns |true| iff
// configuration was successful.
- virtual bool ConfigurePort(const serial::ConnectionOptions& options) = 0;
+ bool ConfigurePort(const serial::ConnectionOptions& options);
// Performs a platform-specific port configuration query. Fills values in an
// existing ConnectionInfo. Returns |true| iff port configuration was
@@ -107,6 +108,9 @@ class SerialIoHandler : public base::NonThreadSafe,
// Platform-specific write cancelation.
virtual void CancelWriteImpl() = 0;
+ // Platform-specific port configuration applies options_ to the device.
+ virtual bool ConfigurePortImpl() = 0;
+
// Requests access to the underlying serial device, if needed.
virtual void RequestAccess(
const std::string& port,
@@ -164,12 +168,16 @@ class SerialIoHandler : public base::NonThreadSafe,
bool write_canceled() const { return write_canceled_; }
+ const serial::ConnectionOptions& options() const { return options_; }
+
// Possibly fixes up a serial port path name in a platform-specific manner.
static std::string MaybeFixUpPortName(const std::string& port_name);
private:
friend class base::RefCounted<SerialIoHandler>;
+ void MergeConnectionOptions(const serial::ConnectionOptions& options);
+
// Continues an Open operation on the FILE thread.
void StartOpen(const std::string& port,
scoped_refptr<base::MessageLoopProxy> io_message_loop);
@@ -186,6 +194,9 @@ class SerialIoHandler : public base::NonThreadSafe,
// thread.
base::File file_;
+ // Currently applied connection options.
+ serial::ConnectionOptions options_;
+
scoped_ptr<WritableBuffer> pending_read_buffer_;
serial::ReceiveError read_cancel_reason_;
bool read_canceled_;
« no previous file with comments | « device/serial/serial_connection_factory.cc ('k') | device/serial/serial_io_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698