diff --git a/anel/translations/69d14951-0c02-4877-bcef-dffdf48b7ccb-de_DE.qm b/anel/translations/69d14951-0c02-4877-bcef-dffdf48b7ccb-de_DE.qm deleted file mode 100644 index 5c290660..00000000 Binary files a/anel/translations/69d14951-0c02-4877-bcef-dffdf48b7ccb-de_DE.qm and /dev/null differ diff --git a/anel/translations/69d14951-0c02-4877-bcef-dffdf48b7ccb-en_US.qm b/anel/translations/69d14951-0c02-4877-bcef-dffdf48b7ccb-en_US.qm deleted file mode 100644 index be651eed..00000000 --- a/anel/translations/69d14951-0c02-4877-bcef-dffdf48b7ccb-en_US.qm +++ /dev/null @@ -1 +0,0 @@ -<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/anel/translations/888efa70-661b-4e3e-bb9c-e3e681ed5ece-de_DE.qm b/anel/translations/888efa70-661b-4e3e-bb9c-e3e681ed5ece-de_DE.qm deleted file mode 100644 index 5c290660..00000000 Binary files a/anel/translations/888efa70-661b-4e3e-bb9c-e3e681ed5ece-de_DE.qm and /dev/null differ diff --git a/anel/translations/888efa70-661b-4e3e-bb9c-e3e681ed5ece-en_US.qm b/anel/translations/888efa70-661b-4e3e-bb9c-e3e681ed5ece-en_US.qm deleted file mode 100644 index be651eed..00000000 --- a/anel/translations/888efa70-661b-4e3e-bb9c-e3e681ed5ece-en_US.qm +++ /dev/null @@ -1 +0,0 @@ -<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/guh-plugins.pro b/guh-plugins.pro index 761e7ef8..29ba5262 100644 --- a/guh-plugins.pro +++ b/guh-plugins.pro @@ -29,8 +29,5 @@ SUBDIRS += \ orderbutton \ denon \ avahimonitor \ - pushbullet \ - usbwde \ senic \ - multisensor \ gpio \ diff --git a/multisensor/devicepluginmultisensor.cpp b/multisensor/devicepluginmultisensor.cpp deleted file mode 100644 index f3026b59..00000000 --- a/multisensor/devicepluginmultisensor.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2015 Simon Stuerz * - * Copyright (C) 2016 nicc * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/*! - \page multisensor.html - \title MultiSensor - \brief Plugin for TI SensorTag. - - \ingroup plugins - \ingroup guh-plugins - - This plugin allows finding and controlling the Bluetooth Low Energy SensorTag from Texas Instruments. - - \chapter Plugin properties - Following JSON file contains the definition and the description of all available \l{DeviceClass}{DeviceClasses} - and \l{Vendor}{Vendors} of this \l{DevicePlugin}. - - For more details on how to read this JSON file please check out the documentation for \l{The plugin JSON File}. - - \quotefile plugins/deviceplugins/multisensor/devicepluginmultisensor.json -*/ - -#ifdef BLUETOOTH_LE - -#include "plugininfo.h" -#include "devicemanager.h" -#include "bluetooth/bluetoothlowenergydevice.h" -#include "devicepluginmultisensor.h" - -DevicePluginMultiSensor::DevicePluginMultiSensor() -{ - -} - -DeviceManager::HardwareResources DevicePluginMultiSensor::requiredHardware() const -{ - return DeviceManager::HardwareResourceBluetoothLE; -} - -DeviceManager::DeviceError DevicePluginMultiSensor::discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms) -{ - Q_UNUSED(params) - - if (deviceClassId != sensortagDeviceClassId) - return DeviceManager::DeviceErrorDeviceClassNotFound; - - if (!discoverBluetooth()) - return DeviceManager::DeviceErrorHardwareNotAvailable; - - return DeviceManager::DeviceErrorAsync; -} - -void DevicePluginMultiSensor::bluetoothDiscoveryFinished(const QList &deviceInfos) -{ - QList deviceDescriptors; - foreach (auto deviceInfo, deviceInfos) { - if (deviceInfo.name().contains("SensorTag")) { - if (!verifyExistingDevices(deviceInfo)) { - DeviceDescriptor descriptor(sensortagDeviceClassId, "SensorTag", deviceInfo.address().toString()); - ParamList params; - params.append(Param(nameParamTypeId, deviceInfo.name())); - params.append(Param(macParamTypeId, deviceInfo.address().toString())); - descriptor.setParams(params); - deviceDescriptors.append(descriptor); - } - } - } - - emit devicesDiscovered(sensortagDeviceClassId, deviceDescriptors); -} - -DeviceManager::DeviceSetupStatus DevicePluginMultiSensor::setupDevice(Device *device) -{ - qCDebug(dcMultiSensor) << "Setting up MultiSensor" << device->name() << device->params(); - - if (device->deviceClassId() == sensortagDeviceClassId) { - auto address = QBluetoothAddress(device->paramValue(macParamTypeId).toString()); - auto name = device->paramValue(nameParamTypeId).toString(); - auto deviceInfo = QBluetoothDeviceInfo(address, name, 0); - - QSharedPointer tag{new SensorTag(deviceInfo, QLowEnergyController::PublicAddress, this)}; - connect(tag.data(), &SensorTag::valueChanged, this, - [device, this](StateTypeId state, QVariant value) { device->setStateValue(state, value); }); - connect(tag.data(), &SensorTag::event, this, - [device, this](EventTypeId event) { emit emitEvent(Event(event, device->id())); }); - m_tags.insert(tag, device); - - tag->connectDevice(); - - return DeviceManager::DeviceSetupStatusSuccess; - } - return DeviceManager::DeviceSetupStatusFailure; -} - - -void DevicePluginMultiSensor::deviceRemoved(Device *device) -{ - if (!m_tags.values().contains(device)) - return; - - auto tag= m_tags.key(device); - m_tags.remove(tag); -} - -bool DevicePluginMultiSensor::verifyExistingDevices(const QBluetoothDeviceInfo &deviceInfo) -{ - foreach (Device *device, myDevices()) { - if (device->paramValue(macParamTypeId).toString() == deviceInfo.address().toString()) - return true; - } - - return false; -} - -#endif // BLUETOOTH_LE diff --git a/multisensor/devicepluginmultisensor.h b/multisensor/devicepluginmultisensor.h deleted file mode 100644 index 1e587de1..00000000 --- a/multisensor/devicepluginmultisensor.h +++ /dev/null @@ -1,59 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2015 Simon Stuerz * - * Copyright (C) 2016 nicc * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef DEVICEPLUGINMULTISENSOR_H -#define DEVICEPLUGINMULTISENSOR_H - -#ifdef BLUETOOTH_LE - -#include -#include -#include "plugin/deviceplugin.h" -#include "devicemanager.h" -#include "bluetooth/bluetoothlowenergydevice.h" -#include "sensortag.h" - -class DevicePluginMultiSensor : public DevicePlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "guru.guh.DevicePlugin" FILE "devicepluginmultisensor.json") - Q_INTERFACES(DevicePlugin) - -public: - explicit DevicePluginMultiSensor(); - - DeviceManager::HardwareResources requiredHardware() const override; - DeviceManager::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms) override; - void bluetoothDiscoveryFinished(const QList &deviceInfos) override; - DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; - void deviceRemoved(Device *device) override; - -private: - bool verifyExistingDevices(const QBluetoothDeviceInfo &deviceInfo); - - QHash,QPointer> m_tags; -}; - -#endif // BLUETOOTH_LE - -#endif // DEVICEPLUGINMULTISENSOR_H diff --git a/multisensor/devicepluginmultisensor.json b/multisensor/devicepluginmultisensor.json deleted file mode 100644 index f9ccac09..00000000 --- a/multisensor/devicepluginmultisensor.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "name": "MultiSensor", - "idName": "MultiSensor", - "id": "23bf0d8d-df7d-4bee-80ee-f015c5a7f52e", - "vendors": [ - { - "name": "Texas Instruments", - "idName": "texas", - "id": "2edf543e-dc2c-4693-bb0c-e76c0d305fad", - "deviceClasses": [ - { - "name": "Sensor Tag", - "idName": "sensortag", - "id": "158a06b6-b27f-4951-957e-6f1e3b44f604", - "createMethods": ["discovery"], - "deviceIcon": "Thermometer", - "criticalStateTypeId": "a9629b11-0f34-47f0-a0f0-f758a6aec2b4", - "basicTags": [ - "Device", - "Sensor" - ], - "paramTypes": [ - { - "id": "bdb9d684-2f98-45f5-889c-f184c1e73dc7", - "idName": "name", - "name": "name", - "type": "QString", - "inputType": "TextLine", - "index" : 0 - }, - { - "id": "d51ed68e-c84a-4136-a5b5-be2f95fd5a0f", - "idName": "mac", - "name": "mac address", - "type": "QString", - "index": 1, - "inputType": "MacAddress" - } - ], - "stateTypes": [ - { - "id": "a9629b11-0f34-47f0-a0f0-f758a6aec2b4", - "idName": "connected", - "name": "connected", - "eventTypeName": "connected changed", - "index": 0, - "type": "bool", - "defaultValue": false - }, - { - "id": "c664e9ec-a045-49ba-add1-1642ceba7c4f", - "idName": "IRtemperature", - "name": "IR temperature", - "eventTypeName": "IR temperature changed", - "index": 1, - "type": "double", - "unit": "DegreeCelsius", - "defaultValue": 0 - }, - { - "id": "e83a50ff-96c9-4b6d-889f-f4238353e794", - "idName": "humidity", - "name": "humidity", - "eventTypeName": "humidity changed", - "index": 2, - "type": "double", - "unit": "Percentage", - "defaultValue": 0 - }, - { - "id": "8359ada9-df1c-4e60-bb87-9e21d05ee2e2", - "idName": "temperature", - "name": "temperature", - "eventTypeName": "temperature changed", - "index": 3, - "type": "double", - "unit": "DegreeCelsius", - "defaultValue": 0 - }, - { - "id": "645633ad-77d4-45b2-8be8-d6ca7a12eb7a", - "idName": "pressure", - "name": "pressure", - "eventTypeName": "pressure changed", - "index": 4, - "type": "double", - "unit": "HectoPascal", - "defaultValue": 0 - }, - { - "id": "4be5ca26-0565-419d-b18b-2a5a385d2a3d", - "idName": "moving", - "name": "moving", - "eventTypeName": "moving changed", - "index": 5, - "type": "bool", - "defaultValue": false - } - ], - "eventTypes": [ - { - "id": "61478490-bed0-4fed-9d58-f13c35b4f220", - "idName": "leftKey", - "index": 0, - "name": "left key pressed" - }, - { - "id": "b7e927db-af28-4fdc-8eb7-edb02258ff5a", - "idName": "rightKey", - "index": 1, - "name": "right key pressed" - } - ] - } - ] - } - ] -} diff --git a/multisensor/multisensor.pro b/multisensor/multisensor.pro deleted file mode 100644 index 0e6250d4..00000000 --- a/multisensor/multisensor.pro +++ /dev/null @@ -1,15 +0,0 @@ -TRANSLATIONS = translations/en_US.ts \ - translations/de_DE.ts - -# Note: include after the TRANSLATIONS definition -include(../plugins.pri) - -TARGET = $$qtLibraryTarget(guh_devicepluginmultisensor) - -SOURCES += \ - devicepluginmultisensor.cpp \ - sensortag.cpp - -HEADERS += \ - devicepluginmultisensor.h \ - sensortag.h diff --git a/multisensor/sensortag.cpp b/multisensor/sensortag.cpp deleted file mode 100644 index f496410c..00000000 --- a/multisensor/sensortag.cpp +++ /dev/null @@ -1,337 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2015 Simon Stürz * - * Copyright (C) 2016 nicc * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifdef BLUETOOTH_LE - -#include -#include -#include -#include "extern-plugininfo.h" -#include "sensortag.h" - -SensorTag::SensorTag(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType, QObject *parent) : - BluetoothLowEnergyDevice(deviceInfo, addressType, parent) -{ - connect(this, SIGNAL(connectionStatusChanged()), this,SLOT(onConnectionStatusChanged())); - connect(this, SIGNAL(servicesDiscoveryFinished()), this, SLOT(setupServices())); -} - -double SensorTag::calculateMeanValue(const QList &list) -{ - double sum = 0; - foreach (const double &value, list) - sum += value; - - return sum / list.count(); -} - -void SensorTag::setupServices() -{ - foreach (auto id, m_services.keys()) { - if (!controller()->services().contains(id)) { - qCWarning(dcMultiSensor) << "Service not found for device" << name() << address().toString(); - return; - } - - if (m_services.value(id)) { - qCWarning(dcMultiSensor) << "Attention! bad implementation of service handling!!"; - return; - } - - qCDebug(dcMultiSensor) << "Setup service"; - - // service for temperature - QSharedPointer service{controller()->createServiceObject(id, this)}; - - if (service.isNull()) { - qCWarning(dcMultiSensor) << "Could not create service for device" << name() << address().toString(); - return; - } - - m_services.insert(id, service); - - connect(service.data(), SIGNAL(error(QLowEnergyService::ServiceError)), this, SLOT(onServiceError(QLowEnergyService::ServiceError))); - connect(service.data(), &QLowEnergyService::stateChanged, this, &SensorTag::onServiceStateChanged); - connect(service.data(), &QLowEnergyService::characteristicChanged, this, &SensorTag::onServiceCharacteristicChanged); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - connect(service.data(), &QLowEnergyService::characteristicRead, this, &SensorTag::onServiceCharacteristicChanged); -#endif - - service->discoverDetails(); - } -} - -void SensorTag::onConnectionStatusChanged() -{ - if (!isConnected()) { - // delete the services, they need to be recreated and - // rediscovered once the device will be reconnected - foreach (QSharedPointer service, m_services) - service->deleteLater(); - - emit valueChanged(connectedStateTypeId, false); - } else { - emit valueChanged(connectedStateTypeId, true); - } -} - -void SensorTag::onServiceStateChanged(const QLowEnergyService::ServiceState &state) -{ - QPointer service = qobject_cast(sender()); - - switch (state) { - case QLowEnergyService::DiscoveringServices: - qCDebug(dcMultiSensor) << "Start discovering service" << service->serviceUuid(); - break; - case QLowEnergyService::ServiceDiscovered: - if (m_services.contains(service->serviceUuid())) { - qCDebug(dcMultiSensor) << "... service discovered."; - - auto dataId = service->serviceUuid(); - dataId.data1 += 1; - auto sensorCharacteristic = service->characteristic(dataId); - - if (!sensorCharacteristic.isValid()) { - qCWarning(dcMultiSensor) << "Characteristic not found for device " << name() << address().toString(); - break; - } - - const auto notificationDescriptor = sensorCharacteristic.descriptor( - QBluetoothUuid::ClientCharacteristicConfiguration); - - if (notificationDescriptor.isValid()) { - service->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); - qCDebug(dcMultiSensor) << "Measuring"; - } - - if (service->serviceUuid().data1 == 0xffe0) - break; - - auto configId = service->serviceUuid(); - configId.data1 += 2; - auto sensorConfig = service->characteristic(configId); - - if (!sensorConfig.isValid()) { - qCWarning(dcMultiSensor) << "Characteristic not found for device " << name() << address().toString(); - break; - } - - if (service->serviceUuid().data1 == 0xf000aa50) { - service->writeCharacteristic(sensorConfig, QByteArray::fromHex("07")); - } else { - service->writeCharacteristic(sensorConfig, QByteArray::fromHex("01")); - } - - if (service->serviceUuid().data1 == 0xf000aa40) { - service->writeCharacteristic(sensorConfig, QByteArray::fromHex("02")); - auto calibId = service->serviceUuid(); - calibId.data1 += 3; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - service->readCharacteristic(service->characteristic(calibId)); -#endif - } - - // TODO: initialize the states with the current value - - } - break; - default: - break; - } -} - -inline quint16 buildUINT16(quint8 loByte, quint8 hiByte) { - return ((quint16)(((loByte) & 0x00FF) + (((hiByte) & 0x00FF) << 8))); -} - -void SensorTag::onServiceCharacteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &value) -{ - qCDebug(dcMultiSensor) << "Service characteristic changed" << characteristic.uuid().toString() << value.toHex(); - - auto id = characteristic.uuid(); - id.data1 -= 1; - switch (characteristic.uuid().data1) { - case 0xf000aa01: { - const quint16 *data = reinterpret_cast(value.constData()); - qint16 rawTamb = data[1]; - m_temperatureValues.append((double)rawTamb / 128); - if (m_temperatureValues.count() % 60 == 0) { - emit valueChanged(temperatureStateTypeId, calculateMeanValue(m_temperatureValues)); - m_temperatureValues.clear(); - } - - qint16 Vobj2 = (double)data[0]; - Vobj2 *= 0.00000015625; - double Tdie2 = ((double)rawTamb / 128) + 273.15; - const double S0 = 6.4E-14; // Calibration factor - const double a1 = 1.75E-3; - const double a2 = -1.678E-5; - const double b0 = -2.94E-5; - const double b1 = -5.7E-7; - const double b2 = 4.63E-9; - const double c2 = 13.4; - const double Tref = 298.15; - double S = S0*(1+a1*(Tdie2 - Tref)+a2*qPow((Tdie2 - Tref),2)); - double Vos = b0 + b1*(Tdie2 - Tref) + b2*qPow((Tdie2 - Tref),2); - double fObj = (Vobj2 - Vos) + c2*qPow((Vobj2 - Vos),2); - double tObj = qPow(qPow(Tdie2,4) + (fObj/S),.25); - m_irTemperatureValues.append(tObj - 273.15); - if (m_irTemperatureValues.count() % 60 == 0) { - emit valueChanged(IRtemperatureStateTypeId, calculateMeanValue(m_irTemperatureValues)); - m_irTemperatureValues.clear(); - } - - break; - } - case 0xf000aa11: { - // TODO: evaluate movement - - // const qint8 *data = reinterpret_cast(value.constData()); - // emit valueChanged(accelerationXStateTypeId, (double)data[0] / 64); - // emit valueChanged(accelerationYStateTypeId, (double)data[1] / 64); - // emit valueChanged(accelerationZStateTypeId, (double)data[2] / 64); - break; - } - case 0xf000aa21: { - const quint16 *data = reinterpret_cast(value.constData()); - quint16 rawH = data[1]; - rawH &= ~0x0003; - m_humidityValues.append(-6.0 + 125.0/65536 * (double)rawH); - if (m_humidityValues.count() % 60 == 0) { - emit valueChanged(humidityStateTypeId, calculateMeanValue(m_humidityValues)); - m_humidityValues.clear(); - } - break; - } - case 0xf000aa31: { - // TODO: evaluate movement - // const qint16 *data = reinterpret_cast(value.constData()); - // emit valueChanged(magneticFieldXStateTypeId, (double)data[0] / 32.768); - // emit valueChanged(magneticFieldYStateTypeId, (double)data[1] / 32.768); - // emit valueChanged(magneticFieldZStateTypeId, (double)data[2] / 32.768); - break; - } - case 0xf000aa41: { - if (m_c.empty()) - break; - const quint16 *data = reinterpret_cast(value.constData()); - quint16 Pr = data[1]; - qint16 Tr = data[0]; - // Sensitivity - qint64 s = (qint64)m_c[2]; - qint64 val = (qint64)m_c[3] * Tr; - s += (val >> 17); - val = (qint64)m_c2[0] * Tr * Tr; - s += (val >> 34); - // Offset - qint64 o = (qint64)m_c2[1] << 14; - val = (qint64)m_c2[2] * Tr; - o += (val >> 3); - val = (qint64)m_c2[3] * Tr * Tr; - o += (val >> 19); - // Pressure (Pa) - qint64 pres = ((qint64)(s * Pr) + o) >> 14; - m_pressureValues.append((double)pres/100); - if (m_pressureValues.count() % 60 == 0) { - emit valueChanged(pressureStateTypeId, calculateMeanValue(m_pressureValues)); - m_pressureValues.clear(); - } - - break; - } - case 0xf000aa43: { - const quint8 *data = reinterpret_cast(value.constData()); - m_c.resize(4); - m_c2.resize(4); - m_c[0] = buildUINT16(data[0],data[1]); - m_c[1] = buildUINT16(data[2],data[3]); - m_c[2] = buildUINT16(data[4],data[5]); - m_c[3] = buildUINT16(data[6],data[7]); - m_c2[0] = buildUINT16(data[8],data[9]); - m_c2[1] = buildUINT16(data[10],data[11]); - m_c2[2] = buildUINT16(data[12],data[13]); - m_c2[3] = buildUINT16(data[14],data[15]); - break; - } - case 0xf000aa51: { - // TODO: evaluate movement - // const qint16 *data = reinterpret_cast(value.constData()); - // emit valueChanged(rotationXStateTypeId, (double)data[0] / 131.072); - // emit valueChanged(rotationYStateTypeId, (double)data[1] / 131.072); - // emit valueChanged(rotationZStateTypeId, (double)data[2] / 131.072); - break; - } - case 0xffe1: { - const quint8 *data = reinterpret_cast(value.constData()); - if (*data & 1) - emit event(leftKeyEventTypeId); - if (*data & 2) - emit event(rightKeyEventTypeId); - break; - } - default: - break; - } -} - -void SensorTag::onServiceError(const QLowEnergyService::ServiceError &error) -{ - QString errorString; - switch (error) { - case QLowEnergyService::NoError: - errorString = "No error"; - break; - case QLowEnergyService::OperationError: - errorString = "Operation error"; - break; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - case QLowEnergyService::CharacteristicReadError: - errorString = "Characteristic read error"; - break; -#endif - case QLowEnergyService::CharacteristicWriteError: - errorString = "Characteristic write error"; - break; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - case QLowEnergyService::DescriptorReadError: - errorString = "Descriptor read error"; - break; -#endif - case QLowEnergyService::DescriptorWriteError: - errorString = "Descriptor write error"; - break; -#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) - case QLowEnergyService::UnknownError: - errorString = "Unknown error"; - break; -#endif - default: - errorString = "Unknown error"; - break; - } - - - qCWarning(dcMultiSensor) << "Service of " << name() << address().toString() << ":" << errorString; -} - -#endif // BLUETOOTH_LE diff --git a/multisensor/sensortag.h b/multisensor/sensortag.h deleted file mode 100644 index 4c7bb9ec..00000000 --- a/multisensor/sensortag.h +++ /dev/null @@ -1,79 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2015 Simon Stürz * - * Copyright (C) 2016 nicc * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef SENSORTAG_H -#define SENSORTAG_H - -#ifdef BLUETOOTH_LE - -#include -#include -#include -#include - -#include "bluetooth/bluetoothlowenergydevice.h" -#include "extern-plugininfo.h" - -class SensorTag : public BluetoothLowEnergyDevice -{ - Q_OBJECT -public: - explicit SensorTag(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType, QObject *parent = 0); - -signals: - void valueChanged(StateTypeId state, QVariant value); - void event(EventTypeId event); - -private: - QHash> m_services{ - {QBluetoothUuid(QUuid("f000aa00-0451-4000-b000-000000000000")), QSharedPointer()}, - {QBluetoothUuid(QUuid("f000aa10-0451-4000-b000-000000000000")), QSharedPointer()}, - {QBluetoothUuid(QUuid("f000aa20-0451-4000-b000-000000000000")), QSharedPointer()}, - {QBluetoothUuid(QUuid("f000aa30-0451-4000-b000-000000000000")), QSharedPointer()}, - {QBluetoothUuid(QUuid("f000aa40-0451-4000-b000-000000000000")), QSharedPointer()}, - {QBluetoothUuid(QUuid("f000aa50-0451-4000-b000-000000000000")), QSharedPointer()}, - {QBluetoothUuid(QUuid("0000ffe0-0000-1000-8000-00805f9b34fb")), QSharedPointer()} - }; - - QVector m_c; - QVector m_c2; - - QList m_temperatureValues; - QList m_irTemperatureValues; - QList m_humidityValues; - QList m_pressureValues; - - double calculateMeanValue(const QList &list); - -private slots: - void setupServices(); - void onConnectionStatusChanged(); - - // Service - void onServiceStateChanged(const QLowEnergyService::ServiceState &state); - void onServiceCharacteristicChanged(const QLowEnergyCharacteristic &characteristic, const QByteArray &value); - void onServiceError(const QLowEnergyService::ServiceError &error); -}; -#endif // BLUETOOTH_LE - -#endif // SENSORTAG_H diff --git a/multisensor/translations/23bf0d8d-df7d-4bee-80ee-f015c5a7f52e-de_DE.qm b/multisensor/translations/23bf0d8d-df7d-4bee-80ee-f015c5a7f52e-de_DE.qm deleted file mode 100644 index a48bdcb8..00000000 Binary files a/multisensor/translations/23bf0d8d-df7d-4bee-80ee-f015c5a7f52e-de_DE.qm and /dev/null differ diff --git a/multisensor/translations/23bf0d8d-df7d-4bee-80ee-f015c5a7f52e-en_US.qm b/multisensor/translations/23bf0d8d-df7d-4bee-80ee-f015c5a7f52e-en_US.qm deleted file mode 100644 index be651eed..00000000 --- a/multisensor/translations/23bf0d8d-df7d-4bee-80ee-f015c5a7f52e-en_US.qm +++ /dev/null @@ -1 +0,0 @@ -<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/multisensor/translations/de_DE.ts b/multisensor/translations/de_DE.ts deleted file mode 100644 index b167cdbe..00000000 --- a/multisensor/translations/de_DE.ts +++ /dev/null @@ -1,121 +0,0 @@ - - - - - MultiSensor - - - MultiSensor - The name of the plugin MultiSensor (23bf0d8d-df7d-4bee-80ee-f015c5a7f52e) - Multi Sensor - - - - Texas Instruments - The name of the vendor (2edf543e-dc2c-4693-bb0c-e76c0d305fad) - Texas Instruments - - - - Sensor Tag - The name of the DeviceClass (158a06b6-b27f-4951-957e-6f1e3b44f604) - - - - - name - The name of the paramType (bdb9d684-2f98-45f5-889c-f184c1e73dc7) of Sensor Tag - Name - - - - mac address - The name of the paramType (d51ed68e-c84a-4136-a5b5-be2f95fd5a0f) of Sensor Tag - Mac Adresse - - - - connected changed - The name of the autocreated EventType (a9629b11-0f34-47f0-a0f0-f758a6aec2b4) - - - - - connected - The name of the ParamType of StateType (a9629b11-0f34-47f0-a0f0-f758a6aec2b4) of DeviceClass Sensor Tag - - - - - IR temperature changed - The name of the autocreated EventType (c664e9ec-a045-49ba-add1-1642ceba7c4f) - IR Temperatur geändert - - - - IR temperature - The name of the ParamType of StateType (c664e9ec-a045-49ba-add1-1642ceba7c4f) of DeviceClass Sensor Tag - IR Temperatur - - - - humidity changed - The name of the autocreated EventType (e83a50ff-96c9-4b6d-889f-f4238353e794) - Luftfeuchtigkeit geändert - - - - humidity - The name of the ParamType of StateType (e83a50ff-96c9-4b6d-889f-f4238353e794) of DeviceClass Sensor Tag - Luftfeuchtigkeit - - - - temperature changed - The name of the autocreated EventType (8359ada9-df1c-4e60-bb87-9e21d05ee2e2) - Temperatur geändert - - - - temperature - The name of the ParamType of StateType (8359ada9-df1c-4e60-bb87-9e21d05ee2e2) of DeviceClass Sensor Tag - Temperatur - - - - pressure changed - The name of the autocreated EventType (645633ad-77d4-45b2-8be8-d6ca7a12eb7a) - Luftdruck geändert - - - - pressure - The name of the ParamType of StateType (645633ad-77d4-45b2-8be8-d6ca7a12eb7a) of DeviceClass Sensor Tag - Luftdruck - - - - moving changed - The name of the autocreated EventType (4be5ca26-0565-419d-b18b-2a5a385d2a3d) - - - - - moving - The name of the ParamType of StateType (4be5ca26-0565-419d-b18b-2a5a385d2a3d) of DeviceClass Sensor Tag - - - - - left key pressed - The name of the EventType 61478490-bed0-4fed-9d58-f13c35b4f220 of deviceClass Sensor Tag - Linke Taste gedrückt - - - - right key pressed - The name of the EventType b7e927db-af28-4fdc-8eb7-edb02258ff5a of deviceClass Sensor Tag - Rechte Taste gedrückt - - - diff --git a/multisensor/translations/en_US.ts b/multisensor/translations/en_US.ts deleted file mode 100644 index b35d3b60..00000000 --- a/multisensor/translations/en_US.ts +++ /dev/null @@ -1,121 +0,0 @@ - - - - - MultiSensor - - - MultiSensor - The name of the plugin MultiSensor (23bf0d8d-df7d-4bee-80ee-f015c5a7f52e) - - - - - Texas Instruments - The name of the vendor (2edf543e-dc2c-4693-bb0c-e76c0d305fad) - - - - - Sensor Tag - The name of the DeviceClass (158a06b6-b27f-4951-957e-6f1e3b44f604) - - - - - name - The name of the paramType (bdb9d684-2f98-45f5-889c-f184c1e73dc7) of Sensor Tag - - - - - mac address - The name of the paramType (d51ed68e-c84a-4136-a5b5-be2f95fd5a0f) of Sensor Tag - - - - - connected changed - The name of the autocreated EventType (a9629b11-0f34-47f0-a0f0-f758a6aec2b4) - - - - - connected - The name of the ParamType of StateType (a9629b11-0f34-47f0-a0f0-f758a6aec2b4) of DeviceClass Sensor Tag - - - - - IR temperature changed - The name of the autocreated EventType (c664e9ec-a045-49ba-add1-1642ceba7c4f) - - - - - IR temperature - The name of the ParamType of StateType (c664e9ec-a045-49ba-add1-1642ceba7c4f) of DeviceClass Sensor Tag - - - - - humidity changed - The name of the autocreated EventType (e83a50ff-96c9-4b6d-889f-f4238353e794) - - - - - humidity - The name of the ParamType of StateType (e83a50ff-96c9-4b6d-889f-f4238353e794) of DeviceClass Sensor Tag - - - - - temperature changed - The name of the autocreated EventType (8359ada9-df1c-4e60-bb87-9e21d05ee2e2) - - - - - temperature - The name of the ParamType of StateType (8359ada9-df1c-4e60-bb87-9e21d05ee2e2) of DeviceClass Sensor Tag - - - - - pressure changed - The name of the autocreated EventType (645633ad-77d4-45b2-8be8-d6ca7a12eb7a) - - - - - pressure - The name of the ParamType of StateType (645633ad-77d4-45b2-8be8-d6ca7a12eb7a) of DeviceClass Sensor Tag - - - - - moving changed - The name of the autocreated EventType (4be5ca26-0565-419d-b18b-2a5a385d2a3d) - - - - - moving - The name of the ParamType of StateType (4be5ca26-0565-419d-b18b-2a5a385d2a3d) of DeviceClass Sensor Tag - - - - - left key pressed - The name of the EventType 61478490-bed0-4fed-9d58-f13c35b4f220 of deviceClass Sensor Tag - - - - - right key pressed - The name of the EventType b7e927db-af28-4fdc-8eb7-edb02258ff5a of deviceClass Sensor Tag - - - - diff --git a/pushbullet/devicepluginpushbullet.cpp b/pushbullet/devicepluginpushbullet.cpp deleted file mode 100644 index a07b34f1..00000000 --- a/pushbullet/devicepluginpushbullet.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2016 Alexander Lampret * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "devicepluginpushbullet.h" -#include "plugin/device.h" -#include "plugininfo.h" - -DevicePluginPushbullet::DevicePluginPushbullet() { -} - -DeviceManager::HardwareResources DevicePluginPushbullet::requiredHardware() const { - return DeviceManager::HardwareResourceNetworkManager; -} - -DeviceManager::DeviceSetupStatus DevicePluginPushbullet::setupDevice(Device *device) { - Q_UNUSED(device); - return DeviceManager::DeviceSetupStatusSuccess; -} - -void DevicePluginPushbullet::networkManagerReplyReady(QNetworkReply *reply) -{ - if (m_asyncActions.keys().contains(reply)) { - ActionId actionId = m_asyncActions.value(reply); - if (reply->error()) { - qCWarning(dcPushbullet) << "Pushbullet reply error: " << reply->errorString(); - emit actionExecutionFinished(actionId, DeviceManager::DeviceErrorInvalidParameter); - reply->deleteLater(); - return; - } - if (reply->readAll().contains("error")) { - emit actionExecutionFinished(actionId, DeviceManager::DeviceErrorHardwareFailure); - } else { - emit actionExecutionFinished(actionId, DeviceManager::DeviceErrorNoError); - } - } - reply->deleteLater(); -} - -DeviceManager::DeviceError DevicePluginPushbullet::executeAction(Device *device, const Action &action) { - if (device->deviceClassId() == pushNotificationDeviceClassId) { - if (action.actionTypeId() == notifyActionTypeId) { - QNetworkReply* reply = sendNotification(device, action.params()); - m_asyncActions.insert(reply, action.id()); - return DeviceManager::DeviceErrorAsync; - } - return DeviceManager::DeviceErrorActionTypeNotFound; - } - return DeviceManager::DeviceErrorDeviceClassNotFound; -} - -QNetworkReply* DevicePluginPushbullet::sendNotification(Device* device, ParamList params) { - QUrlQuery urlParams; - urlParams.addQueryItem("body", params.paramValue(bodyParamTypeId).toByteArray()); - urlParams.addQueryItem("title", params.paramValue(titleParamTypeId).toByteArray()); - urlParams.addQueryItem("type", "note"); - - QNetworkRequest request(QUrl("https://api.pushbullet.com/v2/pushes")); - request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - request.setRawHeader(QByteArray("Access-Token"), device->paramValue(tokenParamTypeId).toByteArray()); - return networkManagerPost(request, urlParams.toString(QUrl::FullyEncoded).toUtf8()); -} diff --git a/pushbullet/devicepluginpushbullet.h b/pushbullet/devicepluginpushbullet.h deleted file mode 100644 index c07a79a9..00000000 --- a/pushbullet/devicepluginpushbullet.h +++ /dev/null @@ -1,53 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2016 Alexander Lampret * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef DEVICEPLUGINPUSHBULLET_H -#define DEVICEPLUGINPUSHBULLET_H - -#include "plugin/deviceplugin.h" -#include "devicemanager.h" - -#include -#include -#include -#include - -class DevicePluginPushbullet: public DevicePlugin { - Q_OBJECT - Q_PLUGIN_METADATA(IID "guru.guh.DevicePlugin" FILE "devicepluginpushbullet.json") - Q_INTERFACES(DevicePlugin) - -public: - DevicePluginPushbullet(); - DeviceManager::HardwareResources requiredHardware() const override; - DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; - void networkManagerReplyReady(QNetworkReply *reply) override; - -public slots: - DeviceManager::DeviceError executeAction(Device *device, const Action &action) override; - -private: - QHash m_asyncActions; - QNetworkReply* sendNotification(Device* device, ParamList params); -}; - -#endif // DEVICEPLUGINPUSHBULLET_H diff --git a/pushbullet/devicepluginpushbullet.json b/pushbullet/devicepluginpushbullet.json deleted file mode 100644 index a17b7c63..00000000 --- a/pushbullet/devicepluginpushbullet.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "Pushbullet", - "idName": "Pushbullet", - "id": "46986575-0e62-483d-b5a8-76ac356fcce7", - "vendors": [ - { - "name": "Pushbullet", - "idName": "pushbullet", - "id": "b5e1896e-b7fa-4c19-ac2b-10bd489f8302", - "deviceClasses": [ - { - "id": "56029c6d-777b-4889-9e17-29f813d34da4", - "idName": "pushNotification", - "name": "Push Notification", - "createMethods": ["user"], - "basicTags": [ - "Service", - "Notification" - ], - "paramTypes": [ - { - "id": "1f37ce22-50b8-4183-8b74-557fdb2d3076", - "idName": "token", - "name": "access token", - "index": 0, - "type": "QString" - } - ], - "actionTypes": [ - { - "id": "1378480f-6583-44e2-8fdd-22afe979a9a3", - "idName": "notify", - "name": "notify", - "index": 0, - "paramTypes": [ - { - "id": "ceed6e66-0dcb-4405-832d-e9091f882acc", - "idName": "title", - "name": "title", - "type": "QString", - "index": 0, - "inputType": "TextLine", - "defaultValue": "" - }, - { - "id": "f72cc56c-4d0b-4b96-ab9b-ff3ca92b00e2", - "idName": "body", - "name": "body", - "type": "QString", - "index": 1, - "inputType": "TextArea", - "defaultValue": "" - } - ] - } - ] - } - ] - } - ] -} diff --git a/pushbullet/pushbullet.pro b/pushbullet/pushbullet.pro deleted file mode 100644 index 2c1de34b..00000000 --- a/pushbullet/pushbullet.pro +++ /dev/null @@ -1,15 +0,0 @@ -TRANSLATIONS = translations/en_US.ts \ - translations/de_DE.ts - -# Note: include after the TRANSLATIONS definition -include(../plugins.pri) - -TARGET = $$qtLibraryTarget(guh_devicepluginpushbullet) - -QT += network - -SOURCES += \ - devicepluginpushbullet.cpp - -HEADERS += \ - devicepluginpushbullet.h diff --git a/pushbullet/translations/46986575-0e62-483d-b5a8-76ac356fcce7-de_DE.qm b/pushbullet/translations/46986575-0e62-483d-b5a8-76ac356fcce7-de_DE.qm deleted file mode 100644 index 0ac4c7c1..00000000 Binary files a/pushbullet/translations/46986575-0e62-483d-b5a8-76ac356fcce7-de_DE.qm and /dev/null differ diff --git a/pushbullet/translations/46986575-0e62-483d-b5a8-76ac356fcce7-en_US.qm b/pushbullet/translations/46986575-0e62-483d-b5a8-76ac356fcce7-en_US.qm deleted file mode 100644 index be651eed..00000000 --- a/pushbullet/translations/46986575-0e62-483d-b5a8-76ac356fcce7-en_US.qm +++ /dev/null @@ -1 +0,0 @@ -<¸dÊÍ!¿`¡½Ý \ No newline at end of file diff --git a/pushbullet/translations/de_DE.ts b/pushbullet/translations/de_DE.ts deleted file mode 100644 index ac250c10..00000000 --- a/pushbullet/translations/de_DE.ts +++ /dev/null @@ -1,46 +0,0 @@ - - - - - Pushbullet - - - - Pushbullet - The name of the plugin Pushbullet (46986575-0e62-483d-b5a8-76ac356fcce7) ----------- -The name of the vendor (b5e1896e-b7fa-4c19-ac2b-10bd489f8302) - Pushbullet - - - - Push Notification - The name of the DeviceClass (56029c6d-777b-4889-9e17-29f813d34da4) - Push Benachrichtigung - - - - access token - The name of the paramType (1f37ce22-50b8-4183-8b74-557fdb2d3076) of Push Notification - Zugangstoken - - - - notify - The name of the ActionType 1378480f-6583-44e2-8fdd-22afe979a9a3 of deviceClass Push Notification - Benachrichtigen - - - - title - The name of the paramType (ceed6e66-0dcb-4405-832d-e9091f882acc) of Push Notification - Titel - - - - body - The name of the paramType (f72cc56c-4d0b-4b96-ab9b-ff3ca92b00e2) of Push Notification - Nachricht - - - diff --git a/pushbullet/translations/en_US.ts b/pushbullet/translations/en_US.ts deleted file mode 100644 index 83733f2a..00000000 --- a/pushbullet/translations/en_US.ts +++ /dev/null @@ -1,46 +0,0 @@ - - - - - Pushbullet - - - - Pushbullet - The name of the plugin Pushbullet (46986575-0e62-483d-b5a8-76ac356fcce7) ----------- -The name of the vendor (b5e1896e-b7fa-4c19-ac2b-10bd489f8302) - - - - - Push Notification - The name of the DeviceClass (56029c6d-777b-4889-9e17-29f813d34da4) - - - - - access token - The name of the paramType (1f37ce22-50b8-4183-8b74-557fdb2d3076) of Push Notification - - - - - notify - The name of the ActionType 1378480f-6583-44e2-8fdd-22afe979a9a3 of deviceClass Push Notification - - - - - title - The name of the paramType (ceed6e66-0dcb-4405-832d-e9091f882acc) of Push Notification - - - - - body - The name of the paramType (f72cc56c-4d0b-4b96-ab9b-ff3ca92b00e2) of Push Notification - - - - diff --git a/usbwde/devicepluginusbwde.cpp b/usbwde/devicepluginusbwde.cpp deleted file mode 100644 index 4539f04c..00000000 --- a/usbwde/devicepluginusbwde.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2016 Alexander Lampret * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include "devicepluginusbwde.h" - -#include "plugin/device.h" -#include "devicemanager.h" -#include "plugininfo.h" - -DevicePluginUsbWde::DevicePluginUsbWde() : - m_bridgeDevice(0) -{ -} - -DeviceManager::HardwareResources DevicePluginUsbWde::requiredHardware() const -{ - return DeviceManager::HardwareResourceTimer; -} - -DeviceManager::DeviceSetupStatus DevicePluginUsbWde::setupDevice(Device *device) -{ - if (device->deviceClassId() == wdeBridgeDeviceClassId) { - if (m_bridgeDevice != 0) { - qCWarning(dcUsbWde) << "Only one USB WDE device can be configured."; - return DeviceManager::DeviceSetupStatusFailure; - } - m_serialPort = new QSerialPort(this); - m_serialPort->setPortName(device->paramValue(interfaceParamTypeId).toString()); - m_serialPort->setBaudRate(device->paramValue(baudrateParamTypeId).toInt()); - if (!m_serialPort->open(QIODevice::ReadOnly)) { - qCWarning(dcUsbWde) << device->name() << "can't bind to interface" << device->paramValue(interfaceParamTypeId); - return DeviceManager::DeviceSetupStatusFailure; - } - m_bridgeDevice = device; - connect(m_serialPort, SIGNAL(readyRead()), SLOT(handleReadyRead())); - connect(m_serialPort, SIGNAL(error(QSerialPort::SerialPortError)), SLOT(handleError(QSerialPort::SerialPortError))); - } else { - m_deviceList.insert(device->paramValue(channelParamTypeId).toInt(), device); - } - return DeviceManager::DeviceSetupStatusSuccess; -} - -void DevicePluginUsbWde::deviceRemoved(Device *device) -{ - if (device->deviceClassId() == wdeBridgeDeviceClassId) { - m_serialPort->close(); - m_bridgeDevice = 0; - } else { - m_deviceList.remove(device->paramValue(channelParamTypeId).toInt()); - } -} - -void DevicePluginUsbWde::handleReadyRead() -{ - m_readData.append(m_serialPort->readAll()); -} - -void DevicePluginUsbWde::handleError(QSerialPort::SerialPortError serialPortError) -{ - if (serialPortError == QSerialPort::ReadError) { - qCWarning(dcUsbWde) << "An I/O error occurred while reading the data from port " << m_serialPort->portName() << ", error: " << m_serialPort->errorString(); - } -} - -void DevicePluginUsbWde::guhTimer() -{ - if (!m_readData.isEmpty()) { - // Handle data - QList parts = m_readData.split(';'); - QLocale german(QLocale::German); - // Check if received string is valid (should start with $1 and ends with 0) - if (parts.size() != 25 || !parts.at(0).contains("$1") || !parts.at(24).contains("0")) { - m_readData.clear(); - return; - } - // Loop through 8 possible sensor channels - for (int i = 1; i < 9; i++) { - if (!parts.at(2 + i).isEmpty()) { - // Create new device if it does not exist - if (!m_deviceList.contains(i)) { - createNewSensor(i); - } else { - Device* device = m_deviceList.value(i); - device->setStateValue(temperatureStateTypeId, german.toDouble(parts.at(2+i))); - device->setStateValue(humidityStateTypeId, parts.at(2+i+8).toInt()); - device->setStateValue(lastUpdateStateTypeId, QDateTime::currentDateTime().toTime_t()); - } - } - } - // Check if wind data is available - if (!parts.at(19).isEmpty()) { - // Create new device if it does not exist - if (!m_deviceList.contains(9)) { - createNewSensor(9); - } else { - Device* device = m_deviceList.value(9); - device->setStateValue(temperatureStateTypeId, german.toDouble(parts.at(19))); - device->setStateValue(humidityStateTypeId, parts.at(20).toInt()); - device->setStateValue(windStrengthStateTypeId, german.toDouble(parts.at(21))); - device->setStateValue(rainStrengthStateTypeId, german.toDouble(parts.at(22))); - device->setStateValue(isRainStateTypeId, (parts.at(23) == "1")); - device->setStateValue(lastUpdateStateTypeId, QDateTime::currentDateTime().toTime_t()); - } - } - m_readData.clear(); - } -} - -void DevicePluginUsbWde::createNewSensor(int channel) -{ - DeviceClassId createClassId; - QString deviceName; - QList deviceDescriptors; - createClassId = temperatureSensorDeviceClassId; - deviceName = "Sensor channel " + QString::number(channel); - if (channel == 9) { - createClassId = windRainSensorDeviceClassId; - deviceName = "Weather station"; - } - DeviceDescriptor descriptor(createClassId, deviceName, deviceName); - ParamList params; - params.append(Param(nameParamTypeId, "Sensor " + QString::number(channel))); - params.append(Param(channelParamTypeId, channel)); - descriptor.setParams(params); - deviceDescriptors.append(descriptor); - emit autoDevicesAppeared(createClassId, deviceDescriptors); -} diff --git a/usbwde/devicepluginusbwde.h b/usbwde/devicepluginusbwde.h deleted file mode 100644 index 335a2da2..00000000 --- a/usbwde/devicepluginusbwde.h +++ /dev/null @@ -1,57 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * * - * Copyright (C) 2016 Alexander Lampret * - * * - * This file is part of guh. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library 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 * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; If not, see * - * . * - * * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef DEVICEPLUGINUSBWDE_H -#define DEVICEPLUGINUSBWDE_H - -#include "plugin/deviceplugin.h" -#include "devicemanager.h" - -#include - -class DevicePluginUsbWde : public DevicePlugin -{ - Q_OBJECT - - Q_PLUGIN_METADATA(IID "guru.guh.DevicePlugin" FILE "devicepluginusbwde.json") - Q_INTERFACES(DevicePlugin) - -public: - DevicePluginUsbWde(); - DeviceManager::HardwareResources requiredHardware() const override; - DeviceManager::DeviceSetupStatus setupDevice(Device *device) override; - void deviceRemoved(Device *device) override; - void guhTimer() override; - -private: - Device* m_bridgeDevice; - QSerialPort *m_serialPort; - QByteArray m_readData; - QHash m_deviceList; - void createNewSensor(int channel); - -private slots: - void handleReadyRead(); - void handleError(QSerialPort::SerialPortError error); -}; - -#endif // DEVICEPLUGINUSBWDE_H diff --git a/usbwde/devicepluginusbwde.json b/usbwde/devicepluginusbwde.json deleted file mode 100644 index d0cb86ba..00000000 --- a/usbwde/devicepluginusbwde.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "name": "USB WDE", - "idName": "UsbWde", - "id": "b01bc368-d674-41ef-a368-6b6a76c96365", - "vendors": [ - { - "name": "ELV", - "idName": "ELV", - "id": "55500c7c-9b09-4462-8d71-e5b4b42f6940", - "deviceClasses": [ - { - "id": "20e1b650-41d1-41b7-891f-1e68130d1403", - "idName": "wdeBridge", - "name": "USB WDE", - "interfaces": ["gateway"], - "basicTags": [ - "Gateway" - ], - "createMethods": ["user"], - "paramTypes": [ - { - "id": "be6b6bd5-9495-45f0-93d7-80f74f633420", - "idName": "name", - "name": "name", - "type": "QString", - "inputType": "TextLine", - "index": 0 - }, - { - "id": "965fd538-8e8a-4a84-97d0-5f8fc9ea115e", - "idName": "interface", - "name": "interface", - "type": "QString", - "inputType": "TextLine", - "defaultValue": "/dev/ttyUSB0", - "index": 1 - }, - { - "id": "b8239c85-8f09-40d5-9ab9-03b3bd0c8fcc", - "idName": "baudrate", - "name": "baudrate", - "type": "int", - "inputType": "TextLine", - "defaultValue": "9600", - "index": 2 - } - ] - }, - { - "id": "e3d839f5-f2a7-48fa-8675-389645413954", - "idName": "temperatureSensor", - "name": "Temperature sensor", - "basicTags": [ - "Device", - "Sensor" - ], - "createMethods": ["auto"], - "paramTypes": [ - { - "id": "bc2baa99-85fe-4f69-b46f-6b32b33db084", - "idName": "name", - "name": "name", - "type": "QString", - "inputType": "TextLine", - "index": 0 - }, - { - "id": "fc611e60-d975-4d1f-9977-19d2b90c3838", - "idName": "channel", - "name": "channel", - "type": "int", - "readonly": true, - "inputType": "None", - "index": 1 - } - ], - "stateTypes": [ - { - "id": "046e5ffe-7d75-4a8a-ac0a-9310814a800e", - "idName": "lastUpdate", - "name" :"last update", - "type": "unsignedInt", - "unit": "UnixTime", - "defaultValue": 0, - "index": 0, - "eventTypeName": "last update changed" - }, - { - "id": "0023a9c1-0d84-499d-88c4-c06b6d793e27", - "idName": "temperature", - "name": "temperature", - "type": "double", - "unit": "DegreeCelsius", - "defaultValue": 0, - "index": 1, - "eventTypeName": "temperature changed" - }, - { - "id": "452400e8-89ac-4419-94a8-d6eeb97f694d", - "idName": "humidity", - "name": "humidity", - "type": "int", - "unit": "Percentage", - "defaultValue": 0, - "index": 2, - "eventTypeName": "humidity changed" - } - ] - }, - { - "id": "2ea29c16-44ad-4cf2-b08d-18c7c6826386", - "idName": "windRainSensor", - "name": "Wind/Rain sensor", - "basicTags": [ - "Device", - "Sensor" - ], - "createMethods": ["auto"], - "paramTypes": [ - { - "id": "bc2baa99-85fe-4f69-b46f-6b32b33db084", - "idName": "name", - "name": "name", - "type": "QString", - "inputType": "TextLine", - "index": 0 - }, - { - "id": "fc611e60-d975-4d1f-9977-19d2b90c3838", - "idName": "channel", - "name": "channel", - "type": "int", - "readonly": true, - "inputType": "None", - "index": 1 - } - ], - "stateTypes": [ - { - "id": "046e5ffe-7d75-4a8a-ac0a-9310814a800e", - "idName": "lastUpdate", - "name" :"last update", - "type": "unsignedInt", - "unit": "UnixTime", - "defaultValue": 0, - "index": 0, - "eventTypeName": "last update changed" - }, - { - "id": "0023a9c1-0d84-499d-88c4-c06b6d793e27", - "idName": "temperature", - "name": "temperature", - "type": "double", - "unit": "DegreeCelsius", - "defaultValue": 0, - "index": 1, - "eventTypeName": "temperature changed" - }, - { - "id": "452400e8-89ac-4419-94a8-d6eeb97f694d", - "idName": "humidity", - "name": "humidity", - "type": "int", - "unit": "Percentage", - "defaultValue": 0, - "index": 2, - "eventTypeName": "humidity changed" - }, - { - "id": "8e058c13-b5bf-4558-b24e-e3197ba7a9de", - "idName": "windStrength", - "name": "wind strength", - "type": "double", - "unit": "KiloMeterPerHour", - "defaultValue": 0, - "index": 3, - "eventTypeName": "wind strength changed" - }, - { - "id": "a6116ea9-1db9-4071-9daf-ae79aab62375", - "idName": "rainStrength", - "name": "rain strength", - "type": "double", - "defaultValue": 0, - "index": 4, - "eventTypeName": "rain strength changed" - }, - { - "id": "a9660178-926b-4f86-9593-67678b337039", - "idName": "isRain", - "name": "is raining", - "type": "bool", - "defaultValue": false, - "index": 5, - "eventTypeName": "is raining changed" - } - ] - } - ] - } - ] -} diff --git a/usbwde/translations/b01bc368-d674-41ef-a368-6b6a76c96365-de_DE.qm b/usbwde/translations/b01bc368-d674-41ef-a368-6b6a76c96365-de_DE.qm deleted file mode 100644 index 81462cfd..00000000 Binary files a/usbwde/translations/b01bc368-d674-41ef-a368-6b6a76c96365-de_DE.qm and /dev/null differ diff --git a/usbwde/translations/b01bc368-d674-41ef-a368-6b6a76c96365-en_US.qm b/usbwde/translations/b01bc368-d674-41ef-a368-6b6a76c96365-en_US.qm deleted file mode 100644 index 0406a304..00000000 Binary files a/usbwde/translations/b01bc368-d674-41ef-a368-6b6a76c96365-en_US.qm and /dev/null differ diff --git a/usbwde/translations/de_DE.ts b/usbwde/translations/de_DE.ts deleted file mode 100644 index 26f6333c..00000000 --- a/usbwde/translations/de_DE.ts +++ /dev/null @@ -1,130 +0,0 @@ - - - - - UsbWde - - - ELV - The name of the vendor (55500c7c-9b09-4462-8d71-e5b4b42f6940) - ELV - - - - - USB WDE - The name of the plugin USB WDE (b01bc368-d674-41ef-a368-6b6a76c96365) ----------- -The name of the DeviceClass (20e1b650-41d1-41b7-891f-1e68130d1403) - USB WDE - - - - name - The name of the paramType (be6b6bd5-9495-45f0-93d7-80f74f633420) of USB WDE - Name - - - - interface - The name of the paramType (965fd538-8e8a-4a84-97d0-5f8fc9ea115e) of USB WDE - Name - - - - baudrate - The name of the paramType (b8239c85-8f09-40d5-9ab9-03b3bd0c8fcc) of USB WDE - Baudrate - - - - Temperature sensor - The name of the DeviceClass (e3d839f5-f2a7-48fa-8675-389645413954) - Temperatursensor - - - - channel - The name of the paramType (fc611e60-d975-4d1f-9977-19d2b90c3838) of Temperature sensor - Kanal - - - - last update changed - The name of the autocreated EventType (046e5ffe-7d75-4a8a-ac0a-9310814a800e) - - - - - last update - The name of the ParamType of StateType (046e5ffe-7d75-4a8a-ac0a-9310814a800e) of DeviceClass Temperature sensor - - - - - temperature changed - The name of the autocreated EventType (0023a9c1-0d84-499d-88c4-c06b6d793e27) - - - - - temperature - The name of the ParamType of StateType (0023a9c1-0d84-499d-88c4-c06b6d793e27) of DeviceClass Temperature sensor - - - - - humidity changed - The name of the autocreated EventType (452400e8-89ac-4419-94a8-d6eeb97f694d) - - - - - humidity - The name of the ParamType of StateType (452400e8-89ac-4419-94a8-d6eeb97f694d) of DeviceClass Temperature sensor - - - - - Wind/Rain sensor - The name of the DeviceClass (2ea29c16-44ad-4cf2-b08d-18c7c6826386) - Wind-/Regensensor - - - - wind strength changed - The name of the autocreated EventType (8e058c13-b5bf-4558-b24e-e3197ba7a9de) - - - - - wind strength - The name of the ParamType of StateType (8e058c13-b5bf-4558-b24e-e3197ba7a9de) of DeviceClass Wind/Rain sensor - - - - - rain strength changed - The name of the autocreated EventType (a6116ea9-1db9-4071-9daf-ae79aab62375) - - - - - rain strength - The name of the ParamType of StateType (a6116ea9-1db9-4071-9daf-ae79aab62375) of DeviceClass Wind/Rain sensor - - - - - is raining changed - The name of the autocreated EventType (a9660178-926b-4f86-9593-67678b337039) - - - - - is raining - The name of the ParamType of StateType (a9660178-926b-4f86-9593-67678b337039) of DeviceClass Wind/Rain sensor - - - - diff --git a/usbwde/translations/en_US.ts b/usbwde/translations/en_US.ts deleted file mode 100644 index 6cd7dce7..00000000 --- a/usbwde/translations/en_US.ts +++ /dev/null @@ -1,130 +0,0 @@ - - - - - UsbWde - - - ELV - The name of the vendor (55500c7c-9b09-4462-8d71-e5b4b42f6940) - ELV - - - - - USB WDE - The name of the plugin USB WDE (b01bc368-d674-41ef-a368-6b6a76c96365) ----------- -The name of the DeviceClass (20e1b650-41d1-41b7-891f-1e68130d1403) - USB WDE - - - - name - The name of the paramType (be6b6bd5-9495-45f0-93d7-80f74f633420) of USB WDE - Name - - - - interface - The name of the paramType (965fd538-8e8a-4a84-97d0-5f8fc9ea115e) of USB WDE - Interface - - - - baudrate - The name of the paramType (b8239c85-8f09-40d5-9ab9-03b3bd0c8fcc) of USB WDE - Baudrate - - - - Temperature sensor - The name of the DeviceClass (e3d839f5-f2a7-48fa-8675-389645413954) - Temperature sensor - - - - channel - The name of the paramType (fc611e60-d975-4d1f-9977-19d2b90c3838) of Temperature sensor - Channel - - - - last update changed - The name of the autocreated EventType (046e5ffe-7d75-4a8a-ac0a-9310814a800e) - - - - - last update - The name of the ParamType of StateType (046e5ffe-7d75-4a8a-ac0a-9310814a800e) of DeviceClass Temperature sensor - - - - - temperature changed - The name of the autocreated EventType (0023a9c1-0d84-499d-88c4-c06b6d793e27) - - - - - temperature - The name of the ParamType of StateType (0023a9c1-0d84-499d-88c4-c06b6d793e27) of DeviceClass Temperature sensor - - - - - humidity changed - The name of the autocreated EventType (452400e8-89ac-4419-94a8-d6eeb97f694d) - - - - - humidity - The name of the ParamType of StateType (452400e8-89ac-4419-94a8-d6eeb97f694d) of DeviceClass Temperature sensor - - - - - Wind/Rain sensor - The name of the DeviceClass (2ea29c16-44ad-4cf2-b08d-18c7c6826386) - Wind/Rain sensor - - - - wind strength changed - The name of the autocreated EventType (8e058c13-b5bf-4558-b24e-e3197ba7a9de) - - - - - wind strength - The name of the ParamType of StateType (8e058c13-b5bf-4558-b24e-e3197ba7a9de) of DeviceClass Wind/Rain sensor - - - - - rain strength changed - The name of the autocreated EventType (a6116ea9-1db9-4071-9daf-ae79aab62375) - - - - - rain strength - The name of the ParamType of StateType (a6116ea9-1db9-4071-9daf-ae79aab62375) of DeviceClass Wind/Rain sensor - - - - - is raining changed - The name of the autocreated EventType (a9660178-926b-4f86-9593-67678b337039) - - - - - is raining - The name of the ParamType of StateType (a9660178-926b-4f86-9593-67678b337039) of DeviceClass Wind/Rain sensor - - - - diff --git a/usbwde/usbwde.pro b/usbwde/usbwde.pro deleted file mode 100644 index 0332c98a..00000000 --- a/usbwde/usbwde.pro +++ /dev/null @@ -1,16 +0,0 @@ -TRANSLATIONS = translations/en_US.ts \ - translations/de_DE.ts - -include(../plugins.pri) - -QT += serialport - -TARGET = $$qtLibraryTarget(guh_devicepluginusbwde) - -SOURCES += \ - devicepluginusbwde.cpp - -HEADERS += \ - devicepluginusbwde.h - -