diff -r 000000000000 -r 6474c204b198 dom/fmradio/ipc/PFMRadio.ipdl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dom/fmradio/ipc/PFMRadio.ipdl Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,98 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +include protocol PContent; +include protocol PFMRadioRequest; + +using mozilla::hal::FMRadioSeekDirection from "mozilla/HalTypes.h"; + +namespace mozilla { +namespace dom { + +struct EnableRequestArgs +{ + double frequency; +}; + +struct DisableRequestArgs +{ +}; + +struct SetFrequencyRequestArgs +{ + double frequency; +}; + +struct SeekRequestArgs +{ + FMRadioSeekDirection direction; +}; + +struct CancelSeekRequestArgs +{ +}; + +union FMRadioRequestArgs +{ + EnableRequestArgs; + DisableRequestArgs; + SetFrequencyRequestArgs; + SeekRequestArgs; + CancelSeekRequestArgs; +}; + +struct StatusInfo +{ + bool enabled; + double frequency; + double upperBound; + double lowerBound; + double channelWidth; +}; + +sync protocol PFMRadio +{ + manager PContent; + manages PFMRadioRequest; + +child: + /** + * Sent when the frequency is changed. + */ + NotifyFrequencyChanged(double frequency); + /** + * Sent when the power state of FM radio HW is changed. + */ + NotifyEnabledChanged(bool enabled, double frequency); + + __delete__(); + +parent: + /** + * Get the current status infomation of FM radio HW synchronously. + * Sent when the singleton object of FMRadioChild is initialized. + */ + sync GetStatusInfo() returns (StatusInfo info); + + /** + * Send request to parent process to operate the FM radio HW. + * + * We don't have separate Enable/SetFrequency/etc. methods instead here, + * because we can leverage the IPC messaging mechanism to manage the mapping + * of the asynchronous request and the DOMRequest we returned to the caller + * on web content, otherwise, we have to do the mapping stuff manually which + * is more error prone. + */ + PFMRadioRequest(FMRadioRequestArgs requestType); + + /** + * Enable/Disable audio + */ + EnableAudio(bool audioEnabled); +}; + +} // namespace dom +} // namespace mozilla +