AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MPRISPlayer.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_MPRISPLAYER_H_
17 #define ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_MPRISPLAYER_H_
18 
19 #include <memory>
20 
21 #include <gio/gio.h>
22 
24 #include "BlueZ/DBusObject.h"
25 #include "BlueZ/DBusProxy.h"
26 
27 namespace alexaClientSDK {
28 namespace bluetoothImplementations {
29 namespace blueZ {
30 
31 /*
32  * A @c DBusObject implementing the org.mpris.MediaPlayer2.Player interface.
33  * This object will be registered with BlueZ, and will receive method calls when
34  * BlueZ receives an AVRCP command.
35  *
36  * This object does not fully implement the org.mpris.MediaPlayer2.Player interface.
37  * The relevant subset in which BlueZ requires and is supported by the SDK is implemented.
38  */
39 class MPRISPlayer : public DBusObject<MPRISPlayer> {
40 public:
42  virtual ~MPRISPlayer();
43 
46 
58  static std::unique_ptr<MPRISPlayer> create(
59  std::shared_ptr<DBusConnection> connection,
60  std::shared_ptr<DBusProxy> media,
61  std::shared_ptr<avsCommon::utils::bluetooth::BluetoothEventBus> eventBus,
62  const std::string& playerPath = MPRIS_OBJECT_PATH);
63 
64 private:
74  std::shared_ptr<DBusConnection> connection,
75  std::shared_ptr<DBusProxy> media,
76  std::shared_ptr<avsCommon::utils::bluetooth::BluetoothEventBus> eventBus,
77  const std::string& playerPath);
78 
84  bool init();
85 
91  bool registerPlayer();
92 
98  bool unregisterPlayer();
99 
106  void unsupportedMethod(GVariant* arguments, GDBusMethodInvocation* invocation);
107 
114  void toMediaCommand(GVariant* arguments, GDBusMethodInvocation* invocation);
115 
122 
124  const std::string m_playerPath;
125 
127  std::shared_ptr<DBusProxy> m_media;
128 
130  std::shared_ptr<avsCommon::utils::bluetooth::BluetoothEventBus> m_eventBus;
131 };
132 
133 } // namespace blueZ
134 } // namespace bluetoothImplementations
135 } // namespace alexaClientSDK
136 
137 #endif // ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_MPRISPLAYER_H_
static std::unique_ptr< MPRISPlayer > create(std::shared_ptr< DBusConnection > connection, std::shared_ptr< DBusProxy > media, std::shared_ptr< avsCommon::utils::bluetooth::BluetoothEventBus > eventBus, const std::string &playerPath=MPRIS_OBJECT_PATH)
::std::string string
Definition: gtest-port.h:1097
MediaCommand
An Enum representing Media commands.
Definition: AVRCPTargetInterface.h:32
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static const std::string MPRIS_OBJECT_PATH
The default MPRIS object path for players.
Definition: MPRISPlayer.h:45

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0