|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 |
|
6 include protocol PContent; |
|
7 include protocol PFMRadioRequest; |
|
8 |
|
9 using mozilla::hal::FMRadioSeekDirection from "mozilla/HalTypes.h"; |
|
10 |
|
11 namespace mozilla { |
|
12 namespace dom { |
|
13 |
|
14 struct EnableRequestArgs |
|
15 { |
|
16 double frequency; |
|
17 }; |
|
18 |
|
19 struct DisableRequestArgs |
|
20 { |
|
21 }; |
|
22 |
|
23 struct SetFrequencyRequestArgs |
|
24 { |
|
25 double frequency; |
|
26 }; |
|
27 |
|
28 struct SeekRequestArgs |
|
29 { |
|
30 FMRadioSeekDirection direction; |
|
31 }; |
|
32 |
|
33 struct CancelSeekRequestArgs |
|
34 { |
|
35 }; |
|
36 |
|
37 union FMRadioRequestArgs |
|
38 { |
|
39 EnableRequestArgs; |
|
40 DisableRequestArgs; |
|
41 SetFrequencyRequestArgs; |
|
42 SeekRequestArgs; |
|
43 CancelSeekRequestArgs; |
|
44 }; |
|
45 |
|
46 struct StatusInfo |
|
47 { |
|
48 bool enabled; |
|
49 double frequency; |
|
50 double upperBound; |
|
51 double lowerBound; |
|
52 double channelWidth; |
|
53 }; |
|
54 |
|
55 sync protocol PFMRadio |
|
56 { |
|
57 manager PContent; |
|
58 manages PFMRadioRequest; |
|
59 |
|
60 child: |
|
61 /** |
|
62 * Sent when the frequency is changed. |
|
63 */ |
|
64 NotifyFrequencyChanged(double frequency); |
|
65 /** |
|
66 * Sent when the power state of FM radio HW is changed. |
|
67 */ |
|
68 NotifyEnabledChanged(bool enabled, double frequency); |
|
69 |
|
70 __delete__(); |
|
71 |
|
72 parent: |
|
73 /** |
|
74 * Get the current status infomation of FM radio HW synchronously. |
|
75 * Sent when the singleton object of FMRadioChild is initialized. |
|
76 */ |
|
77 sync GetStatusInfo() returns (StatusInfo info); |
|
78 |
|
79 /** |
|
80 * Send request to parent process to operate the FM radio HW. |
|
81 * |
|
82 * We don't have separate Enable/SetFrequency/etc. methods instead here, |
|
83 * because we can leverage the IPC messaging mechanism to manage the mapping |
|
84 * of the asynchronous request and the DOMRequest we returned to the caller |
|
85 * on web content, otherwise, we have to do the mapping stuff manually which |
|
86 * is more error prone. |
|
87 */ |
|
88 PFMRadioRequest(FMRadioRequestArgs requestType); |
|
89 |
|
90 /** |
|
91 * Enable/Disable audio |
|
92 */ |
|
93 EnableAudio(bool audioEnabled); |
|
94 }; |
|
95 |
|
96 } // namespace dom |
|
97 } // namespace mozilla |
|
98 |