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 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 | 37 |
38 // Signals that the access request for |port| is complete. | 38 // Signals that the access request for |port| is complete. |
39 void OnRequestAccessComplete(const std::string& port, bool success); | 39 void OnRequestAccessComplete(const std::string& port, bool success); |
40 | 40 |
41 // Performs an async Read operation. Behavior is undefined if this is called | 41 // Performs an async Read operation. Behavior is undefined if this is called |
42 // while a Read is already pending. Otherwise, the Done or DoneWithError | 42 // while a Read is already pending. Otherwise, the Done or DoneWithError |
43 // method on |buffer| will eventually be called with a result. | 43 // method on |buffer| will eventually be called with a result. |
44 void Read(scoped_ptr<WritableBuffer> buffer); | 44 void Read(scoped_ptr<WritableBuffer> buffer); |
45 | 45 |
46 // Performs an async Write operation. Behavior is undefined if this is called | 46 // Performs an async Write operation. Behavior is undefined if this is called |
47 // while a Write is already pending. Otherwise, the Done or DoneWithError | 47 // while a Write is already pending. Otherwise, the Done or DoneWithError // |
Ken Rockot(use gerrit already)
2015/06/10 19:07:18
please remove this change
limasdf
2015/06/11 22:14:23
Done.
| |
48 // method on |buffer| will eventually be called with a result. | 48 // method on |buffer| will eventually be called with a result. |
49 void Write(scoped_ptr<ReadOnlyBuffer> buffer); | 49 void Write(scoped_ptr<ReadOnlyBuffer> buffer); |
50 | 50 |
51 // Indicates whether or not a read is currently pending. | 51 // Indicates whether or not a read is currently pending. |
52 bool IsReadPending() const; | 52 bool IsReadPending() const; |
53 | 53 |
54 // Indicates whether or not a write is currently pending. | 54 // Indicates whether or not a write is currently pending. |
55 bool IsWritePending() const; | 55 bool IsWritePending() const; |
56 | 56 |
57 // Attempts to cancel a pending read operation. | 57 // Attempts to cancel a pending read operation. |
(...skipping 18 matching lines...) Expand all Loading... | |
76 | 76 |
77 // Performs platform-specific port configuration. Returns |true| iff | 77 // Performs platform-specific port configuration. Returns |true| iff |
78 // configuration was successful. | 78 // configuration was successful. |
79 bool ConfigurePort(const serial::ConnectionOptions& options); | 79 bool ConfigurePort(const serial::ConnectionOptions& options); |
80 | 80 |
81 // Performs a platform-specific port configuration query. Fills values in an | 81 // Performs a platform-specific port configuration query. Fills values in an |
82 // existing ConnectionInfo. Returns |true| iff port configuration was | 82 // existing ConnectionInfo. Returns |true| iff port configuration was |
83 // successfully retrieved. | 83 // successfully retrieved. |
84 virtual serial::ConnectionInfoPtr GetPortInfo() const = 0; | 84 virtual serial::ConnectionInfoPtr GetPortInfo() const = 0; |
85 | 85 |
86 // Initiates a BREAK signal. Places the transmission line in a break state | |
87 // until the |ClearBreak| is called. | |
88 virtual bool SetBreak() = 0; | |
89 | |
90 // Terminates the BREAK signal. Places the transmission line in a nonbreak | |
91 // state. | |
92 virtual bool ClearBreak() = 0; | |
93 | |
86 protected: | 94 protected: |
87 explicit SerialIoHandler( | 95 explicit SerialIoHandler( |
88 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | 96 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
89 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); | 97 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner); |
90 virtual ~SerialIoHandler(); | 98 virtual ~SerialIoHandler(); |
91 | 99 |
92 // Performs a platform-specific read operation. This must guarantee that | 100 // Performs a platform-specific read operation. This must guarantee that |
93 // ReadCompleted is called when the underlying async operation is completed | 101 // ReadCompleted is called when the underlying async operation is completed |
94 // or the SerialIoHandler instance will leak. | 102 // or the SerialIoHandler instance will leak. |
95 // NOTE: Implementations of ReadImpl should never call ReadCompleted directly. | 103 // NOTE: Implementations of ReadImpl should never call ReadCompleted directly. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | 220 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; |
213 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. | 221 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. |
214 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; | 222 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; |
215 | 223 |
216 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); | 224 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); |
217 }; | 225 }; |
218 | 226 |
219 } // namespace device | 227 } // namespace device |
220 | 228 |
221 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 229 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
OLD | NEW |