|
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 #ifndef mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ |
|
8 #define mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ |
|
9 |
|
10 #include "BluetoothService.h" |
|
11 |
|
12 namespace mozilla { |
|
13 namespace ipc { |
|
14 class UnixSocketConsumer; |
|
15 } |
|
16 namespace dom { |
|
17 namespace bluetooth { |
|
18 |
|
19 class BluetoothChild; |
|
20 |
|
21 } // namespace bluetooth |
|
22 } // namespace dom |
|
23 } // namespace mozilla |
|
24 |
|
25 |
|
26 BEGIN_BLUETOOTH_NAMESPACE |
|
27 |
|
28 class BluetoothServiceChildProcess : public BluetoothService |
|
29 { |
|
30 friend class mozilla::dom::bluetooth::BluetoothChild; |
|
31 |
|
32 public: |
|
33 static BluetoothServiceChildProcess* |
|
34 Create(); |
|
35 |
|
36 virtual void |
|
37 RegisterBluetoothSignalHandler(const nsAString& aNodeName, |
|
38 BluetoothSignalObserver* aMsgHandler) |
|
39 MOZ_OVERRIDE; |
|
40 |
|
41 virtual void |
|
42 UnregisterBluetoothSignalHandler(const nsAString& aNodeName, |
|
43 BluetoothSignalObserver* aMsgHandler) |
|
44 MOZ_OVERRIDE; |
|
45 |
|
46 virtual nsresult |
|
47 GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
48 |
|
49 virtual nsresult |
|
50 GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses, |
|
51 BluetoothReplyRunnable* aRunnable) |
|
52 MOZ_OVERRIDE; |
|
53 |
|
54 virtual nsresult |
|
55 GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid, |
|
56 BluetoothReplyRunnable* aRunnable) |
|
57 MOZ_OVERRIDE; |
|
58 virtual nsresult |
|
59 StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
60 |
|
61 virtual nsresult |
|
62 StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
63 |
|
64 virtual nsresult |
|
65 SetProperty(BluetoothObjectType aType, |
|
66 const BluetoothNamedValue& aValue, |
|
67 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
68 |
|
69 virtual nsresult |
|
70 CreatePairedDeviceInternal(const nsAString& aAddress, |
|
71 int aTimeout, |
|
72 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
73 |
|
74 virtual nsresult |
|
75 RemoveDeviceInternal(const nsAString& aObjectPath, |
|
76 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
77 |
|
78 virtual nsresult |
|
79 GetServiceChannel(const nsAString& aDeviceAddress, |
|
80 const nsAString& aServiceUuid, |
|
81 BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; |
|
82 |
|
83 virtual bool |
|
84 UpdateSdpRecords(const nsAString& aDeviceAddress, |
|
85 BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; |
|
86 |
|
87 virtual bool |
|
88 SetPinCodeInternal(const nsAString& aDeviceAddress, |
|
89 const nsAString& aPinCode, |
|
90 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
91 |
|
92 virtual bool |
|
93 SetPasskeyInternal(const nsAString& aDeviceAddress, |
|
94 uint32_t aPasskey, |
|
95 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
96 |
|
97 virtual bool |
|
98 SetPairingConfirmationInternal(const nsAString& aDeviceAddress, |
|
99 bool aConfirm, |
|
100 BluetoothReplyRunnable* aRunnable) |
|
101 MOZ_OVERRIDE; |
|
102 |
|
103 virtual void |
|
104 Connect(const nsAString& aDeviceAddress, |
|
105 uint32_t aCod, |
|
106 uint16_t aServiceUuid, |
|
107 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
108 |
|
109 virtual void |
|
110 Disconnect(const nsAString& aDeviceAddress, |
|
111 uint16_t aServiceUuid, |
|
112 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
113 |
|
114 virtual bool |
|
115 IsConnected(uint16_t aServiceUuid) MOZ_OVERRIDE; |
|
116 |
|
117 virtual void |
|
118 SendFile(const nsAString& aDeviceAddress, |
|
119 BlobParent* aBlobParent, |
|
120 BlobChild* aBlobChild, |
|
121 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
122 |
|
123 virtual void |
|
124 SendFile(const nsAString& aDeviceAddress, |
|
125 nsIDOMBlob* aBlob, |
|
126 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
127 |
|
128 virtual void |
|
129 StopSendingFile(const nsAString& aDeviceAddress, |
|
130 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
131 |
|
132 virtual void |
|
133 ConfirmReceivingFile(const nsAString& aDeviceAddress, |
|
134 bool aConfirm, |
|
135 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
136 |
|
137 virtual void |
|
138 ConnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
139 |
|
140 virtual void |
|
141 DisconnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
142 |
|
143 virtual void |
|
144 IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
145 |
|
146 #ifdef MOZ_B2G_RIL |
|
147 virtual void |
|
148 AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
149 |
|
150 virtual void |
|
151 IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
152 |
|
153 virtual void |
|
154 ToggleCalls(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
155 #endif |
|
156 |
|
157 virtual void |
|
158 SendMetaData(const nsAString& aTitle, |
|
159 const nsAString& aArtist, |
|
160 const nsAString& aAlbum, |
|
161 int64_t aMediaNumber, |
|
162 int64_t aTotalMediaCount, |
|
163 int64_t aDuration, |
|
164 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
165 |
|
166 virtual void |
|
167 SendPlayStatus(int64_t aDuration, |
|
168 int64_t aPosition, |
|
169 const nsAString& aPlayStatus, |
|
170 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
|
171 |
|
172 virtual void |
|
173 UpdatePlayStatus(uint32_t aDuration, |
|
174 uint32_t aPosition, |
|
175 ControlPlayStatus aPlayStatus) MOZ_OVERRIDE; |
|
176 |
|
177 virtual nsresult |
|
178 SendSinkMessage(const nsAString& aDeviceAddresses, |
|
179 const nsAString& aMessage) MOZ_OVERRIDE; |
|
180 |
|
181 virtual nsresult |
|
182 SendInputMessage(const nsAString& aDeviceAddresses, |
|
183 const nsAString& aMessage) MOZ_OVERRIDE; |
|
184 |
|
185 protected: |
|
186 BluetoothServiceChildProcess(); |
|
187 virtual ~BluetoothServiceChildProcess(); |
|
188 |
|
189 void |
|
190 NoteDeadActor(); |
|
191 |
|
192 void |
|
193 NoteShutdownInitiated(); |
|
194 |
|
195 virtual nsresult |
|
196 HandleStartup() MOZ_OVERRIDE; |
|
197 |
|
198 virtual nsresult |
|
199 HandleShutdown() MOZ_OVERRIDE; |
|
200 |
|
201 private: |
|
202 // This method should never be called. |
|
203 virtual nsresult |
|
204 StartInternal() MOZ_OVERRIDE; |
|
205 |
|
206 // This method should never be called. |
|
207 virtual nsresult |
|
208 StopInternal() MOZ_OVERRIDE; |
|
209 |
|
210 bool |
|
211 IsSignalRegistered(const nsAString& aNodeName) { |
|
212 return !!mBluetoothSignalObserverTable.Get(aNodeName); |
|
213 } |
|
214 }; |
|
215 |
|
216 END_BLUETOOTH_NAMESPACE |
|
217 |
|
218 #endif // mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ |