~alfonsosanchezbeato/media-hub/get-selected-streams

« back to all changes in this revision

Viewing changes to src/core/media/service_stub.cpp

  • Committer: CI Train Bot
  • Author(s): Ricardo Mendoza
  • Date: 2015-04-20 17:56:05 UTC
  • mfrom: (131.1.24 backup)
  • Revision ID: ci-train-bot@canonical.com-20150420175605-qidgnle18o0u0n4s
Player session attaching/detaching with UUID
Approved by: PS Jenkins bot, Jim Hodapp, Thomas Voß

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
std::shared_ptr<media::Player> media::ServiceStub::create_session(const media::Player::Configuration&)
59
59
{
60
60
    auto op = d->object->invoke_method_synchronously<mpris::Service::CreateSession,
61
 
         dbus::types::ObjectPath>();
 
61
         std::tuple<dbus::types::ObjectPath, std::string>>();
62
62
 
63
63
    if (op.is_error())
64
64
        throw std::runtime_error("Problem creating session: " + op.error());
67
67
    {
68
68
        shared_from_this(),
69
69
        access_service(),
70
 
        access_service()->object_for_path(op.value())
71
 
    });
 
70
        access_service()->object_for_path(std::get<0>(op.value())),
 
71
        std::get<1>(op.value())
 
72
    });
 
73
}
 
74
 
 
75
void media::ServiceStub::detach_session(const std::string& uuid, const media::Player::Configuration&)
 
76
{
 
77
    auto op = d->object->invoke_method_synchronously<mpris::Service::DetachSession,
 
78
         void>(uuid);
 
79
 
 
80
    if (op.is_error())
 
81
        throw std::runtime_error("Problem detaching session: " + op.error());
 
82
}
 
83
 
 
84
std::shared_ptr<media::Player> media::ServiceStub::reattach_session(const std::string& uuid, const media::Player::Configuration&)
 
85
{
 
86
    auto op = d->object->invoke_method_synchronously<mpris::Service::ReattachSession,
 
87
         dbus::types::ObjectPath>(uuid);
 
88
 
 
89
    if (op.is_error())
 
90
        throw std::runtime_error("Problem reattaching session: " + op.error());
 
91
 
 
92
    return std::shared_ptr<media::Player>(new media::PlayerStub
 
93
    {
 
94
        shared_from_this(),
 
95
        access_service(),
 
96
        access_service()->object_for_path(op.value()),
 
97
        uuid
 
98
    });
 
99
}
 
100
 
 
101
void media::ServiceStub::destroy_session(const std::string& uuid, const media::Player::Configuration&)
 
102
{
 
103
    auto op = d->object->invoke_method_synchronously<mpris::Service::DestroySession,
 
104
         void>(uuid);
 
105
 
 
106
    if (op.is_error())
 
107
        throw std::runtime_error("Problem destroying session: " + op.error());
72
108
}
73
109
 
74
110
std::shared_ptr<media::Player> media::ServiceStub::create_fixed_session(const std::string& name, const media::Player::Configuration&)