/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ #define mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ #include "BluetoothService.h" BEGIN_BLUETOOTH_NAMESPACE class BluetoothChild; class BluetoothServiceChildProcess : public BluetoothService { friend class mozilla::dom::bluetooth::BluetoothChild; public: static BluetoothServiceChildProcess* Create(); virtual void RegisterBluetoothSignalHandler(const nsAString& aNodeName, BluetoothSignalObserver* aMsgHandler) override; virtual void UnregisterBluetoothSignalHandler(const nsAString& aNodeName, BluetoothSignalObserver* aMsgHandler) override; virtual nsresult GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable) override; virtual nsresult GetPairedDevicePropertiesInternal(const nsTArray& aDeviceAddresses, BluetoothReplyRunnable* aRunnable) override; virtual nsresult GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override; virtual void StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override; virtual void StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override; virtual nsresult SetProperty(BluetoothObjectType aType, const BluetoothNamedValue& aValue, BluetoothReplyRunnable* aRunnable) override; virtual nsresult CreatePairedDeviceInternal(const nsAString& aAddress, int aTimeout, BluetoothReplyRunnable* aRunnable) override; virtual nsresult RemoveDeviceInternal(const nsAString& aObjectPath, BluetoothReplyRunnable* aRunnable) override; virtual nsresult GetServiceChannel(const nsAString& aDeviceAddress, const nsAString& aServiceUuid, BluetoothProfileManagerBase* aManager) override; virtual bool UpdateSdpRecords(const nsAString& aDeviceAddress, BluetoothProfileManagerBase* aManager) override; virtual bool SetPinCodeInternal(const nsAString& aDeviceAddress, const nsAString& aPinCode, BluetoothReplyRunnable* aRunnable) override; virtual bool SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey, BluetoothReplyRunnable* aRunnable) override; virtual bool SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm, BluetoothReplyRunnable* aRunnable) override; virtual void Connect(const nsAString& aDeviceAddress, uint32_t aCod, uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override; virtual void Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override; virtual void IsConnected(const uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override; virtual void SendFile(const nsAString& aDeviceAddress, BlobParent* aBlobParent, BlobChild* aBlobChild, BluetoothReplyRunnable* aRunnable) override; virtual void SendFile(const nsAString& aDeviceAddress, Blob* aBlob, BluetoothReplyRunnable* aRunnable) override; virtual void StopSendingFile(const nsAString& aDeviceAddress, BluetoothReplyRunnable* aRunnable) override; virtual void ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm, BluetoothReplyRunnable* aRunnable) override; virtual void ConnectSco(BluetoothReplyRunnable* aRunnable) override; virtual void DisconnectSco(BluetoothReplyRunnable* aRunnable) override; virtual void IsScoConnected(BluetoothReplyRunnable* aRunnable) override; #ifdef MOZ_B2G_RIL virtual void AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) override; virtual void IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable) override; virtual void ToggleCalls(BluetoothReplyRunnable* aRunnable) override; #endif virtual void SendMetaData(const nsAString& aTitle, const nsAString& aArtist, const nsAString& aAlbum, int64_t aMediaNumber, int64_t aTotalMediaCount, int64_t aDuration, BluetoothReplyRunnable* aRunnable) override; virtual void SendPlayStatus(int64_t aDuration, int64_t aPosition, const nsAString& aPlayStatus, BluetoothReplyRunnable* aRunnable) override; virtual void UpdatePlayStatus(uint32_t aDuration, uint32_t aPosition, ControlPlayStatus aPlayStatus) override; virtual nsresult SendSinkMessage(const nsAString& aDeviceAddresses, const nsAString& aMessage) override; virtual nsresult SendInputMessage(const nsAString& aDeviceAddresses, const nsAString& aMessage) override; protected: BluetoothServiceChildProcess(); virtual ~BluetoothServiceChildProcess(); void NoteDeadActor(); void NoteShutdownInitiated(); virtual nsresult HandleStartup() override; virtual nsresult HandleShutdown() override; private: // This method should never be called. virtual nsresult StartInternal() override; // This method should never be called. virtual nsresult StopInternal() override; bool IsSignalRegistered(const nsAString& aNodeName) { return !!mBluetoothSignalObserverTable.Get(aNodeName); } }; END_BLUETOOTH_NAMESPACE #endif // mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__