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 // Use the <code>chrome.copresencePrivate</code> API to interface with Chrome | 5 // Use the <code>chrome.copresencePrivate</code> API to interface with Chrome |
6 // from the whispernet_proxy extension. | 6 // from the whispernet_proxy extension. |
7 namespace copresencePrivate { | 7 namespace copresencePrivate { |
8 | 8 |
9 dictionary PlayParameters { | 9 dictionary PlayParameters { |
10 double sampleRate; | 10 double sampleRate; |
11 long bitsPerSample; | 11 long bitsPerSample; |
12 double carrierFrequency; | 12 double carrierFrequency; |
13 long repetitions; | 13 long repetitions; |
14 }; | 14 }; |
15 | 15 |
16 dictionary RecordParameters { | 16 dictionary RecordParameters { |
17 double sampleRate; | 17 double sampleRate; |
18 long bitsPerSample; | 18 long bitsPerSample; |
19 long channels; | 19 long channels; |
20 double carrierFrequency; | 20 double carrierFrequency; |
21 }; | 21 }; |
22 | 22 |
23 dictionary AudioParameters { | 23 dictionary AudioParameters { |
24 PlayParameters play; | 24 PlayParameters play; |
25 RecordParameters record; | 25 RecordParameters record; |
26 }; | 26 }; |
27 | 27 |
| 28 dictionary Token { |
| 29 DOMString token; |
| 30 boolean audible; |
| 31 }; |
| 32 |
28 interface Functions { | 33 interface Functions { |
29 // Send a boolean indicating whether our initialization was successful. | 34 // Send a boolean indicating whether our initialization was successful. |
30 static void sendInitialized(boolean success); | 35 static void sendInitialized(boolean success); |
31 // Sends an array of found tokens to Chrome. | 36 // Sends an array of found tokens to Chrome. |
32 static void sendFound(DOMString[] tokens); | 37 static void sendFound(Token[] tokens); |
33 // Send an array buffer of samples encoded for the specified token. | 38 // Send an array buffer of samples encoded for the specified token. |
34 static void sendSamples(DOMString token, ArrayBuffer samples); | 39 static void sendSamples(Token token, ArrayBuffer samples); |
35 // Send a boolean indicating whether we detected a broadcast or not. | 40 // Send a boolean indicating whether we detected a broadcast or not. |
36 static void sendDetect(boolean detected); | 41 static void sendDetect(boolean detected); |
37 }; | 42 }; |
38 | 43 |
39 interface Events { | 44 interface Events { |
40 // Fired to request initialization of the whisper.net library. | 45 // Fired to request initialization of the whisper.net library. |
41 static void onInitialize(AudioParameters audioParams); | 46 static void onInitialize(AudioParameters audioParams); |
42 // Fired to request encoding of the given token. | 47 // Fired to request encoding of the given token. |
43 static void onEncodeTokenRequest(DOMString base64Token, boolean audible); | 48 static void onEncodeTokenRequest(DOMString base64Token, boolean audible); |
44 // Fired when we have new samples to decode. | 49 // Fired when we have new samples to decode. |
45 static void onDecodeSamplesRequest(ArrayBuffer audioSamples); | 50 static void onDecodeSamplesRequest(ArrayBuffer audioSamples); |
46 // Fired to request a DetectBroadcast. | 51 // Fired to request a DetectBroadcast. |
47 static void onDetectBroadcastRequest(); | 52 static void onDetectBroadcastRequest(); |
48 }; | 53 }; |
49 }; | 54 }; |
OLD | NEW |