michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_bluetooth_bluetoothdbusservice_h__ michael@0: #define mozilla_dom_bluetooth_bluetoothdbusservice_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "BluetoothCommon.h" michael@0: #include "mozilla/ipc/RawDBusConnection.h" michael@0: #include "BluetoothService.h" michael@0: #include "nsIThread.h" michael@0: michael@0: class DBusMessage; michael@0: michael@0: BEGIN_BLUETOOTH_NAMESPACE michael@0: michael@0: /** michael@0: * BluetoothDBusService is the implementation of BluetoothService for DBus on michael@0: * linux/android/B2G. Function comments are in BluetoothService.h michael@0: */ michael@0: michael@0: class BluetoothDBusService : public BluetoothService michael@0: { michael@0: public: michael@0: /** michael@0: * For DBus Control method of "UpdateNotification", event id should be michael@0: * specified as following: michael@0: * (Please see specification of AVRCP 1.3, Table 5.28 for more details.) michael@0: */ michael@0: enum ControlEventId { michael@0: EVENT_PLAYBACK_STATUS_CHANGED = 0x01, michael@0: EVENT_TRACK_CHANGED = 0x02, michael@0: EVENT_TRACK_REACHED_END = 0x03, michael@0: EVENT_TRACK_REACHED_START = 0x04, michael@0: EVENT_PLAYBACK_POS_CHANGED = 0x05, michael@0: EVENT_BATT_STATUS_CHANGED = 0x06, michael@0: EVENT_SYSTEM_STATUS_CHANGED = 0x07, michael@0: EVENT_PLAYER_APPLICATION_SETTING_CHANGED = 0x08, michael@0: EVENT_UNKNOWN michael@0: }; michael@0: michael@0: BluetoothDBusService(); michael@0: ~BluetoothDBusService(); michael@0: michael@0: bool IsReady(); michael@0: michael@0: virtual nsresult StartInternal() MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult StopInternal() MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult GetDefaultAdapterPathInternal( michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult GetPairedDevicePropertiesInternal( michael@0: const nsTArray& aDeviceAddresses, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: SetProperty(BluetoothObjectType aType, michael@0: const BluetoothNamedValue& aValue, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: GetServiceChannel(const nsAString& aDeviceAddress, michael@0: const nsAString& aServiceUuid, michael@0: BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: UpdateSdpRecords(const nsAString& aDeviceAddress, michael@0: BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: CreatePairedDeviceInternal(const nsAString& aDeviceAddress, michael@0: int aTimeout, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: RemoveDeviceInternal(const nsAString& aDeviceObjectPath, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: SetPinCodeInternal(const nsAString& aDeviceAddress, const nsAString& aPinCode, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: Connect(const nsAString& aDeviceAddress, michael@0: uint32_t aCod, michael@0: uint16_t aServiceUuid, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: IsConnected(uint16_t aServiceUuid) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: SendFile(const nsAString& aDeviceAddress, michael@0: BlobParent* aBlobParent, michael@0: BlobChild* aBlobChild, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: SendFile(const nsAString& aDeviceAddress, michael@0: nsIDOMBlob* aBlob, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: StopSendingFile(const nsAString& aDeviceAddress, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: ConnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: DisconnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: #ifdef MOZ_B2G_RIL michael@0: virtual void michael@0: AnswerWaitingCall(BluetoothReplyRunnable* aRunnable); michael@0: michael@0: virtual void michael@0: IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable); michael@0: michael@0: virtual void michael@0: ToggleCalls(BluetoothReplyRunnable* aRunnable); michael@0: #endif michael@0: michael@0: virtual void michael@0: SendMetaData(const nsAString& aTitle, michael@0: const nsAString& aArtist, michael@0: const nsAString& aAlbum, michael@0: int64_t aMediaNumber, michael@0: int64_t aTotalMediaCount, michael@0: int64_t aDuration, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: SendPlayStatus(int64_t aDuration, michael@0: int64_t aPosition, michael@0: const nsAString& aPlayStatus, michael@0: BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: UpdatePlayStatus(uint32_t aDuration, michael@0: uint32_t aPosition, michael@0: ControlPlayStatus aPlayStatus) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: SendSinkMessage(const nsAString& aDeviceAddresses, michael@0: const nsAString& aMessage) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: SendInputMessage(const nsAString& aDeviceAddresses, michael@0: const nsAString& aMessage) MOZ_OVERRIDE; michael@0: private: michael@0: nsresult SendGetPropertyMessage(const nsAString& aPath, michael@0: const char* aInterface, michael@0: void (*aCB)(DBusMessage *, void *), michael@0: BluetoothReplyRunnable* aRunnable); michael@0: michael@0: nsresult SendDiscoveryMessage(const char* aMessageName, michael@0: BluetoothReplyRunnable* aRunnable); michael@0: michael@0: nsresult SendSetPropertyMessage(const char* aInterface, michael@0: const BluetoothNamedValue& aValue, michael@0: BluetoothReplyRunnable* aRunnable); michael@0: michael@0: void UpdateNotification(ControlEventId aEventId, uint64_t aData); michael@0: michael@0: nsresult SendAsyncDBusMessage(const nsAString& aObjectPath, michael@0: const char* aInterface, michael@0: const nsAString& aMessage, michael@0: mozilla::ipc::DBusReplyCallback aCallback); michael@0: }; michael@0: michael@0: END_BLUETOOTH_NAMESPACE michael@0: michael@0: #endif