dom/bluetooth/ipc/BluetoothParent.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_dom_bluetooth_ipc_bluetoothparent_h__
michael@0 8 #define mozilla_dom_bluetooth_ipc_bluetoothparent_h__
michael@0 9
michael@0 10 #include "mozilla/dom/bluetooth/BluetoothCommon.h"
michael@0 11
michael@0 12 #include "mozilla/dom/bluetooth/PBluetoothParent.h"
michael@0 13 #include "mozilla/dom/bluetooth/PBluetoothRequestParent.h"
michael@0 14
michael@0 15 #include "mozilla/Attributes.h"
michael@0 16 #include "mozilla/Observer.h"
michael@0 17 #include "nsAutoPtr.h"
michael@0 18 #include "nsTArray.h"
michael@0 19 #include "nsThreadUtils.h"
michael@0 20
michael@0 21 template <class T>
michael@0 22 class nsRevocableEventPtr;
michael@0 23
michael@0 24 namespace mozilla {
michael@0 25 namespace dom {
michael@0 26
michael@0 27 class ContentParent;
michael@0 28
michael@0 29 } // namespace dom
michael@0 30 } // namespace mozilla
michael@0 31
michael@0 32 BEGIN_BLUETOOTH_NAMESPACE
michael@0 33
michael@0 34 class BluetoothService;
michael@0 35
michael@0 36 /*******************************************************************************
michael@0 37 * BluetoothParent
michael@0 38 ******************************************************************************/
michael@0 39
michael@0 40 class BluetoothParent : public PBluetoothParent,
michael@0 41 public mozilla::Observer<BluetoothSignal>
michael@0 42 {
michael@0 43 friend class mozilla::dom::ContentParent;
michael@0 44
michael@0 45 enum ShutdownState
michael@0 46 {
michael@0 47 Running = 0,
michael@0 48 SentBeginShutdown,
michael@0 49 ReceivedStopNotifying,
michael@0 50 SentNotificationsStopped,
michael@0 51 Dead
michael@0 52 };
michael@0 53
michael@0 54 nsRefPtr<BluetoothService> mService;
michael@0 55 ShutdownState mShutdownState;
michael@0 56 bool mReceivedStopNotifying;
michael@0 57 bool mSentBeginShutdown;
michael@0 58
michael@0 59 public:
michael@0 60 void
michael@0 61 BeginShutdown();
michael@0 62
michael@0 63 protected:
michael@0 64 BluetoothParent();
michael@0 65 virtual ~BluetoothParent();
michael@0 66
michael@0 67 bool
michael@0 68 InitWithService(BluetoothService* aService);
michael@0 69
michael@0 70 virtual void
michael@0 71 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
michael@0 72
michael@0 73 virtual bool
michael@0 74 RecvRegisterSignalHandler(const nsString& aNode) MOZ_OVERRIDE;
michael@0 75
michael@0 76 virtual bool
michael@0 77 RecvUnregisterSignalHandler(const nsString& aNode) MOZ_OVERRIDE;
michael@0 78
michael@0 79 virtual bool
michael@0 80 RecvStopNotifying() MOZ_OVERRIDE;
michael@0 81
michael@0 82 virtual bool
michael@0 83 RecvPBluetoothRequestConstructor(PBluetoothRequestParent* aActor,
michael@0 84 const Request& aRequest) MOZ_OVERRIDE;
michael@0 85
michael@0 86 virtual PBluetoothRequestParent*
michael@0 87 AllocPBluetoothRequestParent(const Request& aRequest) MOZ_OVERRIDE;
michael@0 88
michael@0 89 virtual bool
michael@0 90 DeallocPBluetoothRequestParent(PBluetoothRequestParent* aActor) MOZ_OVERRIDE;
michael@0 91
michael@0 92 virtual void
michael@0 93 Notify(const BluetoothSignal& aSignal) MOZ_OVERRIDE;
michael@0 94
michael@0 95 private:
michael@0 96 void
michael@0 97 UnregisterAllSignalHandlers();
michael@0 98 };
michael@0 99
michael@0 100 /*******************************************************************************
michael@0 101 * BluetoothAdapterRequestParent
michael@0 102 ******************************************************************************/
michael@0 103
michael@0 104 class BluetoothRequestParent : public PBluetoothRequestParent
michael@0 105 {
michael@0 106 class ReplyRunnable;
michael@0 107 friend class BluetoothParent;
michael@0 108
michael@0 109 friend class ReplyRunnable;
michael@0 110
michael@0 111 nsRefPtr<BluetoothService> mService;
michael@0 112 nsRevocableEventPtr<ReplyRunnable> mReplyRunnable;
michael@0 113
michael@0 114 #ifdef DEBUG
michael@0 115 Request::Type mRequestType;
michael@0 116 #endif
michael@0 117
michael@0 118 protected:
michael@0 119 BluetoothRequestParent(BluetoothService* aService);
michael@0 120 virtual ~BluetoothRequestParent();
michael@0 121
michael@0 122 virtual void
michael@0 123 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
michael@0 124
michael@0 125 void
michael@0 126 RequestComplete();
michael@0 127
michael@0 128 bool
michael@0 129 DoRequest(const DefaultAdapterPathRequest& aRequest);
michael@0 130
michael@0 131 bool
michael@0 132 DoRequest(const SetPropertyRequest& aRequest);
michael@0 133
michael@0 134 bool
michael@0 135 DoRequest(const GetPropertyRequest& aRequest);
michael@0 136
michael@0 137 bool
michael@0 138 DoRequest(const StartDiscoveryRequest& aRequest);
michael@0 139
michael@0 140 bool
michael@0 141 DoRequest(const StopDiscoveryRequest& aRequest);
michael@0 142
michael@0 143 bool
michael@0 144 DoRequest(const PairRequest& aRequest);
michael@0 145
michael@0 146 bool
michael@0 147 DoRequest(const UnpairRequest& aRequest);
michael@0 148
michael@0 149 bool
michael@0 150 DoRequest(const PairedDevicePropertiesRequest& aRequest);
michael@0 151 bool
michael@0 152 DoRequest(const ConnectedDevicePropertiesRequest& aRequest);
michael@0 153
michael@0 154 bool
michael@0 155 DoRequest(const SetPinCodeRequest& aRequest);
michael@0 156
michael@0 157 bool
michael@0 158 DoRequest(const SetPasskeyRequest& aRequest);
michael@0 159
michael@0 160 bool
michael@0 161 DoRequest(const ConfirmPairingConfirmationRequest& aRequest);
michael@0 162
michael@0 163 bool
michael@0 164 DoRequest(const DenyPairingConfirmationRequest& aRequest);
michael@0 165
michael@0 166 bool
michael@0 167 DoRequest(const ConnectRequest& aRequest);
michael@0 168
michael@0 169 bool
michael@0 170 DoRequest(const DisconnectRequest& aRequest);
michael@0 171
michael@0 172 bool
michael@0 173 DoRequest(const SendFileRequest& aRequest);
michael@0 174
michael@0 175 bool
michael@0 176 DoRequest(const StopSendingFileRequest& aRequest);
michael@0 177
michael@0 178 bool
michael@0 179 DoRequest(const ConfirmReceivingFileRequest& aRequest);
michael@0 180
michael@0 181 bool
michael@0 182 DoRequest(const DenyReceivingFileRequest& aRequest);
michael@0 183
michael@0 184 bool
michael@0 185 DoRequest(const ConnectScoRequest& aRequest);
michael@0 186
michael@0 187 bool
michael@0 188 DoRequest(const DisconnectScoRequest& aRequest);
michael@0 189
michael@0 190 bool
michael@0 191 DoRequest(const IsScoConnectedRequest& aRequest);
michael@0 192
michael@0 193 #ifdef MOZ_B2G_RIL
michael@0 194 bool
michael@0 195 DoRequest(const AnswerWaitingCallRequest& aRequest);
michael@0 196
michael@0 197 bool
michael@0 198 DoRequest(const IgnoreWaitingCallRequest& aRequest);
michael@0 199
michael@0 200 bool
michael@0 201 DoRequest(const ToggleCallsRequest& aRequest);
michael@0 202 #endif
michael@0 203
michael@0 204 bool
michael@0 205 DoRequest(const SendMetaDataRequest& aRequest);
michael@0 206
michael@0 207 bool
michael@0 208 DoRequest(const SendPlayStatusRequest& aRequest);
michael@0 209 };
michael@0 210
michael@0 211 END_BLUETOOTH_NAMESPACE
michael@0 212
michael@0 213 #endif // mozilla_dom_bluetooth_ipc_bluetoothparent_h__

mercurial