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