Add hardwaremanager dbus object
This commit is contained in:
parent
691473bcb1
commit
daf8d0f638
@ -91,15 +91,14 @@ void BluetoothLowEnergyDevice::onServiceDiscoveryFinished()
|
|||||||
{
|
{
|
||||||
qCDebug(dcBluetooth()) << "Service discovery finished for" << name() << address().toString();
|
qCDebug(dcBluetooth()) << "Service discovery finished for" << name() << address().toString();
|
||||||
foreach (const QBluetoothUuid &serviceUuid, m_controller->services()) {
|
foreach (const QBluetoothUuid &serviceUuid, m_controller->services()) {
|
||||||
QLowEnergyService *service = m_controller->createServiceObject(serviceUuid, this);
|
|
||||||
qCDebug(dcBluetooth()) << "--> Service" << serviceUuid.toString();
|
qCDebug(dcBluetooth()) << "--> Service" << serviceUuid.toString();
|
||||||
m_services.append(service);
|
|
||||||
}
|
}
|
||||||
emit servicesDiscoveryFinished();
|
emit servicesDiscoveryFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothLowEnergyDevice::onStateChanged(const QLowEnergyController::ControllerState &state)
|
void BluetoothLowEnergyDevice::onStateChanged(const QLowEnergyController::ControllerState &state)
|
||||||
{
|
{
|
||||||
|
qCDebug(dcBluetooth()) << "State changed for" << name() << address().toString() << state;
|
||||||
emit stateChanged(state);
|
emit stateChanged(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,11 +138,6 @@ bool BluetoothLowEnergyDevice::discovered() const
|
|||||||
return m_discovered;
|
return m_discovered;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QLowEnergyService *> BluetoothLowEnergyDevice::services() const
|
|
||||||
{
|
|
||||||
return m_services;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QBluetoothUuid> BluetoothLowEnergyDevice::serviceUuids() const
|
QList<QBluetoothUuid> BluetoothLowEnergyDevice::serviceUuids() const
|
||||||
{
|
{
|
||||||
return m_controller->services();
|
return m_controller->services();
|
||||||
|
|||||||
@ -50,20 +50,17 @@ public:
|
|||||||
bool connected() const;
|
bool connected() const;
|
||||||
bool discovered() const;
|
bool discovered() const;
|
||||||
|
|
||||||
QList<QLowEnergyService *> services() const;
|
|
||||||
QList<QBluetoothUuid> serviceUuids() const;
|
QList<QBluetoothUuid> serviceUuids() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
QLowEnergyController *controller() const;
|
QLowEnergyController *controller() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit BluetoothLowEnergyDevice(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType = QLowEnergyController::PublicAddress, QObject *parent = 0);
|
explicit BluetoothLowEnergyDevice(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType = QLowEnergyController::PublicAddress, QObject *parent = 0);
|
||||||
QBluetoothDeviceInfo m_deviceInfo;
|
QBluetoothDeviceInfo m_deviceInfo;
|
||||||
QLowEnergyController *m_controller = nullptr;
|
QLowEnergyController *m_controller = nullptr;
|
||||||
QList<QLowEnergyService *> m_services;
|
|
||||||
|
|
||||||
|
// Default enabled and auto connecting
|
||||||
bool m_connected = false;
|
bool m_connected = false;
|
||||||
bool m_autoConnecting = false;
|
bool m_autoConnecting = true;
|
||||||
bool m_discovered = false;
|
bool m_discovered = false;
|
||||||
bool m_enabled = true;
|
bool m_enabled = true;
|
||||||
|
|
||||||
|
|||||||
@ -59,14 +59,14 @@ BluetoothDiscoveryReply *BluetoothLowEnergyManager::discoverDevices(const int &i
|
|||||||
|
|
||||||
// Prevent blocking the hardware resource from plugins
|
// Prevent blocking the hardware resource from plugins
|
||||||
int finalInterval = interval;
|
int finalInterval = interval;
|
||||||
if (finalInterval > 30) {
|
if (finalInterval > 30000) {
|
||||||
qCWarning(dcBluetooth()) << "Discovery interval out of range. Reset to 30 seconds.";
|
qCWarning(dcBluetooth()) << "Discovery interval out of range. Reset to 30 seconds.";
|
||||||
finalInterval = 30;
|
finalInterval = 30000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalInterval <= 0) {
|
if (finalInterval <= 0) {
|
||||||
qCWarning(dcBluetooth()) << "Discovery interval out of range. Reset to 5 seconds.";
|
qCWarning(dcBluetooth()) << "Discovery interval out of range. Reset to 5 seconds.";
|
||||||
finalInterval = 5;
|
finalInterval = 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_timer->start(finalInterval);
|
m_timer->start(finalInterval);
|
||||||
@ -75,9 +75,10 @@ BluetoothDiscoveryReply *BluetoothLowEnergyManager::discoverDevices(const int &i
|
|||||||
|
|
||||||
BluetoothLowEnergyDevice *BluetoothLowEnergyManager::registerDevice(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType)
|
BluetoothLowEnergyDevice *BluetoothLowEnergyManager::registerDevice(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType)
|
||||||
{
|
{
|
||||||
QPointer<BluetoothLowEnergyDevice> device = new BluetoothLowEnergyDevice(deviceInfo, addressType, this);
|
QPointer<BluetoothLowEnergyDevice> bluetoothDevice = new BluetoothLowEnergyDevice(deviceInfo, addressType, this);
|
||||||
m_devices.append(device);
|
qCDebug(dcBluetooth()) << "Register device" << bluetoothDevice->name() << bluetoothDevice->address().toString();
|
||||||
return device.data();
|
m_devices.append(bluetoothDevice);
|
||||||
|
return bluetoothDevice.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothLowEnergyManager::unregisterDevice(BluetoothLowEnergyDevice *bluetoothDevice)
|
void BluetoothLowEnergyManager::unregisterDevice(BluetoothLowEnergyDevice *bluetoothDevice)
|
||||||
@ -88,6 +89,8 @@ void BluetoothLowEnergyManager::unregisterDevice(BluetoothLowEnergyDevice *bluet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCDebug(dcBluetooth()) << "Unregister device" << bluetoothDevice->name() << bluetoothDevice->address().toString();
|
||||||
|
|
||||||
foreach (QPointer<BluetoothLowEnergyDevice> dPointer, m_devices) {
|
foreach (QPointer<BluetoothLowEnergyDevice> dPointer, m_devices) {
|
||||||
if (devicePointer.data() == dPointer.data()) {
|
if (devicePointer.data() == dPointer.data()) {
|
||||||
m_devices.removeAll(dPointer);
|
m_devices.removeAll(dPointer);
|
||||||
@ -96,8 +99,9 @@ void BluetoothLowEnergyManager::unregisterDevice(BluetoothLowEnergyDevice *bluet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BluetoothLowEnergyManager::BluetoothLowEnergyManager(QObject *parent) :
|
BluetoothLowEnergyManager::BluetoothLowEnergyManager(PluginTimer *reconnectTimer, QObject *parent) :
|
||||||
HardwareResource(HardwareResource::TypeBluetoothLE, "Bluetooth LE manager", parent)
|
HardwareResource(HardwareResource::TypeBluetoothLE, "Bluetooth LE manager", parent),
|
||||||
|
m_reconnectTimer(reconnectTimer)
|
||||||
{
|
{
|
||||||
// Check which bluetooth adapter are available
|
// Check which bluetooth adapter are available
|
||||||
QList<QBluetoothHostInfo> bluetoothAdapters = QBluetoothLocalDevice::allDevices();
|
QList<QBluetoothHostInfo> bluetoothAdapters = QBluetoothLocalDevice::allDevices();
|
||||||
@ -124,10 +128,23 @@ BluetoothLowEnergyManager::BluetoothLowEnergyManager(QObject *parent) :
|
|||||||
m_timer->setSingleShot(true);
|
m_timer->setSingleShot(true);
|
||||||
connect(m_timer, &QTimer::timeout, this, &BluetoothLowEnergyManager::onDiscoveryTimeout);
|
connect(m_timer, &QTimer::timeout, this, &BluetoothLowEnergyManager::onDiscoveryTimeout);
|
||||||
|
|
||||||
|
// Reconnect timer
|
||||||
|
connect(m_reconnectTimer, &PluginTimer::timeout, this, &BluetoothLowEnergyManager::onReconnectTimeout);
|
||||||
|
|
||||||
qCDebug(dcHardware()) << "-->" << name() << "created successfully.";
|
qCDebug(dcHardware()) << "-->" << name() << "created successfully.";
|
||||||
setAvailable(true);
|
setAvailable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BluetoothLowEnergyManager::onReconnectTimeout()
|
||||||
|
{
|
||||||
|
// Reconnect device if enabled and disconnected
|
||||||
|
foreach (BluetoothLowEnergyDevice *device, m_devices) {
|
||||||
|
if (device->autoConnecting() && !device->connected()) {
|
||||||
|
device->connectDevice();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BluetoothLowEnergyManager::onDiscoveryTimeout()
|
void BluetoothLowEnergyManager::onDiscoveryTimeout()
|
||||||
{
|
{
|
||||||
// Stop discovery on all adapters
|
// Stop discovery on all adapters
|
||||||
@ -161,8 +178,9 @@ void BluetoothLowEnergyManager::onDeviceDiscovered(const QBluetoothDeviceInfo &d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!alreadyAdded) {
|
// Note: only show low energy devices
|
||||||
qCDebug(dcBluetooth()) << "device discovered" << deviceInfo.name() <<deviceInfo.address().toString();
|
if (!alreadyAdded && deviceInfo.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
|
||||||
|
qCDebug(dcBluetooth()) << "device discovered" << deviceInfo.name() << deviceInfo.address().toString();
|
||||||
m_discoveredDevices.append(deviceInfo);
|
m_discoveredDevices.append(deviceInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
#include <QBluetoothLocalDevice>
|
#include <QBluetoothLocalDevice>
|
||||||
#include <QBluetoothDeviceDiscoveryAgent>
|
#include <QBluetoothDeviceDiscoveryAgent>
|
||||||
|
|
||||||
|
#include "plugintimer.h"
|
||||||
#include "hardwareresource.h"
|
#include "hardwareresource.h"
|
||||||
#include "bluetoothdiscoveryreply.h"
|
#include "bluetoothdiscoveryreply.h"
|
||||||
#include "bluetoothlowenergydevice.h"
|
#include "bluetoothlowenergydevice.h"
|
||||||
@ -48,7 +49,8 @@ public:
|
|||||||
void unregisterDevice(BluetoothLowEnergyDevice *bluetoothDevice);
|
void unregisterDevice(BluetoothLowEnergyDevice *bluetoothDevice);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit BluetoothLowEnergyManager(QObject *parent = nullptr);
|
explicit BluetoothLowEnergyManager(PluginTimer *reconnectTimer, QObject *parent = nullptr);
|
||||||
|
PluginTimer *m_reconnectTimer = nullptr;
|
||||||
QTimer *m_timer = nullptr;
|
QTimer *m_timer = nullptr;
|
||||||
QList<QPointer<BluetoothLowEnergyDevice>> m_devices;
|
QList<QPointer<BluetoothLowEnergyDevice>> m_devices;
|
||||||
|
|
||||||
@ -57,9 +59,9 @@ private:
|
|||||||
QPointer<BluetoothDiscoveryReply> m_currentReply;
|
QPointer<BluetoothDiscoveryReply> m_currentReply;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void onReconnectTimeout();
|
||||||
void onDeviceDiscovered(const QBluetoothDeviceInfo &deviceInfo);
|
void onDeviceDiscovered(const QBluetoothDeviceInfo &deviceInfo);
|
||||||
void onDiscoveryError(const QBluetoothDeviceDiscoveryAgent::Error &error);
|
void onDiscoveryError(const QBluetoothDeviceDiscoveryAgent::Error &error);
|
||||||
|
|
||||||
void onDiscoveryTimeout();
|
void onDiscoveryTimeout();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "hardwaremanager.h"
|
#include "hardwaremanager.h"
|
||||||
|
|
||||||
#include "plugintimer.h"
|
#include "plugintimer.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "hardware/radio433/radio433.h"
|
#include "hardware/radio433/radio433.h"
|
||||||
@ -63,12 +62,26 @@ HardwareManager::HardwareManager(QObject *parent) : QObject(parent)
|
|||||||
m_avahiBrowser->enable();
|
m_avahiBrowser->enable();
|
||||||
|
|
||||||
// Bluetooth LE
|
// Bluetooth LE
|
||||||
m_bluetoothLowEnergyManager = new BluetoothLowEnergyManager(this);
|
m_bluetoothLowEnergyManager = new BluetoothLowEnergyManager(m_pluginTimerManager->registerTimer(10), this);
|
||||||
m_hardwareResources.append(m_bluetoothLowEnergyManager);
|
m_hardwareResources.append(m_bluetoothLowEnergyManager);
|
||||||
if (m_networkManager->available())
|
if (m_networkManager->available())
|
||||||
m_networkManager->enable();
|
m_networkManager->enable();
|
||||||
|
|
||||||
qCDebug(dcHardware()) << "Hardware manager initialized successfully";
|
qCDebug(dcHardware()) << "Hardware manager initialized successfully";
|
||||||
|
|
||||||
|
// Register D-Bus interface for enable/disable hardware resources
|
||||||
|
bool status = QDBusConnection::systemBus().registerService("io.guh.nymead");
|
||||||
|
if (!status) {
|
||||||
|
qCWarning(dcHardware()) << "Failed to register HardwareManager D-Bus service. HardwareManager D-Bus control will not work.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = QDBusConnection::systemBus().registerObject("/io/guh/nymead/HardwareManager", this, QDBusConnection::ExportScriptableContents);
|
||||||
|
if (!status) {
|
||||||
|
qCWarning(dcHardware()) << "Failed to register HardwareManager D-Bus object. HardwareManager D-Bus control will not work.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qCDebug(dcHardware()) << "HardwareManager D-Bus service set up.";
|
||||||
}
|
}
|
||||||
|
|
||||||
Radio433 *HardwareManager::radio433()
|
Radio433 *HardwareManager::radio433()
|
||||||
@ -118,9 +131,21 @@ bool HardwareManager::isEnabled(const HardwareResource::Type &hardwareResourceTy
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HardwareManager::EnableBluetooth(const bool &enabled)
|
||||||
|
{
|
||||||
|
qCDebug(dcHardware()) << "Bluetooth hardware resource" << (enabled ? "enabled" : "disabled");
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
m_bluetoothLowEnergyManager->enable();
|
||||||
|
} else {
|
||||||
|
m_bluetoothLowEnergyManager->disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool HardwareManager::enableHardwareReource(const HardwareResource::Type &hardwareResourceType)
|
bool HardwareManager::enableHardwareReource(const HardwareResource::Type &hardwareResourceType)
|
||||||
{
|
{
|
||||||
foreach (HardwareResource *resource, m_hardwareResources) {
|
foreach (HardwareResource *resource, m_hardwareResources) {
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
#define HARDWAREMANAGER_H
|
#define HARDWAREMANAGER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QDBusConnection>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
#include "hardwareresource.h"
|
#include "hardwareresource.h"
|
||||||
@ -39,6 +40,7 @@ class QtAvahiServiceBrowser;
|
|||||||
class HardwareManager : public QObject
|
class HardwareManager : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_CLASSINFO("D-Bus Interface", "io.guh.nymead")
|
||||||
|
|
||||||
friend class DeviceManager;
|
friend class DeviceManager;
|
||||||
|
|
||||||
@ -55,6 +57,9 @@ public:
|
|||||||
bool isAvailable(const HardwareResource::Type &hardwareResourceType) const;
|
bool isAvailable(const HardwareResource::Type &hardwareResourceType) const;
|
||||||
bool isEnabled(const HardwareResource::Type &hardwareResourceType) const;
|
bool isEnabled(const HardwareResource::Type &hardwareResourceType) const;
|
||||||
|
|
||||||
|
// D-Bus method for enable/disable bluetooth support
|
||||||
|
Q_SCRIPTABLE void EnableBluetooth(const bool &enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<HardwareResource *> m_hardwareResources;
|
QList<HardwareResource *> m_hardwareResources;
|
||||||
|
|
||||||
|
|||||||
@ -15,122 +15,122 @@ INSTALLS += target
|
|||||||
LIBS += -lavahi-common -lavahi-client
|
LIBS += -lavahi-common -lavahi-client
|
||||||
|
|
||||||
HEADERS += devicemanager.h \
|
HEADERS += devicemanager.h \
|
||||||
libguh.h \
|
libguh.h \
|
||||||
typeutils.h \
|
typeutils.h \
|
||||||
loggingcategories.h \
|
loggingcategories.h \
|
||||||
guhsettings.h \
|
guhsettings.h \
|
||||||
plugin/device.h \
|
plugin/device.h \
|
||||||
plugin/deviceclass.h \
|
plugin/deviceclass.h \
|
||||||
plugin/deviceplugin.h \
|
plugin/deviceplugin.h \
|
||||||
plugin/devicedescriptor.h \
|
plugin/devicedescriptor.h \
|
||||||
plugin/devicepairinginfo.h \
|
plugin/devicepairinginfo.h \
|
||||||
hardware/gpio.h \
|
hardware/gpio.h \
|
||||||
hardware/gpiomonitor.h \
|
hardware/gpiomonitor.h \
|
||||||
hardware/pwm.h \
|
hardware/pwm.h \
|
||||||
hardware/radio433/radio433.h \
|
hardware/radio433/radio433.h \
|
||||||
hardware/radio433/radio433transmitter.h \
|
hardware/radio433/radio433transmitter.h \
|
||||||
hardware/radio433/radio433brennenstuhlgateway.h \
|
hardware/radio433/radio433brennenstuhlgateway.h \
|
||||||
network/upnp/upnpdiscovery.h \
|
network/upnp/upnpdiscovery.h \
|
||||||
network/upnp/upnpdevice.h \
|
network/upnp/upnpdevice.h \
|
||||||
network/upnp/upnpdevicedescriptor.h \
|
network/upnp/upnpdevicedescriptor.h \
|
||||||
network/upnp/upnpdiscoveryrequest.h \
|
network/upnp/upnpdiscoveryrequest.h \
|
||||||
network/networkaccessmanager.h \
|
network/upnp/upnpdiscoveryreply.h \
|
||||||
network/oauth2.h \
|
network/networkaccessmanager.h \
|
||||||
network/avahi/qt-watch.h \
|
network/oauth2.h \
|
||||||
network/avahi/avahiserviceentry.h \
|
network/avahi/qt-watch.h \
|
||||||
network/avahi/qtavahiclient.h \
|
network/avahi/avahiserviceentry.h \
|
||||||
network/avahi/qtavahiservice.h \
|
network/avahi/qtavahiclient.h \
|
||||||
network/avahi/qtavahiservice_p.h \
|
network/avahi/qtavahiservice.h \
|
||||||
network/avahi/qtavahiservicebrowser.h \
|
network/avahi/qtavahiservice_p.h \
|
||||||
network/avahi/qtavahiservicebrowser_p.h \
|
network/avahi/qtavahiservicebrowser.h \
|
||||||
bluetooth/bluetoothlowenergydevice.h \
|
network/avahi/qtavahiservicebrowser_p.h \
|
||||||
coap/coap.h \
|
bluetooth/bluetoothlowenergydevice.h \
|
||||||
coap/coappdu.h \
|
bluetooth/bluetoothdiscoveryreply.h \
|
||||||
coap/coapoption.h \
|
bluetooth/bluetoothlowenergymanager.h \
|
||||||
coap/coaprequest.h \
|
coap/coap.h \
|
||||||
coap/coapreply.h \
|
coap/coappdu.h \
|
||||||
coap/coappdublock.h \
|
coap/coapoption.h \
|
||||||
coap/corelinkparser.h \
|
coap/coaprequest.h \
|
||||||
coap/corelink.h \
|
coap/coapreply.h \
|
||||||
coap/coapobserveresource.h \
|
coap/coappdublock.h \
|
||||||
types/action.h \
|
coap/corelinkparser.h \
|
||||||
types/actiontype.h \
|
coap/corelink.h \
|
||||||
types/state.h \
|
coap/coapobserveresource.h \
|
||||||
types/statetype.h \
|
types/action.h \
|
||||||
types/eventtype.h \
|
types/actiontype.h \
|
||||||
types/event.h \
|
types/state.h \
|
||||||
types/eventdescriptor.h \
|
types/statetype.h \
|
||||||
types/vendor.h \
|
types/eventtype.h \
|
||||||
types/paramtype.h \
|
types/event.h \
|
||||||
types/param.h \
|
types/eventdescriptor.h \
|
||||||
types/paramdescriptor.h \
|
types/vendor.h \
|
||||||
types/ruleaction.h \
|
types/paramtype.h \
|
||||||
types/ruleactionparam.h \
|
types/param.h \
|
||||||
types/statedescriptor.h \
|
types/paramdescriptor.h \
|
||||||
hardwareresource.h \
|
types/ruleaction.h \
|
||||||
plugintimer.h \
|
types/ruleactionparam.h \
|
||||||
hardwaremanager.h \
|
types/statedescriptor.h \
|
||||||
bluetooth/bluetoothlowenergymanager.h \
|
hardwareresource.h \
|
||||||
network/upnp/upnpdiscoveryreply.h \
|
plugintimer.h \
|
||||||
bluetooth/bluetoothdiscoveryreply.h
|
hardwaremanager.h \
|
||||||
|
|
||||||
SOURCES += devicemanager.cpp \
|
SOURCES += devicemanager.cpp \
|
||||||
loggingcategories.cpp \
|
loggingcategories.cpp \
|
||||||
guhsettings.cpp \
|
guhsettings.cpp \
|
||||||
plugin/device.cpp \
|
plugin/device.cpp \
|
||||||
plugin/deviceclass.cpp \
|
plugin/deviceclass.cpp \
|
||||||
plugin/deviceplugin.cpp \
|
plugin/deviceplugin.cpp \
|
||||||
plugin/devicedescriptor.cpp \
|
plugin/devicedescriptor.cpp \
|
||||||
plugin/devicepairinginfo.cpp \
|
plugin/devicepairinginfo.cpp \
|
||||||
hardware/gpio.cpp \
|
hardware/gpio.cpp \
|
||||||
hardware/gpiomonitor.cpp \
|
hardware/gpiomonitor.cpp \
|
||||||
hardware/pwm.cpp \
|
hardware/pwm.cpp \
|
||||||
hardware/radio433/radio433.cpp \
|
hardware/radio433/radio433.cpp \
|
||||||
hardware/radio433/radio433transmitter.cpp \
|
hardware/radio433/radio433transmitter.cpp \
|
||||||
hardware/radio433/radio433brennenstuhlgateway.cpp \
|
hardware/radio433/radio433brennenstuhlgateway.cpp \
|
||||||
network/upnp/upnpdiscovery.cpp \
|
network/upnp/upnpdiscovery.cpp \
|
||||||
network/upnp/upnpdevice.cpp \
|
network/upnp/upnpdevice.cpp \
|
||||||
network/upnp/upnpdevicedescriptor.cpp \
|
network/upnp/upnpdevicedescriptor.cpp \
|
||||||
network/upnp/upnpdiscoveryrequest.cpp \
|
network/upnp/upnpdiscoveryrequest.cpp \
|
||||||
network/networkaccessmanager.cpp \
|
network/upnp/upnpdiscoveryreply.cpp \
|
||||||
network/oauth2.cpp \
|
network/networkaccessmanager.cpp \
|
||||||
network/avahi/qt-watch.cpp \
|
network/oauth2.cpp \
|
||||||
network/avahi/avahiserviceentry.cpp \
|
network/avahi/qt-watch.cpp \
|
||||||
network/avahi/qtavahiclient.cpp \
|
network/avahi/avahiserviceentry.cpp \
|
||||||
network/avahi/qtavahiservice.cpp \
|
network/avahi/qtavahiclient.cpp \
|
||||||
network/avahi/qtavahiservice_p.cpp \
|
network/avahi/qtavahiservice.cpp \
|
||||||
network/avahi/qtavahiservicebrowser.cpp \
|
network/avahi/qtavahiservice_p.cpp \
|
||||||
network/avahi/qtavahiservicebrowser_p.cpp \
|
network/avahi/qtavahiservicebrowser.cpp \
|
||||||
bluetooth/bluetoothlowenergydevice.cpp \
|
network/avahi/qtavahiservicebrowser_p.cpp \
|
||||||
coap/coap.cpp \
|
bluetooth/bluetoothlowenergymanager.cpp \
|
||||||
coap/coappdu.cpp \
|
bluetooth/bluetoothlowenergydevice.cpp \
|
||||||
coap/coapoption.cpp \
|
bluetooth/bluetoothdiscoveryreply.cpp \
|
||||||
coap/coaprequest.cpp \
|
coap/coap.cpp \
|
||||||
coap/coapreply.cpp \
|
coap/coappdu.cpp \
|
||||||
coap/coappdublock.cpp \
|
coap/coapoption.cpp \
|
||||||
coap/corelinkparser.cpp \
|
coap/coaprequest.cpp \
|
||||||
coap/corelink.cpp \
|
coap/coapreply.cpp \
|
||||||
coap/coapobserveresource.cpp \
|
coap/coappdublock.cpp \
|
||||||
types/action.cpp \
|
coap/corelinkparser.cpp \
|
||||||
types/actiontype.cpp \
|
coap/corelink.cpp \
|
||||||
types/state.cpp \
|
coap/coapobserveresource.cpp \
|
||||||
types/statetype.cpp \
|
types/action.cpp \
|
||||||
types/eventtype.cpp \
|
types/actiontype.cpp \
|
||||||
types/event.cpp \
|
types/state.cpp \
|
||||||
types/eventdescriptor.cpp \
|
types/statetype.cpp \
|
||||||
types/vendor.cpp \
|
types/eventtype.cpp \
|
||||||
types/paramtype.cpp \
|
types/event.cpp \
|
||||||
types/param.cpp \
|
types/eventdescriptor.cpp \
|
||||||
types/paramdescriptor.cpp \
|
types/vendor.cpp \
|
||||||
types/ruleaction.cpp \
|
types/paramtype.cpp \
|
||||||
types/ruleactionparam.cpp \
|
types/param.cpp \
|
||||||
types/statedescriptor.cpp \
|
types/paramdescriptor.cpp \
|
||||||
hardwareresource.cpp \
|
types/ruleaction.cpp \
|
||||||
plugintimer.cpp \
|
types/ruleactionparam.cpp \
|
||||||
hardwaremanager.cpp \
|
types/statedescriptor.cpp \
|
||||||
bluetooth/bluetoothlowenergymanager.cpp \
|
hardwareresource.cpp \
|
||||||
network/upnp/upnpdiscoveryreply.cpp \
|
plugintimer.cpp \
|
||||||
bluetooth/bluetoothdiscoveryreply.cpp
|
hardwaremanager.cpp \
|
||||||
|
|
||||||
# install plugininfo python script for libguh-dev
|
# install plugininfo python script for libguh-dev
|
||||||
generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo
|
generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo
|
||||||
@ -147,4 +147,4 @@ for(header, HEADERS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
interfaces/interfaces.qrc
|
interfaces/interfaces.qrc
|
||||||
|
|||||||
@ -116,6 +116,7 @@ void PluginTimer::stop()
|
|||||||
PluginTimer *PluginTimerManager::registerTimer(int seconds)
|
PluginTimer *PluginTimerManager::registerTimer(int seconds)
|
||||||
{
|
{
|
||||||
QPointer<PluginTimer> pluginTimer = new PluginTimer(seconds, this);
|
QPointer<PluginTimer> pluginTimer = new PluginTimer(seconds, this);
|
||||||
|
qCDebug(dcHardware()) << "Register timer" << pluginTimer->interval();
|
||||||
|
|
||||||
// TODO: start timer depending on the schedule from other timers, loadbalancing
|
// TODO: start timer depending on the schedule from other timers, loadbalancing
|
||||||
|
|
||||||
@ -131,6 +132,8 @@ void PluginTimerManager::unregisterTimer(PluginTimer *timer)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCDebug(dcHardware()) << "Unregister timer" << timer->interval();
|
||||||
|
|
||||||
foreach (QPointer<PluginTimer> tPointer, m_timers) {
|
foreach (QPointer<PluginTimer> tPointer, m_timers) {
|
||||||
if (timerPointer.data() == tPointer.data()) {
|
if (timerPointer.data() == tPointer.data()) {
|
||||||
m_timers.removeAll(tPointer);
|
m_timers.removeAll(tPointer);
|
||||||
|
|||||||
Reference in New Issue
Block a user