Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 interface FMRadio : EventTarget {
6 /* Indicates if the FM radio is enabled. */
7 readonly attribute boolean enabled;
9 /* Indicates if the antenna is plugged and available. */
10 readonly attribute boolean antennaAvailable;
12 /**
13 * Current frequency in MHz. The value will be null if the FM radio is
14 * disabled.
15 */
16 readonly attribute double? frequency;
18 /* The upper bound of frequency in MHz. */
19 readonly attribute double frequencyUpperBound;
21 /* The lower bound of frequency in MHz. */
22 readonly attribute double frequencyLowerBound;
24 /**
25 * The difference in frequency between two "adjacent" channels, in MHz. That
26 * is, any two radio channels' frequencies differ by at least channelWidth
27 * MHz. Usually, the value is one of:
28 * - 0.05 MHz
29 * - 0.1 MHz
30 * - 0.2 MHz
31 */
32 readonly attribute double channelWidth;
34 /* Fired when the FM radio is enabled. */
35 attribute EventHandler onenabled;
37 /* Fired when the FM radio is disabled. */
38 attribute EventHandler ondisabled;
40 /**
41 * Fired when the antenna becomes available or unavailable, i.e., fired when
42 * the antennaAvailable attribute changes.
43 */
44 attribute EventHandler onantennaavailablechange;
46 /* Fired when the FM radio's frequency is changed. */
47 attribute EventHandler onfrequencychange;
49 /**
50 * Power the FM radio off. The disabled event will be fired if this request
51 * completes successfully.
52 */
53 DOMRequest disable();
55 /**
56 * Power the FM radio on, and tune the radio to the given frequency in MHz.
57 * This will fail if the given frequency is out of range. The enabled event
58 * and frequencychange event will be fired if this request completes
59 * successfully.
60 */
61 DOMRequest enable(double frequency);
63 /**
64 * Tune the FM radio to the given frequency. This will fail if the given
65 * frequency is out of range.
66 *
67 * Note that the FM radio may not tuned to the exact frequency given. To get
68 * the frequency the radio is actually tuned to, wait for the request to fire
69 * sucess (or wait for the frequencychange event to fire), and then read the
70 * frequency attribute.
71 */
72 DOMRequest setFrequency(double frequency);
74 /**
75 * Tell the FM radio to seek up to the next channel. If the frequency is
76 * successfully changed, the frequencychange event will be triggered.
77 *
78 * Only one seek is allowed at once: If the radio is seeking when the seekUp
79 * is called, error will be fired.
80 */
81 DOMRequest seekUp();
83 /**
84 * Tell the FM radio to seek down to the next channel. If the frequency is
85 * successfully changed, the frequencychange event will be triggered.
86 *
87 * Only one seek is allowed at once: If the radio is seeking when the
88 * seekDown is called, error will be fired.
89 */
90 DOMRequest seekDown();
92 /**
93 * Cancel the seek action. If the radio is not currently seeking up or down,
94 * error will be fired.
95 */
96 DOMRequest cancelSeek();
97 };