dom/bluetooth/bluez/BluetoothDBusService.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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_bluetoothdbusservice_h__
michael@0 8 #define mozilla_dom_bluetooth_bluetoothdbusservice_h__
michael@0 9
michael@0 10 #include "mozilla/Attributes.h"
michael@0 11 #include "BluetoothCommon.h"
michael@0 12 #include "mozilla/ipc/RawDBusConnection.h"
michael@0 13 #include "BluetoothService.h"
michael@0 14 #include "nsIThread.h"
michael@0 15
michael@0 16 class DBusMessage;
michael@0 17
michael@0 18 BEGIN_BLUETOOTH_NAMESPACE
michael@0 19
michael@0 20 /**
michael@0 21 * BluetoothDBusService is the implementation of BluetoothService for DBus on
michael@0 22 * linux/android/B2G. Function comments are in BluetoothService.h
michael@0 23 */
michael@0 24
michael@0 25 class BluetoothDBusService : public BluetoothService
michael@0 26 {
michael@0 27 public:
michael@0 28 /**
michael@0 29 * For DBus Control method of "UpdateNotification", event id should be
michael@0 30 * specified as following:
michael@0 31 * (Please see specification of AVRCP 1.3, Table 5.28 for more details.)
michael@0 32 */
michael@0 33 enum ControlEventId {
michael@0 34 EVENT_PLAYBACK_STATUS_CHANGED = 0x01,
michael@0 35 EVENT_TRACK_CHANGED = 0x02,
michael@0 36 EVENT_TRACK_REACHED_END = 0x03,
michael@0 37 EVENT_TRACK_REACHED_START = 0x04,
michael@0 38 EVENT_PLAYBACK_POS_CHANGED = 0x05,
michael@0 39 EVENT_BATT_STATUS_CHANGED = 0x06,
michael@0 40 EVENT_SYSTEM_STATUS_CHANGED = 0x07,
michael@0 41 EVENT_PLAYER_APPLICATION_SETTING_CHANGED = 0x08,
michael@0 42 EVENT_UNKNOWN
michael@0 43 };
michael@0 44
michael@0 45 BluetoothDBusService();
michael@0 46 ~BluetoothDBusService();
michael@0 47
michael@0 48 bool IsReady();
michael@0 49
michael@0 50 virtual nsresult StartInternal() MOZ_OVERRIDE;
michael@0 51
michael@0 52 virtual nsresult StopInternal() MOZ_OVERRIDE;
michael@0 53
michael@0 54 virtual nsresult GetDefaultAdapterPathInternal(
michael@0 55 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 56
michael@0 57 virtual nsresult GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid,
michael@0 58 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 59
michael@0 60 virtual nsresult GetPairedDevicePropertiesInternal(
michael@0 61 const nsTArray<nsString>& aDeviceAddresses,
michael@0 62 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 63
michael@0 64 virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 65
michael@0 66 virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 67
michael@0 68 virtual nsresult
michael@0 69 SetProperty(BluetoothObjectType aType,
michael@0 70 const BluetoothNamedValue& aValue,
michael@0 71 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 72
michael@0 73 virtual nsresult
michael@0 74 GetServiceChannel(const nsAString& aDeviceAddress,
michael@0 75 const nsAString& aServiceUuid,
michael@0 76 BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE;
michael@0 77
michael@0 78 virtual bool
michael@0 79 UpdateSdpRecords(const nsAString& aDeviceAddress,
michael@0 80 BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE;
michael@0 81
michael@0 82 virtual nsresult
michael@0 83 CreatePairedDeviceInternal(const nsAString& aDeviceAddress,
michael@0 84 int aTimeout,
michael@0 85 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 86
michael@0 87 virtual nsresult
michael@0 88 RemoveDeviceInternal(const nsAString& aDeviceObjectPath,
michael@0 89 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 90
michael@0 91 virtual bool
michael@0 92 SetPinCodeInternal(const nsAString& aDeviceAddress, const nsAString& aPinCode,
michael@0 93 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 94
michael@0 95 virtual bool
michael@0 96 SetPasskeyInternal(const nsAString& aDeviceAddress, uint32_t aPasskey,
michael@0 97 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 98
michael@0 99 virtual bool
michael@0 100 SetPairingConfirmationInternal(const nsAString& aDeviceAddress, bool aConfirm,
michael@0 101 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 102
michael@0 103 virtual void
michael@0 104 Connect(const nsAString& aDeviceAddress,
michael@0 105 uint32_t aCod,
michael@0 106 uint16_t aServiceUuid,
michael@0 107 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 108
michael@0 109 virtual bool
michael@0 110 IsConnected(uint16_t aServiceUuid) MOZ_OVERRIDE;
michael@0 111
michael@0 112 virtual void
michael@0 113 Disconnect(const nsAString& aDeviceAddress, uint16_t aServiceUuid,
michael@0 114 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 115
michael@0 116 virtual void
michael@0 117 SendFile(const nsAString& aDeviceAddress,
michael@0 118 BlobParent* aBlobParent,
michael@0 119 BlobChild* aBlobChild,
michael@0 120 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 121
michael@0 122 virtual void
michael@0 123 SendFile(const nsAString& aDeviceAddress,
michael@0 124 nsIDOMBlob* aBlob,
michael@0 125 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 126
michael@0 127 virtual void
michael@0 128 StopSendingFile(const nsAString& aDeviceAddress,
michael@0 129 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 130
michael@0 131 virtual void
michael@0 132 ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm,
michael@0 133 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 134
michael@0 135 virtual void
michael@0 136 ConnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 137
michael@0 138 virtual void
michael@0 139 DisconnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 140
michael@0 141 virtual void
michael@0 142 IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 143
michael@0 144 #ifdef MOZ_B2G_RIL
michael@0 145 virtual void
michael@0 146 AnswerWaitingCall(BluetoothReplyRunnable* aRunnable);
michael@0 147
michael@0 148 virtual void
michael@0 149 IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable);
michael@0 150
michael@0 151 virtual void
michael@0 152 ToggleCalls(BluetoothReplyRunnable* aRunnable);
michael@0 153 #endif
michael@0 154
michael@0 155 virtual void
michael@0 156 SendMetaData(const nsAString& aTitle,
michael@0 157 const nsAString& aArtist,
michael@0 158 const nsAString& aAlbum,
michael@0 159 int64_t aMediaNumber,
michael@0 160 int64_t aTotalMediaCount,
michael@0 161 int64_t aDuration,
michael@0 162 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 163
michael@0 164 virtual void
michael@0 165 SendPlayStatus(int64_t aDuration,
michael@0 166 int64_t aPosition,
michael@0 167 const nsAString& aPlayStatus,
michael@0 168 BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
michael@0 169
michael@0 170 virtual void
michael@0 171 UpdatePlayStatus(uint32_t aDuration,
michael@0 172 uint32_t aPosition,
michael@0 173 ControlPlayStatus aPlayStatus) MOZ_OVERRIDE;
michael@0 174
michael@0 175 virtual nsresult
michael@0 176 SendSinkMessage(const nsAString& aDeviceAddresses,
michael@0 177 const nsAString& aMessage) MOZ_OVERRIDE;
michael@0 178
michael@0 179 virtual nsresult
michael@0 180 SendInputMessage(const nsAString& aDeviceAddresses,
michael@0 181 const nsAString& aMessage) MOZ_OVERRIDE;
michael@0 182 private:
michael@0 183 nsresult SendGetPropertyMessage(const nsAString& aPath,
michael@0 184 const char* aInterface,
michael@0 185 void (*aCB)(DBusMessage *, void *),
michael@0 186 BluetoothReplyRunnable* aRunnable);
michael@0 187
michael@0 188 nsresult SendDiscoveryMessage(const char* aMessageName,
michael@0 189 BluetoothReplyRunnable* aRunnable);
michael@0 190
michael@0 191 nsresult SendSetPropertyMessage(const char* aInterface,
michael@0 192 const BluetoothNamedValue& aValue,
michael@0 193 BluetoothReplyRunnable* aRunnable);
michael@0 194
michael@0 195 void UpdateNotification(ControlEventId aEventId, uint64_t aData);
michael@0 196
michael@0 197 nsresult SendAsyncDBusMessage(const nsAString& aObjectPath,
michael@0 198 const char* aInterface,
michael@0 199 const nsAString& aMessage,
michael@0 200 mozilla::ipc::DBusReplyCallback aCallback);
michael@0 201 };
michael@0 202
michael@0 203 END_BLUETOOTH_NAMESPACE
michael@0 204
michael@0 205 #endif

mercurial