• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5module device.serial {
6
7[Client=DataSourceClient]
8interface DataSource {
9  // Initializes this DataSource with a data pipe handle to use for data
10  // transmission.
11  Init(handle<data_pipe_producer> producer_handle);
12
13  // Resumes sending data after it has been stopped due to an error.
14  Resume();
15};
16
17interface DataSourceClient {
18  // Invoked to report |error| from the DataSource, at |error_location| bytes
19  // into the data stream. No further bytes beyond |error_location| will be
20  // transmitted from the DataSource until Resume() is called.
21  OnError(uint32 error_location, int32 error);
22};
23
24[Client=DataSinkClient]
25interface DataSink {
26  // Initializes this DataSink with a data pipe handle to use for data
27  // transmission.
28  Init(handle<data_pipe_consumer> consumer_handle);
29
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
35interface DataSinkClient {
36  // Reports that the sink has successfully received |bytes_sent| bytes of data.
37  ReportBytesSent(uint32 bytes_sent);
38
39  // Reports that the sink has received |bytes_sent| bytes of data (possibly 0)
40  // and encountered an error: |error|. The client should respond with
41  // |bytes_to_flush|, the number of bytes enqueued in the data pipe but not yet
42  // acked so the correct number of bytes can be flushed from the pipe.
43  ReportBytesSentAndError(uint32 bytes_sent, int32 error) => (uint32 bytes_to_flush);
44};
45
46}
47