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

« back to all changes in this revision

Viewing changes to src/mcs/miracastcontrollerskeleton.h

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:
31
31
 
32
32
#include "scoped_gobject.h"
33
33
 
34
 
#include "miracastservice.h"
 
34
#include "forwardingmiracastcontroller.h"
35
35
#include "networkdeviceadapter.h"
36
36
 
37
37
namespace mcs {
38
 
class MiracastServiceAdapter : public std::enable_shared_from_this<MiracastServiceAdapter>,
39
 
                               public MiracastService::Delegate {
 
38
class MiracastControllerSkeleton : public std::enable_shared_from_this<MiracastControllerSkeleton>,
 
39
                                   public ForwardingMiracastController,
 
40
                                   public MiracastController::Delegate {
40
41
public:
41
42
    static constexpr const char *kBusName{"org.aethercast"};
42
43
    static constexpr const char *kManagerPath{"/org/aethercast"};
43
44
    static constexpr const char *kManagerIface{"org.aethercast.Manager"};
44
45
 
45
 
    static std::shared_ptr<MiracastServiceAdapter> create(const std::shared_ptr<MiracastService> &service);
 
46
    static std::shared_ptr<MiracastControllerSkeleton> create(const std::shared_ptr<MiracastController> &controller);
46
47
 
47
 
    ~MiracastServiceAdapter();
 
48
    ~MiracastControllerSkeleton();
48
49
 
49
50
    void OnStateChanged(NetworkDeviceState state) override;
50
51
    void OnDeviceFound(const NetworkDevice::Ptr &device) override;
58
59
    static void OnHandleScan(AethercastInterfaceManager *skeleton, GDBusMethodInvocation *invocation,
59
60
                              gpointer user_data);
60
61
 
61
 
    MiracastServiceAdapter(const std::shared_ptr<MiracastService> &service);
62
 
    std::shared_ptr<MiracastServiceAdapter> FinalizeConstruction();
 
62
    MiracastControllerSkeleton(const std::shared_ptr<MiracastController> &controller);
 
63
    std::shared_ptr<MiracastControllerSkeleton> FinalizeConstruction();
63
64
 
64
65
    void SyncProperties();
65
66
 
66
67
    std::string GenerateDevicePath(const NetworkDevice::Ptr &device) const;
 
68
 
67
69
private:
68
 
    std::shared_ptr<MiracastService> service_;
69
70
    ScopedGObject<AethercastInterfaceManager> manager_obj_;
70
71
    SharedGObject<GDBusConnection> bus_connection_;
71
72
    guint bus_id_;