gecko-dev/dom/fmradio/ipc/PFMRadio.ipdl

138 строки
2.7 KiB
Plaintext

/* 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
{
};
struct EnableRDSArgs
{
};
struct DisableRDSArgs
{
};
union FMRadioRequestArgs
{
EnableRequestArgs;
DisableRequestArgs;
SetFrequencyRequestArgs;
SeekRequestArgs;
CancelSeekRequestArgs;
EnableRDSArgs;
DisableRDSArgs;
};
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.
*/
async NotifyFrequencyChanged(double frequency);
/**
* Sent when the power state of FM radio HW is changed.
*/
async NotifyEnabledChanged(bool enabled, double frequency);
/**
* Sent when RDS is enabled or disabled.
*/
async NotifyRDSEnabledChanged(bool enabled);
/**
* Sent when we have a new PI code.
*/
async NotifyPIChanged(bool valid, uint16_t code);
/**
* Sent when we have a new PTY
*/
async NotifyPTYChanged(bool valid, uint8_t pty);
/**
* Sent when we have a new PS name.
*/
async NotifyPSChanged(nsString psname);
/**
* Sent when we have new radiotext.
*/
async NotifyRadiotextChanged(nsString radiotext);
/**
* Sent when a full RDS group is received.
*/
async NotifyNewRDSGroup(uint64_t data);
async __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.
*/
async PFMRadioRequest(FMRadioRequestArgs requestType);
/**
* Enable/Disable audio
*/
async EnableAudio(bool audioEnabled);
/**
* Set RDS group mask
*/
async SetRDSGroupMask(uint32_t groupMask);
};
} // namespace dom
} // namespace mozilla