[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498

Maximiliano Curia maxy at moszumanska.debian.org
Fri Oct 14 14:26:37 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=5d0510c

The following commit has been merged in the master branch:
commit 5d0510c83677886647c55aaa0bb67c12fb354708
Author: Albert Vaca <albertvaka at gmail.com>
Date:   Tue Jun 18 20:04:53 2013 +0200

    Reversed Avahi discovery (now the computer announces the service)
---
 src/CMakeLists.txt                            |   6 +-
 src/{devicelocator.cpp => announcer.cpp}      |   4 +-
 src/{devicelocator.h => announcer.h}          |  26 +++---
 src/{udpdevicelink.cpp => avahiannouncer.cpp} |  41 +++++++--
 src/{udpdevicelink.h => avahiannouncer.h}     |  32 ++++---
 src/avahidevicelocator.cpp                    | 118 --------------------------
 src/avahidevicelocator.h                      |  61 -------------
 src/daemon.cpp                                |  98 ++++++++++-----------
 src/daemon.h                                  |  25 ++++--
 src/{echodevicelink.cpp => fakeannouncer.cpp} |  19 +++++
 src/{fakedevicelocator.h => fakeannouncer.h}  |  25 +++---
 src/fakedevicelocator.cpp                     |  49 -----------
 src/udpdevicelink.cpp                         |   1 +
 src/udpdevicelink.h                           |   3 -
 14 files changed, 165 insertions(+), 343 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 593f34a..d55d8cd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,14 +1,14 @@
 set(kded_androidshine_SRCS
-    fakedevicelocator.cpp
+    fakeannouncer.cpp
     echodevicelink.cpp
     udpdevicelink.cpp
-    avahidevicelocator.cpp
+    avahiannouncer.cpp
     pausemusicpackagereceiver.cpp
     notificationpackagereceiver.cpp
     networkpackage.cpp
     daemon.cpp
     devicelink.cpp
-    devicelocator.cpp
+    announcer.cpp
     packagereceiver.cpp
 )
 
diff --git a/src/devicelocator.cpp b/src/announcer.cpp
similarity index 94%
rename from src/devicelocator.cpp
rename to src/announcer.cpp
index 5f1d45c..fbfd377 100644
--- a/src/devicelocator.cpp
+++ b/src/announcer.cpp
@@ -18,8 +18,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "devicelocator.h"
+#include "announcer.h"
 
-DeviceLocator::DeviceLocator() {
+Announcer::Announcer() {
     //gcc complains if we don't add something to compile on a class with virtual functions
 }
\ No newline at end of file
diff --git a/src/devicelocator.h b/src/announcer.h
similarity index 73%
rename from src/devicelocator.h
rename to src/announcer.h
index d970813..c6c3d3c 100644
--- a/src/devicelocator.h
+++ b/src/announcer.h
@@ -18,8 +18,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef DEVICELOCATOR_H
-#define DEVICELOCATOR_H
+#ifndef ANNOUNCER_H
+#define ANNOUNCER_H
 
 #include <qvector.h>
 #include <QObject>
@@ -27,16 +27,14 @@
 #include "devicelink.h"
 #include "device.h"
 
-class DeviceLocator
+class Announcer
     : public QObject
 {
     Q_OBJECT
 
 public:
-    DeviceLocator();
-    virtual ~DeviceLocator() { }
-
-    virtual QString getName() = 0;
+    Announcer();
+    virtual ~Announcer() { }
 
     enum Priority {
         PRIORITY_LOW = 0,      //ie: 3g
@@ -44,18 +42,16 @@ public:
         PRIORITY_HIGH = 100    //ie: lan
     };
 
+    virtual QString getName() = 0;
     virtual Priority getPriority() = 0;
-    virtual bool canLink(QString id) = 0;
-    virtual DeviceLink* link(QString id) = 0;
-    virtual bool pair(Device* d) = 0;
-    virtual QList<Device*> discover() = 0;
+
+    virtual void setDiscoverable(bool b) = 0;
 
 signals:
+    void deviceConnection(DeviceLink *);
 
-    //TODO: Emit this to be able to see if it is a known device
-    //void deviceDiscovered(Device* d);
-    //void deviceLost(QString id);
+signals:
 
 };
 
-#endif // DEVICELOCATOR_H
+#endif
diff --git a/src/udpdevicelink.cpp b/src/avahiannouncer.cpp
similarity index 62%
copy from src/udpdevicelink.cpp
copy to src/avahiannouncer.cpp
index f73f88c..c4bdb05 100644
--- a/src/udpdevicelink.cpp
+++ b/src/avahiannouncer.cpp
@@ -18,25 +18,32 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "udpdevicelink.h"
+#include "avahiannouncer.h"
 
+#include "udpdevicelink.h"
 
-UdpDeviceLink::UdpDeviceLink(Device* d, QHostAddress ip, quint16 port)
-    : DeviceLink(d)
+AvahiAnnouncer::AvahiAnnouncer()
 {
+    QString serviceType = "_kdeconnect._udp";
+    quint16 port = 10601;
 
-    mIp = ip;
-    mPort = port;
+    //http://api.kde.org/4.x-api/kdelibs-apidocs/dnssd/html/index.html
+    service = new DNSSD::PublicService("KDE Host", serviceType, port);
 
     mUdpSocket = new QUdpSocket();
     mUdpSocket->bind(port);
+
     connect(mUdpSocket, SIGNAL(readyRead()), this, SLOT(readPendingNotifications()));
 
+    qDebug() << "listening to udp messages";
+
 }
 
-void UdpDeviceLink::readPendingNotifications()
+void AvahiAnnouncer::readPendingNotifications()
 {
 
+    qDebug() << "readPendingNotifications";
+    
     while (mUdpSocket->hasPendingDatagrams()) {
 
         QByteArray datagram;
@@ -46,11 +53,27 @@ void UdpDeviceLink::readPendingNotifications()
         mUdpSocket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
 
         //log.write(datagram);
-        qDebug() << datagram;
+        qDebug() << ("AvahiAnnouncer incomming udp datagram: " + datagram);
 
-        NetworkPackage np = NetworkPackage::fromString(datagram);
+        QString id, name;
+
+        Device* device = new Device(id, name);
+        DeviceLink* dl = new UdpDeviceLink(device, sender, 10600);
+        links.append(dl);
+
+        emit deviceConnection(dl);
 
-        emit receivedPackage(np);
     }
 
 }
+
+AvahiAnnouncer::~AvahiAnnouncer()
+{
+    delete service;
+}
+
+void AvahiAnnouncer::setDiscoverable(bool b)
+{
+    if (b) service->publishAsync();
+}
+
diff --git a/src/udpdevicelink.h b/src/avahiannouncer.h
similarity index 72%
copy from src/udpdevicelink.h
copy to src/avahiannouncer.h
index 56bd9bb..4562a5c 100644
--- a/src/udpdevicelink.h
+++ b/src/avahiannouncer.h
@@ -18,39 +18,45 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef UDPDEVICELINK_H
-#define UDPDEVICELINK_H
+#ifndef AVAHIANNOUNCER_H
+#define AVAHIANNOUNCER_H
 
 #include <QObject>
-#include <QString>
 
-#include "devicelink.h"
-#include <qudpsocket.h>
+#include <QUdpSocket>
 
-class UdpDeviceLink
-    : public DeviceLink
+#include <KDE/DNSSD/PublicService>
+
+#include "announcer.h"
+
+class AvahiAnnouncer
+    : public Announcer
 {
     Q_OBJECT
 
 public:
-    UdpDeviceLink(Device* d, QHostAddress ip, quint16 port);
+    AvahiAnnouncer();
+    ~AvahiAnnouncer();
 
-    void sendPackage(const NetworkPackage& np) {
-        mUdpSocket->writeDatagram(np.toString(), mIp, mPort);
+    QString getName() { return "Avahi"; }
+    Priority getPriority() { return PRIORITY_HIGH; }
+
+    void setDiscoverable(bool b);
 
-    }
 
 
-    
 private Q_SLOTS:
     void readPendingNotifications();
 
 private:
+    DNSSD::PublicService* service;
     QUdpSocket* mUdpSocket;
 
+    QVector<DeviceLink*> links;
+
     QHostAddress mIp;
     quint16 mPort;
 
 };
 
-#endif // UDPDEVICELINK_H
+#endif
diff --git a/src/avahidevicelocator.cpp b/src/avahidevicelocator.cpp
index 2460da8..e69de29 100644
--- a/src/avahidevicelocator.cpp
+++ b/src/avahidevicelocator.cpp
@@ -1,118 +0,0 @@
-/**
- * Copyright 2013 Albert Vaca <albertvaka at gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "avahidevicelocator.h"
-
-#include "udpdevicelink.h"
-
-
-AvahiDeviceLocator::AvahiDeviceLocator()
-{
-    //http://api.kde.org/4.x-api/kdelibs-apidocs/dnssd/html/index.html
-    browser = new DNSSD::ServiceBrowser("_device._tcp");
-    connect(browser, SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)),this,SLOT(deviceDetected(DNSSD::RemoteService::Ptr)));
-    connect(browser, SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr)),this,SLOT(deviceLost(DNSSD::RemoteService::Ptr)));
-    browser->startBrowse();
-}
-
-bool AvahiDeviceLocator::canLink(QString id) {
-    return visibleDevices.contains(id);
-}
-
-DeviceLink* AvahiDeviceLocator::link(QString id) {
-
-    if (!visibleDevices.contains(id)) return NULL;
-
-    Device* d = visibleDevices[id];
-    const DNSSD::RemoteService::Ptr& rs = deviceRoutes[d];
-
-    DeviceLink* dl = new UdpDeviceLink(d, QHostAddress(rs->hostName()),rs->port());
-
-    qDebug() << "Sending pair request to device " + id;
-    NetworkPackage np(12345);
-    //TODO: Package contents
-    dl->sendPackage(np);
-
-    linkedDevices.append(dl); //Store the ref to be able to delete the memory later
-
-    return dl;
-}
-
-bool AvahiDeviceLocator::pair(Device* d)
-{
-    //TODO: ?
-    d->pair();
-    return true;
-}
-
-void AvahiDeviceLocator::deviceDetected(DNSSD::RemoteService::Ptr s)
-{
-    qDebug() << "DETECTED";
-
-    Device* d = getDeviceInfo(s);
-
-    if (!visibleDevices.contains(d->id())) {
-        visibleDevices[d->id()] = d;
-        deviceRoutes[d] = s;
-    } else {
-        qDebug() << "Warning: duplicate device id " + d->id();
-    }
-}
-
-void AvahiDeviceLocator::deviceLost(DNSSD::RemoteService::Ptr s)
-{
-    qDebug() << "LOST";
-
-    Device* found = NULL;
-
-    for(QMap< Device*, DNSSD::RemoteService::Ptr >::iterator it = deviceRoutes.begin(), itEnd = deviceRoutes.end(); it != itEnd; it++) {
-        if (s == it.value()) {
-            found = it.key();
-        }
-    }
-
-    if (found != NULL) {
-        visibleDevices.remove(found->id());
-        deviceRoutes.remove(found);
-        delete found; //created at getDeviceInfo called from deviceDetected
-    } else {
-        //TODO: Add a TAG to the debug messages
-        qDebug() << "Warning: lost unknown device?";
-    }
-}
-
-Device* AvahiDeviceLocator::getDeviceInfo(DNSSD::RemoteService::Ptr s)
-{
-    //TODO: I have no idea on how to get this info using only DNSSD, wihtout connecting to the device
-    Device* d = new Device("1234567890", "Unnamed"); //deleted at deviceLost
-    return d;
-}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/avahidevicelocator.h b/src/avahidevicelocator.h
deleted file mode 100644
index e95432c..0000000
--- a/src/avahidevicelocator.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright 2013 Albert Vaca <albertvaka at gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef AVAHIDEVICELOCATOR_H
-#define AVAHIDEVICELOCATOR_H
-
-#include <QObject>
-#include <KDE/DNSSD/ServiceBrowser>
-
-#include <KDE/DNSSD/RemoteService>
-
-#include "devicelocator.h"
-
-class AvahiDeviceLocator
-    : public DeviceLocator
-{
-    Q_OBJECT
-
-public:
-    AvahiDeviceLocator();
-    QString getName() { return "Avahi"; }
-    Priority getPriority() { return PRIORITY_HIGH; }
-    bool canLink(QString id);
-    DeviceLink* link(QString id);
-    bool pair(Device* d);
-    QList<Device*> discover() { return visibleDevices.values(); }
-
-private slots:
-    void deviceDetected(DNSSD::RemoteService::Ptr s);
-    void deviceLost(DNSSD::RemoteService::Ptr s);
-
-private:
-    DNSSD::ServiceBrowser* browser;
-
-    Device* getDeviceInfo(DNSSD::RemoteService::Ptr s);
-
-    QMap<QString, Device*> visibleDevices;
-    QMap<Device*, DNSSD::RemoteService::Ptr> deviceRoutes;
-
-    QList<DeviceLink*> linkedDevices;
-
-};
-
-#endif // AVAHIDEVICELOCATOR_H
diff --git a/src/daemon.cpp b/src/daemon.cpp
index c1b6dd2..b0440ec 100644
--- a/src/daemon.cpp
+++ b/src/daemon.cpp
@@ -22,8 +22,8 @@
 #include "networkpackage.h"
 #include "notificationpackagereceiver.h"
 #include "pausemusicpackagereceiver.h"
-#include "avahidevicelocator.h"
-#include "fakedevicelocator.h"
+#include "avahiannouncer.h"
+#include "fakeannouncer.h"
 
 #include <QtNetwork/QUdpSocket>
 #include <QFile>
@@ -37,32 +37,15 @@
 K_PLUGIN_FACTORY(AndroidShineFactory, registerPlugin<Daemon>();)
 K_EXPORT_PLUGIN(AndroidShineFactory("androidshine", "androidshine"))
 
-DeviceLink* Daemon::linkTo(QString id) {
+void Daemon::linkTo(DeviceLink* dl) {
 
-    DeviceLink* link = NULL;
+    linkedDevices.append(dl);
 
-    Q_FOREACH (DeviceLocator* locator, deviceLocators) {
-        if (locator->canLink(id)) {
-            link = locator->link(id);
-            if (link != NULL) break;
-        }
-    }
-
-    if (link != NULL) {
-
-        linkedDevices.append(link);
-
-        Q_FOREACH (PackageReceiver* pr, packageReceivers) {
-            QObject::connect(link,SIGNAL(receivedPackage(const NetworkPackage&)),
-                             pr,SLOT(receivePackage(const NetworkPackage&)));
-        }
-
-    } else {
-        qDebug() << "Could not link device id " + id;
+    Q_FOREACH (PackageReceiver* pr, packageReceivers) {
+        QObject::connect(dl,SIGNAL(receivedPackage(const NetworkPackage&)),
+                            pr,SLOT(receivePackage(const NetworkPackage&)));
     }
 
-    return link;
-
 }
 
 Daemon::Daemon(QObject *parent, const QList<QVariant>&)
@@ -76,22 +59,21 @@ Daemon::Daemon(QObject *parent, const QList<QVariant>&)
     packageReceivers.push_back(new PauseMusicPackageReceiver());
 
     //TODO: Do not hardcode the load of the device locators
-    deviceLocators.insert(new AvahiDeviceLocator());
-    deviceLocators.insert(new FakeDeviceLocator());
+    announcers.insert(new AvahiAnnouncer());
+    announcers.insert(new FakeAnnouncer());
+
+    //Listen to incomming connections
+    Q_FOREACH (Announcer* a, announcers) {
+        QObject::connect(a,SIGNAL(deviceConnection(DeviceLink*)),
+                            this,SLOT(deviceConnection(DeviceLink*)));
+        a->setDiscoverable(true);
+    }
 
     //TODO: Read paired devices from config
     //pairedDevices.push_back(new Device("MyAndroid","MyAndroid"));
 
-    //At boot time, try to link to all paired devices
-    //FIXME: This should be done for every new visible device, not only at boot
-    //TODO: Add a way to notify discovered/lost devices
-    Q_FOREACH (Device* device, pairedDevices) {
-        linkTo(device->id());
-    }
-
 }
 
-
 QString Daemon::listVisibleDevices()
 {
 
@@ -99,29 +81,22 @@ QString Daemon::listVisibleDevices()
 
     ret << std::setw(20) << "ID";
     ret << std::setw(20) << "Name";
-    ret << std::setw(20) << "Source";
     ret << std::endl;
 
-    QList<Device*> visibleDevices;
-
-    Q_FOREACH (DeviceLocator* dl, deviceLocators) {
-        Q_FOREACH (Device* d, dl->discover()) {
-            ret << std::setw(20) << d->id().toStdString();
-            ret << std::setw(20) << d->name().toStdString();
-            ret << std::setw(20) << dl->getName().toStdString();
-            ret << std::endl;
-        }
+    Q_FOREACH (Device* d, visibleDevices) {
+        ret << std::setw(20) << d->id().toStdString();
+        ret << std::setw(20) << d->name().toStdString();
+        ret << std::endl;
     }
 
     return QString::fromStdString(ret.str());
 
 }
 
-bool Daemon::linkDevice(QString id)
+bool Daemon::pairDevice(QString id)
 {
-
-    return linkTo(id);
-
+    //TODO
+    return true;
 }
 
 QString Daemon::listLinkedDevices()
@@ -133,9 +108,36 @@ QString Daemon::listLinkedDevices()
     }
 
     return ret;
+
 }
 
 
+void Daemon::deviceConnection(DeviceLink* dl)
+{
+
+    QString id = dl->device()->id();
+    bool paired = false;
+    Q_FOREACH (Device* d, pairedDevices) {
+        if (id == d->id()) {
+            paired = true;
+            break;
+        }
+    }
+
+    visibleDevices.append(dl->device());
+
+    if (paired) {
+        qDebug() << "Known device connected" + dl->device()->name();
+        linkTo(dl);
+    }
+    else {
+        qDebug() << "Unknown device connected" + dl->device()->name();
+        //TODO: Not connect immediately
+        linkTo(dl);
+    }
+
+}
+
 Daemon::~Daemon()
 {
     qDebug() << "SAYONARA BABY";
diff --git a/src/daemon.h b/src/daemon.h
index dcfab7d..b69b5d3 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -39,7 +39,7 @@
 #include "device.h"
 #include "packagereceiver.h"
 #include "devicelink.h"
-#include "devicelocator.h"
+#include "announcer.h"
 
 class QUdpSocket;
 
@@ -54,15 +54,16 @@ public:
 
 //DBUS interface
 
+private Q_SLOTS:
+    void deviceConnection(DeviceLink* dl);
+
 public Q_SLOTS:
 
     Q_SCRIPTABLE QString listVisibleDevices();
 
-    Q_SCRIPTABLE bool linkDevice(QString id);
-
-/*
     Q_SCRIPTABLE bool pairDevice(QString id);
 
+/*
     Q_SCRIPTABLE QString listPairedDevices(QString id);
 
     Q_SCRIPTABLE bool linkAllPairedDevices();
@@ -73,17 +74,23 @@ public Q_SLOTS:
 
 private:
 
-    //Get a DeviceLink through the best DeviceLocator available
-    DeviceLink* linkTo(QString d);
+    void linkTo(DeviceLink* dl);
+
+    //Non paired visible devices
+    QList<Device*> visibleDevices;
 
-    //All known devices (read from/stored to settings)
+    //All paired devices (should be stored and read from disk)
     QVector<Device*> pairedDevices;
 
     //Currently connected devices
     QVector<DeviceLink*> linkedDevices;
 
-    //Different ways to find new devices and connect to them, ordered by priority
-    QSet<DeviceLocator*> deviceLocators;
+
+
+
+
+    //Different ways to find devices and connect to them, ordered by priority
+    QSet<Announcer*> announcers;
 
     //Everybody who wants to be notified about a new package
     QVector<PackageReceiver*> packageReceivers;
diff --git a/src/echodevicelink.cpp b/src/fakeannouncer.cpp
similarity index 72%
copy from src/echodevicelink.cpp
copy to src/fakeannouncer.cpp
index e12b8c0..3656948 100644
--- a/src/echodevicelink.cpp
+++ b/src/fakeannouncer.cpp
@@ -18,4 +18,23 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "fakeannouncer.h"
 #include "echodevicelink.h"
+
+FakeAnnouncer::FakeAnnouncer()
+{
+    fakeDevice = new Device("fake","Fake device");
+    echoDeviceLink = new EchoDeviceLink(fakeDevice);
+}
+
+FakeAnnouncer::~FakeAnnouncer()
+{
+    //delete echoDeviceLink;
+    //delete fakeDevice;
+}
+
+void FakeAnnouncer::setDiscoverable(bool b)
+{
+    if (b) emit deviceConnection(echoDeviceLink);
+}
+
diff --git a/src/fakedevicelocator.h b/src/fakeannouncer.h
similarity index 74%
rename from src/fakedevicelocator.h
rename to src/fakeannouncer.h
index 6ac865e..784810f 100644
--- a/src/fakedevicelocator.h
+++ b/src/fakeannouncer.h
@@ -18,23 +18,22 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef FAKEDEVICELOCATOR_H
-#define FAKEDEVICELOCATOR_H
-#include "devicelocator.h"
+#ifndef FAKEANNOUNCER_H
+#define FAKEANNOUNCER_H
 
-class FakeDeviceLocator
-    : public DeviceLocator
+#include "announcer.h"
+
+class FakeAnnouncer
+    : public Announcer
 {
 public:
-    FakeDeviceLocator();
-    
-    QString getName() { return "FakeLocator"; }
+    FakeAnnouncer();
+    ~FakeAnnouncer();
 
+    QString getName() { return "FakeAnnouncer"; }
     Priority getPriority() { return PRIORITY_LOW; }
-    bool canLink(QString id);
-    DeviceLink* link(QString id);
-    bool pair(Device* d);
-    QList<Device*> discover();
+
+    void setDiscoverable(bool b);
 
 private:
     Device* fakeDevice;
@@ -42,4 +41,4 @@ private:
     
 };
 
-#endif // FAKEDEVICELOCATOR_H
+#endif
diff --git a/src/fakedevicelocator.cpp b/src/fakedevicelocator.cpp
deleted file mode 100644
index 2469383..0000000
--- a/src/fakedevicelocator.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright 2013 Albert Vaca <albertvaka at gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "fakedevicelocator.h"
-#include "echodevicelink.h"
-
-FakeDeviceLocator::FakeDeviceLocator()
-{
-    fakeDevice = new Device("fake","Fake device");
-    echoDeviceLink = new EchoDeviceLink(fakeDevice);
-}
-
-bool FakeDeviceLocator::canLink(QString id) {
-    return id == "fake";
-}
-
-DeviceLink* FakeDeviceLocator::link(QString id) {
-    if (!canLink(id)) return NULL;
-    return echoDeviceLink;
-}
-
-bool FakeDeviceLocator::pair(Device* d) {
-    if (d != fakeDevice) return false;
-    d->pair();
-    return true;
-}
-
-QList<Device*> FakeDeviceLocator::discover() {
-    QList<Device*> devices;
-    devices.append(fakeDevice);
-    return devices;
-}
diff --git a/src/udpdevicelink.cpp b/src/udpdevicelink.cpp
index f73f88c..68931aa 100644
--- a/src/udpdevicelink.cpp
+++ b/src/udpdevicelink.cpp
@@ -51,6 +51,7 @@ void UdpDeviceLink::readPendingNotifications()
         NetworkPackage np = NetworkPackage::fromString(datagram);
 
         emit receivedPackage(np);
+        
     }
 
 }
diff --git a/src/udpdevicelink.h b/src/udpdevicelink.h
index 56bd9bb..4fa2e30 100644
--- a/src/udpdevicelink.h
+++ b/src/udpdevicelink.h
@@ -37,10 +37,7 @@ public:
 
     void sendPackage(const NetworkPackage& np) {
         mUdpSocket->writeDatagram(np.toString(), mIp, mPort);
-
     }
-
-
     
 private Q_SLOTS:
     void readPendingNotifications();

-- 
kdeconnect packaging



More information about the pkg-kde-commits mailing list