dom/bluetooth/ipc/PBluetooth.ipdl

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:1bd942d488ec
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 include protocol PBlob;
8 include protocol PBluetoothRequest;
9 include protocol PContent;
10
11 include BluetoothTypes;
12
13 include "mozilla/dom/bluetooth/ipc/BluetoothMessageUtils.h";
14
15 using mozilla::dom::bluetooth::BluetoothObjectType from "mozilla/dom/bluetooth/BluetoothCommon.h";
16
17 namespace mozilla {
18 namespace dom {
19 namespace bluetooth {
20
21 /**
22 * Bluetooth request types.
23 */
24
25 struct DefaultAdapterPathRequest
26 { };
27
28 struct SetPropertyRequest
29 {
30 BluetoothObjectType type;
31 BluetoothNamedValue value;
32 };
33
34 struct GetPropertyRequest
35 {
36 BluetoothObjectType type;
37 nsString path;
38 };
39
40 struct StartDiscoveryRequest
41 {
42 };
43
44 struct StopDiscoveryRequest
45 {
46 };
47
48 struct PairRequest
49 {
50 nsString address;
51 uint32_t timeoutMS;
52 };
53
54 struct UnpairRequest
55 {
56 nsString address;
57 };
58
59 struct SetPinCodeRequest
60 {
61 nsString path;
62 nsString pincode;
63 };
64
65 struct SetPasskeyRequest
66 {
67 nsString path;
68 uint32_t passkey;
69 };
70
71 struct ConfirmPairingConfirmationRequest
72 {
73 nsString path;
74 };
75
76 struct DenyPairingConfirmationRequest
77 {
78 nsString path;
79 };
80
81 struct PairedDevicePropertiesRequest
82 {
83 nsString[] addresses;
84 };
85
86 struct ConnectedDevicePropertiesRequest
87 {
88 uint16_t serviceUuid;
89 };
90
91 struct ConnectRequest
92 {
93 nsString address;
94 uint32_t cod;
95 uint16_t serviceUuid;
96 };
97
98 struct DisconnectRequest
99 {
100 nsString address;
101 uint16_t serviceUuid;
102 };
103
104 struct SendFileRequest
105 {
106 nsString devicePath;
107 PBlob blob;
108 };
109
110 struct StopSendingFileRequest
111 {
112 nsString devicePath;
113 };
114
115 struct ConfirmReceivingFileRequest
116 {
117 nsString devicePath;
118 };
119
120 struct DenyReceivingFileRequest
121 {
122 nsString devicePath;
123 };
124
125 struct ConnectScoRequest
126 {
127 };
128
129 struct DisconnectScoRequest
130 {
131 };
132
133 struct IsScoConnectedRequest
134 {
135 };
136
137 struct AnswerWaitingCallRequest
138 {
139 };
140
141 struct IgnoreWaitingCallRequest
142 {
143 };
144
145 struct ToggleCallsRequest
146 {
147 };
148
149 struct SendMetaDataRequest
150 {
151 nsString title;
152 nsString artist;
153 nsString album;
154 int64_t mediaNumber;
155 int64_t totalMediaCount;
156 int64_t duration;
157 };
158
159 struct SendPlayStatusRequest
160 {
161 int64_t duration;
162 int64_t position;
163 nsString playStatus;
164 };
165
166 union Request
167 {
168 DefaultAdapterPathRequest;
169 SetPropertyRequest;
170 GetPropertyRequest;
171 StartDiscoveryRequest;
172 StopDiscoveryRequest;
173 PairRequest;
174 UnpairRequest;
175 SetPinCodeRequest;
176 SetPasskeyRequest;
177 ConfirmPairingConfirmationRequest;
178 DenyPairingConfirmationRequest;
179 ConnectedDevicePropertiesRequest;
180 PairedDevicePropertiesRequest;
181 ConnectRequest;
182 DisconnectRequest;
183 SendFileRequest;
184 StopSendingFileRequest;
185 ConfirmReceivingFileRequest;
186 DenyReceivingFileRequest;
187 ConnectScoRequest;
188 DisconnectScoRequest;
189 IsScoConnectedRequest;
190 AnswerWaitingCallRequest;
191 IgnoreWaitingCallRequest;
192 ToggleCallsRequest;
193 SendMetaDataRequest;
194 SendPlayStatusRequest;
195 };
196
197 protocol PBluetooth
198 {
199 manager PContent;
200 manages PBluetoothRequest;
201
202 /**
203 * The potential exists for a racy shutdown so the following sequence of
204 * messages is used to shutdown safely:
205 *
206 * 1. [BeginShutdown] (Parent -> Child [Optional])
207 * 2. StopNotifying (Child -> Parent)
208 * 3. NotificationsStopped (Parent -> Child)
209 * 4. __delete__() (Child -> Parent)
210 */
211
212 child:
213 /**
214 * Sent when a settings change has enabled or disabled the bluetooth firmware.
215 */
216 Enabled(bool enabled);
217
218 /**
219 * Sent when a bluetooth signal is broadcasted to child processes.
220 */
221 Notify(BluetoothSignal signal);
222
223 /**
224 * Sent when the parent process is about to be shut down. See shutdown note
225 * above.
226 */
227 BeginShutdown();
228
229 /**
230 * Sent to inform the child process that it will no longer receive any
231 * messages from the parent. See shutdown note above.
232 */
233 NotificationsStopped();
234
235 parent:
236 /**
237 * Sent when the child no longer needs to use bluetooth. See shutdown note
238 * above.
239 */
240 __delete__();
241
242 /**
243 * Sent when the child needs to receive signals related to the given node.
244 */
245 RegisterSignalHandler(nsString node);
246
247 /**
248 * Sent when the child no longer needs to receive signals related to the given
249 * node.
250 */
251 UnregisterSignalHandler(nsString node);
252
253 /**
254 * Sent when the child no longer needs to receive any messages from the
255 * parent. See shutdown note above.
256 */
257 StopNotifying();
258
259 /**
260 * Sent when the child makes an asynchronous request to the parent.
261 */
262 PBluetoothRequest(Request request);
263
264 /**
265 * FIXME: Bug 547703.
266 *
267 * This is the state machine we want:
268 *
269 * start state NOTIFYING:
270 * send Enabled goto NOTIFYING;
271 * send Notify goto NOTIFYING;
272 * recv RegisterSignalHandler goto NOTIFYING;
273 * recv UnregisterSignalHandler goto NOTIFYING;
274 * send BeginShutdown goto PARENT_DONE;
275 * recv StopNotifying goto CHILD_DONE;
276 *
277 * state PARENT_DONE:
278 * recv RegisterSignalHandler goto PARENT_DONE;
279 * recv UnregisterSignalHandler goto PARENT_DONE;
280 * recv StopNotifying goto CHILD_DONE;
281 *
282 * state CHILD_DONE:
283 * send Enabled goto CHILD_DONE;
284 * send Notify goto CHILD_DONE;
285 * send BeginShutdown goto CHILD_DONE;
286 * send NotificationsStopped goto DONE;
287 *
288 * state DONE:
289 * recv __delete__;
290 */
291 };
292
293 } // namespace bluetooth
294 } // namespace dom
295 } // namespace mozilla

mercurial