Fixed loopback link provider
This commit is contained in:
parent
df6c2f8604
commit
3d6178ae95
3 changed files with 19 additions and 6 deletions
|
@ -22,8 +22,8 @@
|
|||
|
||||
#include "linkproviders/loopbacklinkprovider.h"
|
||||
|
||||
EchoDeviceLink::EchoDeviceLink(const QString& d, LoopbackLinkProvider* a)
|
||||
: DeviceLink(d, a)
|
||||
EchoDeviceLink::EchoDeviceLink(const QString& deviceId, LoopbackLinkProvider* provider)
|
||||
: DeviceLink(deviceId, provider)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
LoopbackLinkProvider::LoopbackLinkProvider()
|
||||
: identityPackage(PACKAGE_TYPE_IDENTITY)
|
||||
{
|
||||
echoDeviceLink = new EchoDeviceLink("fake", this);
|
||||
echoDeviceLink = new EchoDeviceLink("loopback", this);
|
||||
NetworkPackage::createIdentityPackage(&identityPackage);
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,20 @@ LoopbackLinkProvider::~LoopbackLinkProvider()
|
|||
//delete echoDeviceLink;
|
||||
}
|
||||
|
||||
void LoopbackLinkProvider::setDiscoverable(bool b)
|
||||
void LoopbackLinkProvider::onNetworkChange(QNetworkSession::State state)
|
||||
{
|
||||
Q_UNUSED(state);
|
||||
qDebug() << "Echo Device discovery emitted";
|
||||
if (b) Q_EMIT onConnectionReceived(identityPackage, echoDeviceLink);
|
||||
Q_EMIT onConnectionReceived(identityPackage, echoDeviceLink);
|
||||
}
|
||||
|
||||
void LoopbackLinkProvider::onStart()
|
||||
{
|
||||
onNetworkChange(QNetworkSession::Connected);
|
||||
}
|
||||
|
||||
void LoopbackLinkProvider::onStop()
|
||||
{
|
||||
onConnectionLost(echoDeviceLink);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,9 @@ public:
|
|||
QString name() { return "LoopbackLinkProvider"; }
|
||||
int priority() { return PRIORITY_LOW; }
|
||||
|
||||
void setDiscoverable(bool b);
|
||||
virtual void onStart();
|
||||
virtual void onStop();
|
||||
virtual void onNetworkChange(QNetworkSession::State state);
|
||||
|
||||
private:
|
||||
DeviceLink* echoDeviceLink;
|
||||
|
|
Loading…
Reference in a new issue