Music Hub  ..
A session-wide music playback service
hybris_client_death_observer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 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 
19 #ifndef CORE_UBUNTU_MEDIA_HYBRIS_CLIENT_DEATH_OBSERVER_H_
20 #define CORE_UBUNTU_MEDIA_HYBRIS_CLIENT_DEATH_OBSERVER_H_
21 
23 
24 namespace core
25 {
26 namespace ubuntu
27 {
28 namespace media
29 {
30 // Models functionality to be notified whenever a client
31 // of the service goes away, and thus allows us to clean
32 // up in that case.
33 // Specific implementation for a hybris-based platform.
35  public std::enable_shared_from_this<HybrisClientDeathObserver>
36 {
37 public:
38  // Our static callback that we inject to the hybris world.
39  static void on_client_died_cb(void* context);
40 
41  // Creates an instance of the HybrisClientDeathObserver or throws
42  // if the underlying platform does not support it.
44 
45  // Make std::unique_ptr happy for forward declared Private internals.
47 
48  // Registers the client with the given key for death notifications.
50 
51  // Emitted whenever a client dies, reporting the key under which the
52  // respective client was known.
53  const core::Signal<Player::PlayerKey>& on_client_with_key_died() const override;
54 
55 private:
57 
58  core::Signal<media::Player::PlayerKey> client_with_key_died;
59 };
60 }
61 }
62 }
63 
64 #endif // CORE_UBUNTU_MEDIA_HYBRIS_CLIENT_DEATH_OBSERVER_H_
Definition: player.h:33
std::shared_ptr< ClientDeathObserver > Ptr
void register_for_death_notifications_with_key(const Player::PlayerKey &) override
const core::Signal< Player::PlayerKey > & on_client_with_key_died() const override