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

« back to all changes in this revision

Viewing changes to src/mcs/networkdeviceskeleton.cpp

  • Committer: CI Train Bot
  • Author(s): Simon Fels
  • Date: 2016-04-29 09:54:49 UTC
  • mfrom: (136.1.17 trunk)
  • Revision ID: ci-train-bot@canonical.com-20160429095449-diyen52l869w9siw
Various fixes and improvements for stability

* React on RTSP timeouts and disconnect when one happens
* Don't save state on shutdown as its already saved
* Implement state saving / property guards
* Implement proper dbus errors and fix spec
* Fix H264Encoder tests
* Implement backend logic for the Enabled property
* Add Enabled property for our manager interface
* Bring back resending of failed packets
* Handle error/terminate cases for buffer queue
Approved by: Alfonso Sanchez-Beato

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include <algorithm>
19
19
#include <boost/concept_check.hpp>
20
20
 
21
 
#include "networkdeviceskeleton.h"
22
 
#include "utils.h"
23
 
#include "keep_alive.h"
24
 
#include "logger.h"
25
 
#include "dbushelpers.h"
 
21
#include "mcs/networkdeviceskeleton.h"
 
22
#include "mcs/utils.h"
 
23
#include "mcs/keep_alive.h"
 
24
#include "mcs/logger.h"
 
25
#include "mcs/dbushelpers.h"
 
26
#include "mcs/dbuserrors.h"
26
27
 
27
28
namespace mcs {
28
29
 
91
92
    auto inst = static_cast<WeakKeepAlive<NetworkDeviceSkeleton>*>(user_data)->GetInstance().lock();
92
93
 
93
94
    if (not inst) {
94
 
        g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Invalid state");
 
95
        g_dbus_method_invocation_return_error(invocation, AETHERCAST_ERROR,
 
96
            AETHERCAST_ERROR_INVALID_STATE, "Invalid state");
95
97
        return TRUE;
96
98
    }
97
99
 
100
102
 
101
103
    inst->controller_->Connect(inst->Fwd(), [inv](mcs::Error error) {
102
104
        if (error != Error::kNone) {
103
 
            g_dbus_method_invocation_return_error(inv.get(), G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
104
 
                                                  "%s", mcs::ErrorToString(error).c_str());
 
105
            g_dbus_method_invocation_return_error(inv.get(), AETHERCAST_ERROR,
 
106
                AethercastErrorFromError(error), "%s", mcs::ErrorToString(error).c_str());
105
107
            return;
106
108
        }
107
109
 
119
121
    auto inst = static_cast<WeakKeepAlive<NetworkDeviceSkeleton>*>(user_data)->GetInstance().lock();
120
122
 
121
123
    if (not inst) {
122
 
        g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Invalid state");
 
124
        g_dbus_method_invocation_return_error(invocation, AETHERCAST_ERROR,
 
125
            AETHERCAST_ERROR_INVALID_STATE, "Invalid state");
123
126
        return TRUE;
124
127
    }
125
128
 
128
131
 
129
132
    inst->controller_->Disconnect(inst->Fwd(), [inv](mcs::Error error) {
130
133
        if (error != Error::kNone) {
131
 
            g_dbus_method_invocation_return_error(inv.get(), G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
132
 
                                                  "%s", mcs::ErrorToString(error).c_str());
 
134
            g_dbus_method_invocation_return_error(inv.get(), AETHERCAST_ERROR,
 
135
                AethercastErrorFromError(error), "%s", mcs::ErrorToString(error).c_str());
133
136
            return;
134
137
        }
135
138