1 : //
2 : // Automatically generated by ipdlc.
3 : // Edit at your own risk
4 : //
5 :
6 : #ifndef PHalChild_h
7 : #define PHalChild_h
8 :
9 : #include "mozilla/hal_sandbox/PHal.h"
10 : namespace mozilla {
11 : namespace dom {
12 : class PContentChild;
13 : } // namespace dom
14 : } // namespace mozilla
15 :
16 : namespace mozilla {
17 : namespace dom {
18 : class PBrowserChild;
19 : } // namespace dom
20 : } // namespace mozilla
21 :
22 : #ifdef DEBUG
23 : #include "prenv.h"
24 : #endif // DEBUG
25 : #include "base/id_map.h"
26 : #include "mozilla/ipc/RPCChannel.h"
27 :
28 :
29 : namespace mozilla {
30 : namespace dom {
31 : class PContentChild;
32 : } // namespace dom
33 : } // namespace mozilla
34 :
35 : namespace mozilla {
36 : namespace hal_sandbox {
37 :
38 :
39 : class /*NS_ABSTRACT_CLASS*/ PHalChild :
40 : protected mozilla::ipc::RPCChannel::RPCListener,
41 : protected mozilla::ipc::IProtocolManager<mozilla::ipc::RPCChannel::RPCListener>
42 : {
43 : friend class mozilla::dom::PContentChild;
44 :
45 : protected:
46 : typedef mozilla::ipc::ActorHandle ActorHandle;
47 : typedef mozilla::hal::BatteryInformation BatteryInformation;
48 : typedef mozilla::hal::LightConfiguration LightConfiguration;
49 : typedef mozilla::hal::SensorData SensorData;
50 : typedef mozilla::hal::NetworkInformation NetworkInformation;
51 : typedef mozilla::hal::WakeLockInformation WakeLockInformation;
52 : typedef mozilla::ipc::Shmem Shmem;
53 : typedef mozilla::hal::FlashMode FlashMode;
54 : typedef mozilla::hal::LightType LightType;
55 : typedef mozilla::hal::LightMode LightMode;
56 : typedef mozilla::hal::SensorType SensorType;
57 : typedef mozilla::hal::WakeLockControl WakeLockControl;
58 : typedef mozilla::dom::PContentChild PContentChild;
59 : typedef mozilla::dom::PBrowserChild PBrowserChild;
60 : typedef base::ProcessId ProcessId;
61 : typedef mozilla::ipc::ProtocolId ProtocolId;
62 : typedef mozilla::ipc::Transport Transport;
63 : typedef mozilla::ipc::TransportDescriptor TransportDescriptor;
64 :
65 : typedef PHal::State State;
66 :
67 : virtual bool
68 : RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo) = 0;
69 : virtual bool
70 : RecvNotifyNetworkChange(const NetworkInformation& aNetworkInfo) = 0;
71 : virtual bool
72 : RecvNotifyWakeLockChange(const WakeLockInformation& aWakeLockInfo) = 0;
73 : virtual bool
74 : RecvNotifySensorChange(const SensorData& aSensorData) = 0;
75 :
76 : virtual void
77 : ActorDestroy(ActorDestroyReason why);
78 :
79 : public:
80 : typedef IPC::Message Message;
81 : typedef mozilla::ipc::RPCChannel Channel;
82 : typedef mozilla::ipc::RPCChannel::RPCListener ChannelListener;
83 : typedef base::ProcessHandle ProcessHandle;
84 : typedef mozilla::ipc::AsyncChannel AsyncChannel;
85 : typedef mozilla::ipc::SharedMemory SharedMemory;
86 : typedef mozilla::ipc::Trigger Trigger;
87 :
88 : public:
89 : PHalChild();
90 :
91 : virtual ~PHalChild();
92 :
93 : PContentChild*
94 : Manager();
95 :
96 : PHal::State
97 : state();
98 :
99 : bool
100 : SendVibrate(
101 : const InfallibleTArray<uint32>& pattern,
102 : const InfallibleTArray<uint64>& id,
103 : PBrowserChild* browser);
104 :
105 : bool
106 : SendCancelVibrate(
107 : const InfallibleTArray<uint64>& id,
108 : PBrowserChild* browser);
109 :
110 : bool
111 : SendEnableBatteryNotifications();
112 :
113 : bool
114 : SendDisableBatteryNotifications();
115 :
116 : bool
117 : SendGetCurrentBatteryInformation(BatteryInformation* aBatteryInfo);
118 :
119 : bool
120 : SendEnableNetworkNotifications();
121 :
122 : bool
123 : SendDisableNetworkNotifications();
124 :
125 : bool
126 : SendGetCurrentNetworkInformation(NetworkInformation* aNetworkInfo);
127 :
128 : bool
129 : SendGetScreenEnabled(bool* enabled);
130 :
131 : bool
132 : SendSetScreenEnabled(const bool& enabled);
133 :
134 : bool
135 : SendGetScreenBrightness(double* brightness);
136 :
137 : bool
138 : SendSetScreenBrightness(const double& brightness);
139 :
140 : bool
141 : SendAdjustSystemClock(const int32& aDeltaMilliseconds);
142 :
143 : bool
144 : SendSetTimezone(const nsCString& aTimezoneSpec);
145 :
146 : bool
147 : SendSetLight(
148 : const LightType& light,
149 : const LightConfiguration& aConfig,
150 : bool* status);
151 :
152 : bool
153 : SendGetLight(
154 : const LightType& light,
155 : LightConfiguration* aConfig,
156 : bool* status);
157 :
158 : bool
159 : SendReboot();
160 :
161 : bool
162 : SendPowerOff();
163 :
164 : bool
165 : SendModifyWakeLock(
166 : const nsString& aTopic,
167 : const WakeLockControl& aLockAdjust,
168 : const WakeLockControl& aHiddenAdjust);
169 :
170 : bool
171 : SendEnableWakeLockNotifications();
172 :
173 : bool
174 : SendDisableWakeLockNotifications();
175 :
176 : bool
177 : SendGetWakeLockInfo(
178 : const nsString& aTopic,
179 : WakeLockInformation* aWakeLockInfo);
180 :
181 : bool
182 : SendEnableSensorNotifications(const SensorType& aSensor);
183 :
184 : bool
185 : SendDisableSensorNotifications(const SensorType& aSensor);
186 :
187 : static bool
188 : Send__delete__(PHalChild* actor);
189 :
190 : virtual int32
191 : Register(ChannelListener* aRouted);
192 : virtual int32
193 : RegisterID(
194 : ChannelListener* aRouted,
195 : int32 aId);
196 : virtual ChannelListener*
197 : Lookup(int32 aId);
198 : virtual void
199 : Unregister(int32 aId);
200 : virtual void
201 : RemoveManagee(
202 : int32 aProtocolId,
203 : ChannelListener* aListener);
204 : virtual Shmem::SharedMemory*
205 : CreateSharedMemory(
206 : size_t aSize,
207 : Shmem::SharedMemory::SharedMemoryType type,
208 : bool unsafe,
209 : Shmem::id_t* aId);
210 : virtual bool
211 : AdoptSharedMemory(
212 : Shmem::SharedMemory* segment,
213 : Shmem::id_t* aId);
214 : virtual Shmem::SharedMemory*
215 : LookupSharedMemory(Shmem::id_t aId);
216 : virtual bool
217 : IsTrackingSharedMemory(Shmem::SharedMemory* segment);
218 : virtual bool
219 : DestroySharedMemory(Shmem& aShmem);
220 : virtual ProcessHandle
221 : OtherProcess() const;
222 : virtual AsyncChannel*
223 : GetIPCChannel();
224 :
225 : virtual Result
226 : OnMessageReceived(const Message& __msg);
227 :
228 : virtual Result
229 : OnMessageReceived(
230 : const Message& __msg,
231 : Message*& __reply);
232 :
233 : virtual Result
234 : OnCallReceived(
235 : const Message& __msg,
236 : Message*& __reply);
237 :
238 : void
239 : OnProcessingError(Result code);
240 :
241 : bool
242 : OnReplyTimeout();
243 :
244 : void
245 : OnChannelClose();
246 :
247 : void
248 : OnChannelError();
249 :
250 : void
251 : OnChannelConnected(int32 pid);
252 :
253 : // Methods for managing shmem
254 : bool
255 : AllocShmem(
256 : size_t aSize,
257 : Shmem::SharedMemory::SharedMemoryType aType,
258 : Shmem* aMem);
259 :
260 : bool
261 : AllocUnsafeShmem(
262 : size_t aSize,
263 : Shmem::SharedMemory::SharedMemoryType aType,
264 : Shmem* aMem);
265 :
266 : bool
267 : AdoptShmem(
268 : Shmem& aMem,
269 : Shmem* aOutMem);
270 :
271 : bool
272 : DeallocShmem(Shmem& aMem);
273 :
274 : private:
275 : virtual void
276 : FatalError(const char* const msg) const;
277 :
278 : void
279 : DestroySubtree(ActorDestroyReason why);
280 :
281 : void
282 : DeallocSubtree();
283 :
284 : template<typename T>
285 : void
286 0 : Write(
287 : const T& __v,
288 : Message* __msg)
289 : {
290 0 : IPC::WriteParam(__msg, __v);
291 0 : }
292 :
293 : template<typename T>
294 : bool
295 0 : Read(
296 : T* __v,
297 : const Message* __msg,
298 : void** __iter)
299 : {
300 0 : return IPC::ReadParam(__msg, __iter, __v);
301 : }
302 :
303 : void
304 : Write(
305 : const LightConfiguration& __v,
306 : Message* __msg);
307 :
308 : bool
309 : Read(
310 : LightConfiguration* __v,
311 : const Message* __msg,
312 : void** __iter) NS_WARN_UNUSED_RESULT;
313 :
314 : void
315 : Write(
316 : PBrowserChild* __v,
317 : Message* __msg,
318 : bool __nullable);
319 :
320 : bool
321 : Read(
322 : PBrowserChild** __v,
323 : const Message* __msg,
324 : void** __iter,
325 : bool __nullable) NS_WARN_UNUSED_RESULT;
326 :
327 : void
328 : Write(
329 : const BatteryInformation& __v,
330 : Message* __msg);
331 :
332 : bool
333 : Read(
334 : BatteryInformation* __v,
335 : const Message* __msg,
336 : void** __iter) NS_WARN_UNUSED_RESULT;
337 :
338 : void
339 : Write(
340 : const WakeLockInformation& __v,
341 : Message* __msg);
342 :
343 : bool
344 : Read(
345 : WakeLockInformation* __v,
346 : const Message* __msg,
347 : void** __iter) NS_WARN_UNUSED_RESULT;
348 :
349 : void
350 : Write(
351 : const NetworkInformation& __v,
352 : Message* __msg);
353 :
354 : bool
355 : Read(
356 : NetworkInformation* __v,
357 : const Message* __msg,
358 : void** __iter) NS_WARN_UNUSED_RESULT;
359 :
360 : void
361 : Write(
362 : const SensorData& __v,
363 : Message* __msg);
364 :
365 : bool
366 : Read(
367 : SensorData* __v,
368 : const Message* __msg,
369 : void** __iter) NS_WARN_UNUSED_RESULT;
370 :
371 : void
372 : Write(
373 : PHalChild* __v,
374 : Message* __msg,
375 : bool __nullable);
376 :
377 : bool
378 : Read(
379 : PHalChild** __v,
380 : const Message* __msg,
381 : void** __iter,
382 : bool __nullable) NS_WARN_UNUSED_RESULT;
383 :
384 : Channel* mChannel;
385 : int32 mId;
386 : mozilla::ipc::IProtocolManager<mozilla::ipc::RPCChannel::RPCListener>* mManager;
387 : State mState;
388 : };
389 :
390 :
391 : } // namespace hal_sandbox
392 : } // namespace mozilla
393 :
394 : #if 0
395 :
396 : //-----------------------------------------------------------------------------
397 : // Skeleton implementation of abstract actor class
398 :
399 : // Header file contents
400 : namespace mozilla {
401 : namespace hal_sandbox {
402 : class HalChild :
403 : public PHalChild
404 : {
405 : virtual bool
406 : RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo);
407 :
408 : virtual bool
409 : RecvNotifyNetworkChange(const NetworkInformation& aNetworkInfo);
410 :
411 : virtual bool
412 : RecvNotifyWakeLockChange(const WakeLockInformation& aWakeLockInfo);
413 :
414 : virtual bool
415 : RecvNotifySensorChange(const SensorData& aSensorData);
416 :
417 : HalChild();
418 : virtual ~HalChild();
419 : };
420 : } // namespace hal_sandbox
421 : } // namespace mozilla
422 :
423 :
424 : // C++ file contents
425 : namespace mozilla {
426 : namespace hal_sandbox {
427 : bool
428 : HalChild::RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo)
429 : {
430 : return false;
431 : }
432 :
433 : bool
434 : HalChild::RecvNotifyNetworkChange(const NetworkInformation& aNetworkInfo)
435 : {
436 : return false;
437 : }
438 :
439 : bool
440 : HalChild::RecvNotifyWakeLockChange(const WakeLockInformation& aWakeLockInfo)
441 : {
442 : return false;
443 : }
444 :
445 : bool
446 : HalChild::RecvNotifySensorChange(const SensorData& aSensorData)
447 : {
448 : return false;
449 : }
450 :
451 : HalChild::HalChild()
452 : {
453 : MOZ_COUNT_CTOR(HalChild);
454 : }
455 :
456 : HalChild::~HalChild()
457 : {
458 : MOZ_COUNT_DTOR(HalChild);
459 : }
460 :
461 : } // namespace hal_sandbox
462 : } // namespace mozilla
463 : #endif // if 0
464 :
465 : #endif // ifndef PHalChild_h
|