~phablet-team/aethercast/fix-for-microsoft-dongle

« back to all changes in this revision

Viewing changes to src/mcs/forwardingmiracastcontroller.cpp

Introduce interface mcs::MiracastController to decouple MiracastService and MiracastServiceAdapter.
Refactor mcs::MiracastServiceAdapter to be a skeleton-implementation of MiracastController and rename accordingly.

Approved by Simon Fels, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as published
 
6
 * by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 */
 
17
 
 
18
#include "forwardingmiracastcontroller.h"
 
19
 
 
20
#include <stdexcept>
 
21
 
 
22
namespace mcs {
 
23
ForwardingMiracastController::ForwardingMiracastController(const MiracastController::Ptr& fwd) : fwd_{fwd} {
 
24
    if (not fwd_) {
 
25
        throw std::logic_error{"Cannot operate without a valid MiracastController instance."};
 
26
    }
 
27
}
 
28
 
 
29
void ForwardingMiracastController::SetDelegate(const std::weak_ptr<MiracastController::Delegate> &delegate) {
 
30
    fwd_->SetDelegate(delegate);
 
31
}
 
32
 
 
33
void ForwardingMiracastController::ResetDelegate() {
 
34
    fwd_->ResetDelegate();
 
35
}
 
36
 
 
37
void ForwardingMiracastController::Connect(const NetworkDevice::Ptr &device, ResultCallback callback) {
 
38
    fwd_->Connect(device, callback);
 
39
}
 
40
 
 
41
void ForwardingMiracastController::Disconnect(const NetworkDevice::Ptr &device, ResultCallback callback) {
 
42
    fwd_->Disconnect(device, callback);
 
43
}
 
44
 
 
45
void ForwardingMiracastController::Scan(const std::chrono::seconds &timeout) {
 
46
    fwd_->Scan(timeout);
 
47
}
 
48
 
 
49
NetworkDeviceState ForwardingMiracastController::State() const {
 
50
    return fwd_->State();
 
51
}
 
52
 
 
53
std::vector<NetworkDeviceRole> ForwardingMiracastController::SupportedRoles() const {
 
54
    return fwd_->SupportedRoles();
 
55
}
 
56
 
 
57
bool ForwardingMiracastController::Scanning() const {
 
58
    return fwd_->Scanning();
 
59
}
 
60
}