Implemented activity-service comunication to android app

This commit is contained in:
Albert Vaca 2013-06-18 02:14:22 +02:00
parent 9523039473
commit 752e1b1b53
3 changed files with 25 additions and 5 deletions

View file

@ -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";

View file

@ -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

View file

@ -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