1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,218 @@ 1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ 1.11 +#define mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ 1.12 + 1.13 +#include "BluetoothService.h" 1.14 + 1.15 +namespace mozilla { 1.16 +namespace ipc { 1.17 +class UnixSocketConsumer; 1.18 +} 1.19 +namespace dom { 1.20 +namespace bluetooth { 1.21 + 1.22 +class BluetoothChild; 1.23 + 1.24 +} // namespace bluetooth 1.25 +} // namespace dom 1.26 +} // namespace mozilla 1.27 + 1.28 + 1.29 +BEGIN_BLUETOOTH_NAMESPACE 1.30 + 1.31 +class BluetoothServiceChildProcess : public BluetoothService 1.32 +{ 1.33 + friend class mozilla::dom::bluetooth::BluetoothChild; 1.34 + 1.35 +public: 1.36 + static BluetoothServiceChildProcess* 1.37 + Create(); 1.38 + 1.39 + virtual void 1.40 + RegisterBluetoothSignalHandler(const nsAString& aNodeName, 1.41 + BluetoothSignalObserver* aMsgHandler) 1.42 + MOZ_OVERRIDE; 1.43 + 1.44 + virtual void 1.45 + UnregisterBluetoothSignalHandler(const nsAString& aNodeName, 1.46 + BluetoothSignalObserver* aMsgHandler) 1.47 + MOZ_OVERRIDE; 1.48 + 1.49 + virtual nsresult 1.50 + GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.51 + 1.52 + virtual nsresult 1.53 + GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses, 1.54 + BluetoothReplyRunnable* aRunnable) 1.55 + MOZ_OVERRIDE; 1.56 + 1.57 + virtual nsresult 1.58 + GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid, 1.59 + BluetoothReplyRunnable* aRunnable) 1.60 + MOZ_OVERRIDE; 1.61 + virtual nsresult 1.62 + StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.63 + 1.64 + virtual nsresult 1.65 + StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.66 + 1.67 + virtual nsresult 1.68 + SetProperty(BluetoothObjectType aType, 1.69 + const BluetoothNamedValue& aValue, 1.70 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.71 + 1.72 + virtual nsresult 1.73 + CreatePairedDeviceInternal(const nsAString& aAddress, 1.74 + int aTimeout, 1.75 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.76 + 1.77 + virtual nsresult 1.78 + RemoveDeviceInternal(const nsAString& aObjectPath, 1.79 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.80 + 1.81 + virtual nsresult 1.82 + GetServiceChannel(const nsAString& aDeviceAddress, 1.83 + const nsAString& aServiceUuid, 1.84 + BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; 1.85 + 1.86 + virtual bool 1.87 + UpdateSdpRecords(const nsAString& aDeviceAddress, 1.88 + BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; 1.89 + 1.90 + virtual bool 1.91 + SetPinCodeInternal(const nsAString& aDeviceAddress, 1.92 + const nsAString& aPinCode, 1.93 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.94 + 1.95 + virtual bool 1.96 + SetPasskeyInternal(const nsAString& aDeviceAddress, 1.97 + uint32_t aPasskey, 1.98 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.99 + 1.100 + virtual bool 1.101 + SetPairingConfirmationInternal(const nsAString& aDeviceAddress, 1.102 + bool aConfirm, 1.103 + BluetoothReplyRunnable* aRunnable) 1.104 + MOZ_OVERRIDE; 1.105 + 1.106 + virtual void 1.107 + Connect(const nsAString& aDeviceAddress, 1.108 + uint32_t aCod, 1.109 + uint16_t aServiceUuid, 1.110 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.111 + 1.112 + virtual void 1.113 + Disconnect(const nsAString& aDeviceAddress, 1.114 + uint16_t aServiceUuid, 1.115 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.116 + 1.117 + virtual bool 1.118 + IsConnected(uint16_t aServiceUuid) MOZ_OVERRIDE; 1.119 + 1.120 + virtual void 1.121 + SendFile(const nsAString& aDeviceAddress, 1.122 + BlobParent* aBlobParent, 1.123 + BlobChild* aBlobChild, 1.124 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.125 + 1.126 + virtual void 1.127 + SendFile(const nsAString& aDeviceAddress, 1.128 + nsIDOMBlob* aBlob, 1.129 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.130 + 1.131 + virtual void 1.132 + StopSendingFile(const nsAString& aDeviceAddress, 1.133 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.134 + 1.135 + virtual void 1.136 + ConfirmReceivingFile(const nsAString& aDeviceAddress, 1.137 + bool aConfirm, 1.138 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.139 + 1.140 + virtual void 1.141 + ConnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.142 + 1.143 + virtual void 1.144 + DisconnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.145 + 1.146 + virtual void 1.147 + IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.148 + 1.149 +#ifdef MOZ_B2G_RIL 1.150 + virtual void 1.151 + AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.152 + 1.153 + virtual void 1.154 + IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.155 + 1.156 + virtual void 1.157 + ToggleCalls(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.158 +#endif 1.159 + 1.160 + virtual void 1.161 + SendMetaData(const nsAString& aTitle, 1.162 + const nsAString& aArtist, 1.163 + const nsAString& aAlbum, 1.164 + int64_t aMediaNumber, 1.165 + int64_t aTotalMediaCount, 1.166 + int64_t aDuration, 1.167 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.168 + 1.169 + virtual void 1.170 + SendPlayStatus(int64_t aDuration, 1.171 + int64_t aPosition, 1.172 + const nsAString& aPlayStatus, 1.173 + BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; 1.174 + 1.175 + virtual void 1.176 + UpdatePlayStatus(uint32_t aDuration, 1.177 + uint32_t aPosition, 1.178 + ControlPlayStatus aPlayStatus) MOZ_OVERRIDE; 1.179 + 1.180 + virtual nsresult 1.181 + SendSinkMessage(const nsAString& aDeviceAddresses, 1.182 + const nsAString& aMessage) MOZ_OVERRIDE; 1.183 + 1.184 + virtual nsresult 1.185 + SendInputMessage(const nsAString& aDeviceAddresses, 1.186 + const nsAString& aMessage) MOZ_OVERRIDE; 1.187 + 1.188 +protected: 1.189 + BluetoothServiceChildProcess(); 1.190 + virtual ~BluetoothServiceChildProcess(); 1.191 + 1.192 + void 1.193 + NoteDeadActor(); 1.194 + 1.195 + void 1.196 + NoteShutdownInitiated(); 1.197 + 1.198 + virtual nsresult 1.199 + HandleStartup() MOZ_OVERRIDE; 1.200 + 1.201 + virtual nsresult 1.202 + HandleShutdown() MOZ_OVERRIDE; 1.203 + 1.204 +private: 1.205 + // This method should never be called. 1.206 + virtual nsresult 1.207 + StartInternal() MOZ_OVERRIDE; 1.208 + 1.209 + // This method should never be called. 1.210 + virtual nsresult 1.211 + StopInternal() MOZ_OVERRIDE; 1.212 + 1.213 + bool 1.214 + IsSignalRegistered(const nsAString& aNodeName) { 1.215 + return !!mBluetoothSignalObserverTable.Get(aNodeName); 1.216 + } 1.217 +}; 1.218 + 1.219 +END_BLUETOOTH_NAMESPACE 1.220 + 1.221 +#endif // mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__