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.

     1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_bluetooth_bluetootha2dpmanager_h__
     8 #define mozilla_dom_bluetooth_bluetootha2dpmanager_h__
    10 #include "BluetoothCommon.h"
    11 #include "BluetoothProfileController.h"
    12 #include "BluetoothProfileManagerBase.h"
    14 BEGIN_BLUETOOTH_NAMESPACE
    16 class BluetoothA2dpManager : public BluetoothProfileManagerBase
    17 {
    18 public:
    19   BT_DECL_PROFILE_MGR_BASE
    20   virtual void GetName(nsACString& aName)
    21   {
    22     aName.AssignLiteral("A2DP");
    23   }
    25   enum SinkState {
    26     SINK_UNKNOWN,
    27     SINK_DISCONNECTED,
    28     SINK_CONNECTING,
    29     SINK_CONNECTED,
    30     SINK_PLAYING,
    31   };
    33   static BluetoothA2dpManager* Get();
    34   virtual ~BluetoothA2dpManager();
    36   // A2DP-specific functions
    37   void HandleSinkPropertyChanged(const BluetoothSignal& aSignal);
    39   // AVRCP-specific functions
    40   void SetAvrcpConnected(bool aConnected);
    41   bool IsAvrcpConnected();
    42   void UpdateMetaData(const nsAString& aTitle,
    43                       const nsAString& aArtist,
    44                       const nsAString& aAlbum,
    45                       uint64_t aMediaNumber,
    46                       uint64_t aTotalMediaCount,
    47                       uint32_t aDuration);
    48   void UpdatePlayStatus(uint32_t aDuration,
    49                         uint32_t aPosition,
    50                         ControlPlayStatus aPlayStatus);
    51   void GetAlbum(nsAString& aAlbum);
    52   uint32_t GetDuration();
    53   ControlPlayStatus GetPlayStatus();
    54   uint32_t GetPosition();
    55   uint64_t GetMediaNumber();
    56   void GetTitle(nsAString& aTitle);
    58 private:
    59   BluetoothA2dpManager();
    60   bool Init();
    61   void ResetA2dp();
    62   void ResetAvrcp();
    64   void HandleShutdown();
    65   void NotifyConnectionStatusChanged();
    67   nsString mDeviceAddress;
    68   nsRefPtr<BluetoothProfileController> mController;
    70   // A2DP data member
    71   bool mA2dpConnected;
    72   SinkState mSinkState;
    74   // AVRCP data member
    75   bool mAvrcpConnected;
    76   nsString mAlbum;
    77   nsString mArtist;
    78   nsString mTitle;
    79   uint32_t mDuration;
    80   uint64_t mMediaNumber;
    81   uint64_t mTotalMediaCount;
    82   uint32_t mPosition;
    83   ControlPlayStatus mPlayStatus;
    84 };
    86 END_BLUETOOTH_NAMESPACE
    88 #endif

mercurial