dom/webidl/FMRadio.webidl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial