mirror of https://github.com/nymea/nymea.git
simplify api
parent
0faa329df9
commit
085f02ce30
|
|
@ -53,11 +53,11 @@ QList<Device *> DeviceManager::configuredDevices() const
|
|||
return m_configuredDevices;
|
||||
}
|
||||
|
||||
QList<Device *> DeviceManager::findConfiguredDevices(const DeviceClass &deviceClass)
|
||||
QList<Device *> DeviceManager::findConfiguredDevices(const QUuid &deviceClassId)
|
||||
{
|
||||
QList<Device*> ret;
|
||||
foreach (Device *device, m_configuredDevices) {
|
||||
if (device->deviceClassId() == deviceClass.id()) {
|
||||
if (device->deviceClassId() == deviceClassId) {
|
||||
ret << device;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
QList<Device*> configuredDevices() const;
|
||||
DeviceError addConfiguredDevice(const QUuid &deviceClassId, const QVariantMap ¶ms);
|
||||
|
||||
QList<Device*> findConfiguredDevices(const DeviceClass &deviceClass);
|
||||
QList<Device*> findConfiguredDevices(const QUuid &deviceClassId);
|
||||
DeviceClass findDeviceClass(const QUuid &deviceClassId);
|
||||
|
||||
Radio433 *radio433() const;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
QUuid mumbiRemote = QUuid("d85c1ef4-197c-4053-8e40-707aa671d302");
|
||||
QUuid mumbiRfSwitch = QUuid("308ae6e6-38b3-4b3a-a513-3199da2764f8");
|
||||
|
||||
RfSwitch::RfSwitch()
|
||||
{
|
||||
}
|
||||
|
|
@ -20,7 +23,7 @@ QList<DeviceClass> RfSwitch::supportedDevices() const
|
|||
// TODO: load list from config with static uuid
|
||||
QList<DeviceClass> ret;
|
||||
|
||||
DeviceClass deviceClassRfRemote(QUuid::createUuid());
|
||||
DeviceClass deviceClassRfRemote(mumbiRemote);
|
||||
deviceClassRfRemote.setName("RF Remote");
|
||||
|
||||
QVariantList deviceParams;
|
||||
|
|
@ -77,7 +80,7 @@ QList<DeviceClass> RfSwitch::supportedDevices() const
|
|||
ret.append(deviceClassRfRemote);
|
||||
|
||||
|
||||
DeviceClass deviceClassRfSwitch(QUuid::createUuid());
|
||||
DeviceClass deviceClassRfSwitch(mumbiRfSwitch);
|
||||
deviceClassRfSwitch.setName("RF Switch");
|
||||
ret.append(deviceClassRfSwitch);
|
||||
|
||||
|
|
@ -101,7 +104,7 @@ void RfSwitch::dataReceived(QList<int> rawData)
|
|||
group << true << false << false << false << false;
|
||||
|
||||
Device *device = 0;
|
||||
QList<Device*> deviceList = deviceManager()->findConfiguredDevices(deviceClassRfRemote);
|
||||
QList<Device*> deviceList = deviceManager()->findConfiguredDevices(deviceClassRfRemote.id());
|
||||
foreach (Device *dev, deviceList) {
|
||||
if (dev->params().contains("channel1") && dev->params().value("channel1").toBool() == group.at(0) &&
|
||||
dev->params().contains("channel2") && dev->params().value("channel2").toBool() == group.at(1) &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue