Music Hub ..
A session-wide music playback service
service.h
Go to the documentation of this file.
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18#ifndef CORE_UBUNTU_MEDIA_SERVICE_H_
19#define CORE_UBUNTU_MEDIA_SERVICE_H_
20
21#include <core/media/player.h>
22
23#include <memory>
24
25namespace core
26{
27namespace ubuntu
28{
29namespace media
30{
31class Service : public std::enable_shared_from_this<Service>
32{
33 public:
34 struct Client
35 {
36 static const std::shared_ptr<Service> instance();
37 };
38
39 Service(const Service&) = delete;
40 virtual ~Service() = default;
41
42 Service& operator=(const Service&) = delete;
43 bool operator==(const Service&) const = delete;
44
46 virtual std::shared_ptr<Player> create_session(const Player::Configuration&) = 0;
47
49 virtual void detach_session(const std::string& uuid, const Player::Configuration&) = 0;
50
52 virtual std::shared_ptr<Player> reattach_session(const std::string& uuid, const Player::Configuration&) = 0;
53
55 virtual void destroy_session(const std::string& uuid, const Player::Configuration&) = 0;
56
58 virtual std::shared_ptr<Player> create_fixed_session(const std::string& name, const Player::Configuration&) = 0;
59
61 virtual std::shared_ptr<Player> resume_session(Player::PlayerKey) = 0;
62
65
67 virtual const core::Signal<void>& service_disconnected() const = 0;
69 virtual const core::Signal<void>& service_reconnected() const = 0;
70
71 protected:
72 Service() = default;
73};
74}
75}
76}
77
78#endif // CORE_UBUNTU_MEDIA_SERVICE_H_
virtual std::shared_ptr< Player > reattach_session(const std::string &uuid, const Player::Configuration &)=0
Reattaches to a UUID-identified session that is in detached state.
virtual std::shared_ptr< Player > create_fixed_session(const std::string &name, const Player::Configuration &)=0
Creates a fixed-named session with the media-hub service.
Service & operator=(const Service &)=delete
Service(const Service &)=delete
virtual std::shared_ptr< Player > create_session(const Player::Configuration &)=0
Creates a session with the media-hub service.
virtual ~Service()=default
bool operator==(const Service &) const =delete
virtual void destroy_session(const std::string &uuid, const Player::Configuration &)=0
Asks the service to destroy a session. The session is destroyed when the client exits.
virtual void detach_session(const std::string &uuid, const Player::Configuration &)=0
Detaches a UUID-identified session for later resuming.
virtual const core::Signal< void > & service_disconnected() const =0
Signals when the media-hub server disappears from the bus.
virtual std::shared_ptr< Player > resume_session(Player::PlayerKey)=0
Resumes a fixed-name session directly by player key.
virtual void pause_other_sessions(Player::PlayerKey)=0
Pauses sessions other than the supplied one.
virtual const core::Signal< void > & service_reconnected() const =0
Signals when the media-hub server reappears from the bus.
Definition: player.h:34
static const std::shared_ptr< Service > instance()
Definition: service.cpp:27