| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module device.serial; | |
| 6 | |
| 7 interface DataSource { | |
| 8 // Initializes this DataSource with the amount of data its client will | |
| 9 // buffer. | |
| 10 Init(uint32 buffer_size); | |
| 11 | |
| 12 // Resumes sending data after it has been stopped due to an error. | |
| 13 Resume(); | |
| 14 | |
| 15 // Reports that |bytes_sent| bytes have been successfully passed to the | |
| 16 // client. | |
| 17 ReportBytesReceived(uint32 bytes_sent); | |
| 18 }; | |
| 19 | |
| 20 interface DataSourceClient { | |
| 21 // Invoked to report |error| from the DataSource. No further bytes will be | |
| 22 // transmitted from the DataSource until Resume() is called. | |
| 23 OnError(int32 error); | |
| 24 | |
| 25 // Invoked to transmit data from the DataSource. | |
| 26 OnData(array<uint8> data); | |
| 27 }; | |
| 28 | |
| 29 interface DataSink { | |
| 30 // Requests the cancellation of any data that has been written to the pipe, | |
| 31 // but has not yet been sent to the sink. | |
| 32 Cancel(int32 error); | |
| 33 | |
| 34 // Invoked to pass |data| to the sink. The response contains the number of | |
| 35 // bytes successfully sent and an optional error. If |error| is zero, | |
| 36 // |bytes_sent| will the size of |data|. | |
| 37 OnData(array<uint8> data) => (uint32 bytes_sent, int32 error); | |
| 38 | |
| 39 // Called to clear the error and resume data transmission after an error | |
| 40 // occurs. After an error is reported in response to an OnData until | |
| 41 // ClearError is called, any further OnData calls will report the same error | |
| 42 // as the first error response. | |
| 43 ClearError(); | |
| 44 }; | |
| OLD | NEW |