1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/fmradio/ipc/PFMRadio.ipdl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,98 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 + 1.9 +include protocol PContent; 1.10 +include protocol PFMRadioRequest; 1.11 + 1.12 +using mozilla::hal::FMRadioSeekDirection from "mozilla/HalTypes.h"; 1.13 + 1.14 +namespace mozilla { 1.15 +namespace dom { 1.16 + 1.17 +struct EnableRequestArgs 1.18 +{ 1.19 + double frequency; 1.20 +}; 1.21 + 1.22 +struct DisableRequestArgs 1.23 +{ 1.24 +}; 1.25 + 1.26 +struct SetFrequencyRequestArgs 1.27 +{ 1.28 + double frequency; 1.29 +}; 1.30 + 1.31 +struct SeekRequestArgs 1.32 +{ 1.33 + FMRadioSeekDirection direction; 1.34 +}; 1.35 + 1.36 +struct CancelSeekRequestArgs 1.37 +{ 1.38 +}; 1.39 + 1.40 +union FMRadioRequestArgs 1.41 +{ 1.42 + EnableRequestArgs; 1.43 + DisableRequestArgs; 1.44 + SetFrequencyRequestArgs; 1.45 + SeekRequestArgs; 1.46 + CancelSeekRequestArgs; 1.47 +}; 1.48 + 1.49 +struct StatusInfo 1.50 +{ 1.51 + bool enabled; 1.52 + double frequency; 1.53 + double upperBound; 1.54 + double lowerBound; 1.55 + double channelWidth; 1.56 +}; 1.57 + 1.58 +sync protocol PFMRadio 1.59 +{ 1.60 + manager PContent; 1.61 + manages PFMRadioRequest; 1.62 + 1.63 +child: 1.64 + /** 1.65 + * Sent when the frequency is changed. 1.66 + */ 1.67 + NotifyFrequencyChanged(double frequency); 1.68 + /** 1.69 + * Sent when the power state of FM radio HW is changed. 1.70 + */ 1.71 + NotifyEnabledChanged(bool enabled, double frequency); 1.72 + 1.73 + __delete__(); 1.74 + 1.75 +parent: 1.76 + /** 1.77 + * Get the current status infomation of FM radio HW synchronously. 1.78 + * Sent when the singleton object of FMRadioChild is initialized. 1.79 + */ 1.80 + sync GetStatusInfo() returns (StatusInfo info); 1.81 + 1.82 + /** 1.83 + * Send request to parent process to operate the FM radio HW. 1.84 + * 1.85 + * We don't have separate Enable/SetFrequency/etc. methods instead here, 1.86 + * because we can leverage the IPC messaging mechanism to manage the mapping 1.87 + * of the asynchronous request and the DOMRequest we returned to the caller 1.88 + * on web content, otherwise, we have to do the mapping stuff manually which 1.89 + * is more error prone. 1.90 + */ 1.91 + PFMRadioRequest(FMRadioRequestArgs requestType); 1.92 + 1.93 + /** 1.94 + * Enable/Disable audio 1.95 + */ 1.96 + EnableAudio(bool audioEnabled); 1.97 +}; 1.98 + 1.99 +} // namespace dom 1.100 +} // namespace mozilla 1.101 +