Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | |
michael@0 | 6 | include protocol PContent; |
michael@0 | 7 | include protocol PFMRadioRequest; |
michael@0 | 8 | |
michael@0 | 9 | using mozilla::hal::FMRadioSeekDirection from "mozilla/HalTypes.h"; |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | namespace dom { |
michael@0 | 13 | |
michael@0 | 14 | struct EnableRequestArgs |
michael@0 | 15 | { |
michael@0 | 16 | double frequency; |
michael@0 | 17 | }; |
michael@0 | 18 | |
michael@0 | 19 | struct DisableRequestArgs |
michael@0 | 20 | { |
michael@0 | 21 | }; |
michael@0 | 22 | |
michael@0 | 23 | struct SetFrequencyRequestArgs |
michael@0 | 24 | { |
michael@0 | 25 | double frequency; |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | struct SeekRequestArgs |
michael@0 | 29 | { |
michael@0 | 30 | FMRadioSeekDirection direction; |
michael@0 | 31 | }; |
michael@0 | 32 | |
michael@0 | 33 | struct CancelSeekRequestArgs |
michael@0 | 34 | { |
michael@0 | 35 | }; |
michael@0 | 36 | |
michael@0 | 37 | union FMRadioRequestArgs |
michael@0 | 38 | { |
michael@0 | 39 | EnableRequestArgs; |
michael@0 | 40 | DisableRequestArgs; |
michael@0 | 41 | SetFrequencyRequestArgs; |
michael@0 | 42 | SeekRequestArgs; |
michael@0 | 43 | CancelSeekRequestArgs; |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | struct StatusInfo |
michael@0 | 47 | { |
michael@0 | 48 | bool enabled; |
michael@0 | 49 | double frequency; |
michael@0 | 50 | double upperBound; |
michael@0 | 51 | double lowerBound; |
michael@0 | 52 | double channelWidth; |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | sync protocol PFMRadio |
michael@0 | 56 | { |
michael@0 | 57 | manager PContent; |
michael@0 | 58 | manages PFMRadioRequest; |
michael@0 | 59 | |
michael@0 | 60 | child: |
michael@0 | 61 | /** |
michael@0 | 62 | * Sent when the frequency is changed. |
michael@0 | 63 | */ |
michael@0 | 64 | NotifyFrequencyChanged(double frequency); |
michael@0 | 65 | /** |
michael@0 | 66 | * Sent when the power state of FM radio HW is changed. |
michael@0 | 67 | */ |
michael@0 | 68 | NotifyEnabledChanged(bool enabled, double frequency); |
michael@0 | 69 | |
michael@0 | 70 | __delete__(); |
michael@0 | 71 | |
michael@0 | 72 | parent: |
michael@0 | 73 | /** |
michael@0 | 74 | * Get the current status infomation of FM radio HW synchronously. |
michael@0 | 75 | * Sent when the singleton object of FMRadioChild is initialized. |
michael@0 | 76 | */ |
michael@0 | 77 | sync GetStatusInfo() returns (StatusInfo info); |
michael@0 | 78 | |
michael@0 | 79 | /** |
michael@0 | 80 | * Send request to parent process to operate the FM radio HW. |
michael@0 | 81 | * |
michael@0 | 82 | * We don't have separate Enable/SetFrequency/etc. methods instead here, |
michael@0 | 83 | * because we can leverage the IPC messaging mechanism to manage the mapping |
michael@0 | 84 | * of the asynchronous request and the DOMRequest we returned to the caller |
michael@0 | 85 | * on web content, otherwise, we have to do the mapping stuff manually which |
michael@0 | 86 | * is more error prone. |
michael@0 | 87 | */ |
michael@0 | 88 | PFMRadioRequest(FMRadioRequestArgs requestType); |
michael@0 | 89 | |
michael@0 | 90 | /** |
michael@0 | 91 | * Enable/Disable audio |
michael@0 | 92 | */ |
michael@0 | 93 | EnableAudio(bool audioEnabled); |
michael@0 | 94 | }; |
michael@0 | 95 | |
michael@0 | 96 | } // namespace dom |
michael@0 | 97 | } // namespace mozilla |
michael@0 | 98 |