dom/bluetooth/bluez/BluetoothA2dpManager.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_bluetootha2dpmanager_h__
michael@0 8 #define mozilla_dom_bluetooth_bluetootha2dpmanager_h__
michael@0 9
michael@0 10 #include "BluetoothCommon.h"
michael@0 11 #include "BluetoothProfileController.h"
michael@0 12 #include "BluetoothProfileManagerBase.h"
michael@0 13
michael@0 14 BEGIN_BLUETOOTH_NAMESPACE
michael@0 15
michael@0 16 class BluetoothA2dpManager : public BluetoothProfileManagerBase
michael@0 17 {
michael@0 18 public:
michael@0 19 BT_DECL_PROFILE_MGR_BASE
michael@0 20 virtual void GetName(nsACString& aName)
michael@0 21 {
michael@0 22 aName.AssignLiteral("A2DP");
michael@0 23 }
michael@0 24
michael@0 25 enum SinkState {
michael@0 26 SINK_UNKNOWN,
michael@0 27 SINK_DISCONNECTED,
michael@0 28 SINK_CONNECTING,
michael@0 29 SINK_CONNECTED,
michael@0 30 SINK_PLAYING,
michael@0 31 };
michael@0 32
michael@0 33 static BluetoothA2dpManager* Get();
michael@0 34 virtual ~BluetoothA2dpManager();
michael@0 35
michael@0 36 // A2DP-specific functions
michael@0 37 void HandleSinkPropertyChanged(const BluetoothSignal& aSignal);
michael@0 38
michael@0 39 // AVRCP-specific functions
michael@0 40 void SetAvrcpConnected(bool aConnected);
michael@0 41 bool IsAvrcpConnected();
michael@0 42 void UpdateMetaData(const nsAString& aTitle,
michael@0 43 const nsAString& aArtist,
michael@0 44 const nsAString& aAlbum,
michael@0 45 uint64_t aMediaNumber,
michael@0 46 uint64_t aTotalMediaCount,
michael@0 47 uint32_t aDuration);
michael@0 48 void UpdatePlayStatus(uint32_t aDuration,
michael@0 49 uint32_t aPosition,
michael@0 50 ControlPlayStatus aPlayStatus);
michael@0 51 void GetAlbum(nsAString& aAlbum);
michael@0 52 uint32_t GetDuration();
michael@0 53 ControlPlayStatus GetPlayStatus();
michael@0 54 uint32_t GetPosition();
michael@0 55 uint64_t GetMediaNumber();
michael@0 56 void GetTitle(nsAString& aTitle);
michael@0 57
michael@0 58 private:
michael@0 59 BluetoothA2dpManager();
michael@0 60 bool Init();
michael@0 61 void ResetA2dp();
michael@0 62 void ResetAvrcp();
michael@0 63
michael@0 64 void HandleShutdown();
michael@0 65 void NotifyConnectionStatusChanged();
michael@0 66
michael@0 67 nsString mDeviceAddress;
michael@0 68 nsRefPtr<BluetoothProfileController> mController;
michael@0 69
michael@0 70 // A2DP data member
michael@0 71 bool mA2dpConnected;
michael@0 72 SinkState mSinkState;
michael@0 73
michael@0 74 // AVRCP data member
michael@0 75 bool mAvrcpConnected;
michael@0 76 nsString mAlbum;
michael@0 77 nsString mArtist;
michael@0 78 nsString mTitle;
michael@0 79 uint32_t mDuration;
michael@0 80 uint64_t mMediaNumber;
michael@0 81 uint64_t mTotalMediaCount;
michael@0 82 uint32_t mPosition;
michael@0 83 ControlPlayStatus mPlayStatus;
michael@0 84 };
michael@0 85
michael@0 86 END_BLUETOOTH_NAMESPACE
michael@0 87
michael@0 88 #endif

mercurial