summaryrefslogtreecommitdiff
path: root/src/bt.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/bt.hh')
-rw-r--r--src/bt.hh47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/bt.hh b/src/bt.hh
index 588a328..bc7cd84 100644
--- a/src/bt.hh
+++ b/src/bt.hh
@@ -23,6 +23,7 @@ class Config;
namespace bt {
class Device;
+class Player;
class Adapter {
public:
@@ -84,12 +85,51 @@ class Device {
[[nodiscard]]
virtual bool connected() const = 0;
+ // Returns null if there are no players.
+ // Otherwise, returns the "primary" player.
+ [[nodiscard]]
+ virtual Player* player() const = 0;
+
protected:
Device() = default;
Device(Device const&) = delete;
Device& operator=(Device const&) = delete;
};
+class Player {
+ public:
+ virtual ~Player() = default;
+
+ enum class Status : uint8_t {
+ kPlaying,
+ kStopped,
+ kPaused,
+ kForwardSeek,
+ kReverseSeek,
+ kError,
+ };
+
+ [[nodiscard]]
+ virtual Status status() const = 0;
+
+ [[nodiscard]]
+ virtual std::string const& track_title() const = 0;
+
+ [[nodiscard]]
+ virtual std::string const& track_artist() const = 0;
+
+ [[nodiscard]]
+ virtual std::string const& track_album() const = 0;
+
+ virtual void play() = 0;
+ virtual void pause() = 0;
+
+ protected:
+ Player() = default;
+ Player(Player const&) = delete;
+ Player& operator=(Player const&) = delete;
+};
+
class Manager {
public:
virtual ~Manager() = default;
@@ -110,6 +150,13 @@ class Manager {
// Called when device changes a property.
virtual void updated_device(Device& /* device */) {}
+ // Called when a new player is added to a device.
+ virtual void added_player(Device& /* device */, Player& /* player */) {}
+ // Called when a player was removed from a device.
+ virtual void removed_player(Device& /* device */) {}
+ // Called when a device player changes a property.
+ virtual void updated_player(Device& /* device */, Player& /* player */) {}
+
virtual void agent_request_pincode(
Device& device,
std::function<void(std::optional<std::string>)> callback) = 0;