drop old mockdevice and use the new one

pull/1/head
Michael Zanetti 2014-04-04 19:56:48 +02:00
parent 70165a2a9c
commit dc5aa1a2b8
8 changed files with 4 additions and 160 deletions

View File

@ -14,4 +14,4 @@ SOURCES += testjsonrpc.cpp \
HEADERS += mocktcpserver.h
LIBS += -L../mocks/mockdeviceplugin/ -lguh_devicepluginmockdevice
LIBS += -L$$top_builddir/plugins/deviceplugins/mock/ -lguh_devicepluginmock

View File

@ -24,7 +24,7 @@
#include <QCoreApplication>
//#include <QSignalSpy>
Q_IMPORT_PLUGIN(DevicePluginMockDevice)
Q_IMPORT_PLUGIN(DevicePluginMock)
class TestJSONRPC: public QObject
{
@ -117,7 +117,7 @@ void TestJSONRPC::getSupportedDevices()
// Make sure there is exactly 1 supported device class with the name Mock Wifi Device
QCOMPARE(supportedDevices.toMap().value("params").toMap().value("deviceClasses").toList().count(), 1);
QString deviceName = supportedDevices.toMap().value("params").toMap().value("deviceClasses").toList().first().toMap().value("name").toString();
QCOMPARE(deviceName, QString("Mock WiFi Device"));
QCOMPARE(deviceName, QString("Mock Device"));
}
void TestJSONRPC::enableDisableNotifications_data()

View File

@ -1,98 +0,0 @@
/****************************************************************************
* *
* This file is part of guh. *
* *
* Guh 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, version 2 of the License. *
* *
* Guh 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 guh. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
#include "devicepluginmockdevice.h"
#include "device.h"
#include "devicemanager.h"
#include <QDebug>
#include <QStringList>
QUuid pluginUuid = QUuid("2ce2ebc6-7dbb-4b89-ad67-6226aa955041");
QUuid mockWifiDetectorId = QUuid("37279e41-a478-43fa-92b4-c889db578670");
QUuid inRangeStateTypeId = QUuid("110deaf9-5615-4e08-942b-d5443a3bf965");
QUuid inRangeEventTypeId = QUuid("7f77120e-b3d1-493f-936e-9d86d7489785");
DevicePluginMockDevice::DevicePluginMockDevice()
{
}
QList<DeviceClass> DevicePluginMockDevice::supportedDevices() const
{
QList<DeviceClass> ret;
DeviceClass deviceClassMockWifiDetector(pluginId(), mockWifiDetectorId);
deviceClassMockWifiDetector.setName("Mock WiFi Device");
QVariantList detectorParams;
QVariantMap macParam;
macParam.insert("name", "mac");
macParam.insert("type", "string");
detectorParams.append(macParam);
deviceClassMockWifiDetector.setParams(detectorParams);
QList<StateType> detectorStates;
StateType inRangeState(inRangeStateTypeId);
inRangeState.setName("inRange");
inRangeState.setType(QVariant::Bool);
inRangeState.setDefaultValue(false);
detectorStates.append(inRangeState);
deviceClassMockWifiDetector.setStates(detectorStates);
QList<EventType> detectorEvents;
QVariantList detectorEventParams;
QVariantMap paramInRange;
paramInRange.insert("name", "inRange");
paramInRange.insert("type", "bool");
detectorEventParams.append(paramInRange);
EventType inRangeEvent(inRangeEventTypeId);
inRangeEvent.setName("inRange");
inRangeEvent.setParameters(detectorEventParams);
detectorEvents.append(inRangeEvent);
deviceClassMockWifiDetector.setEvents(detectorEvents);
ret.append(deviceClassMockWifiDetector);
return ret;
}
DeviceManager::HardwareResources DevicePluginMockDevice::requiredHardware() const
{
return DeviceManager::HardwareResourceTimer;
}
QString DevicePluginMockDevice::pluginName() const
{
return "WiFi Detector";
}
QUuid DevicePluginMockDevice::pluginId() const
{
return pluginUuid;
}
void DevicePluginMockDevice::guhTimer()
{
}

View File

@ -1,44 +0,0 @@
/****************************************************************************
* *
* This file is part of guh. *
* *
* Guh 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, version 2 of the License. *
* *
* Guh 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 guh. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
#ifndef DEVICEPLUGINMOCKDEVICE_H
#define DEVICEPLUGINMOCKDEVICE_H
#include "deviceplugin.h"
class DevicePluginMockDevice: public DevicePlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.guh.DevicePlugin" FILE "devicepluginmockdevice.json")
Q_INTERFACES(DevicePlugin)
public:
explicit DevicePluginMockDevice();
QList<DeviceClass> supportedDevices() const override;
DeviceManager::HardwareResources requiredHardware() const override;
QString pluginName() const override;
QUuid pluginId() const override;
void guhTimer() override;
};
#endif // DEVICEPLUGINMOCKDEVICE_H

View File

@ -1,9 +0,0 @@
include($$top_srcdir/plugins/plugins.pri)
TARGET = $$qtLibraryTarget(guh_devicepluginmockdevice)
SOURCES += \
devicepluginmockdevice.cpp
HEADERS += \
devicepluginmockdevice.h

View File

@ -1,2 +0,0 @@
TEMPLATE = subdirs
SUBDIRS += mockdeviceplugin

View File

@ -1,4 +1,2 @@
TEMPLATE = subdirs
SUBDIRS = mocks auto
auto.depens = mocks
SUBDIRS = auto