Commit 752e1b1b authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Implemented activity-service comunication to android app

parent 95230394
......@@ -102,8 +102,8 @@ QString Daemon::listVisibleDevices()
QList<Device*> visibleDevices;
foreach (DeviceLocator* dl, deviceLocators) {
foreach (Device* d, dl->discover()) {
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();
......@@ -122,6 +122,18 @@ bool Daemon::linkDevice(QString id)
}
QString Daemon::listLinkedDevices(long int id)
{
QString ret;
Q_FOREACH (DeviceLink* dl, linkedDevices) {
ret += dl->device()->name() + "(" + dl->device()->id() + ")";
}
return ret;
}
Daemon::~Daemon()
{
qDebug() << "SAYONARA BABY";
......
......@@ -67,10 +67,10 @@ public Q_SLOTS:
Q_SCRIPTABLE bool linkAllPairedDevices();
Q_SCRIPTABLE QString listLinkedDevices(long id);
*/
Q_SCRIPTABLE QString listLinkedDevices(long id);
private:
//Get a DeviceLink through the best DeviceLocator available
......
......@@ -25,19 +25,27 @@
#include "networkpackage.h"
class Device;
class DeviceLink
: public QObject
{
Q_OBJECT
public:
DeviceLink();
DeviceLink(Device* d) : mDevice(d) { };
Device* device() { return mDevice; }
virtual void sendPackage(const NetworkPackage& np) = 0;
signals:
void receivedPackage(const NetworkPackage& np);
private:
Device* mDevice;
};
#endif // DEVICELINK_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment