fixed licenses and debug categorie

This commit is contained in:
Simon Stürz 2015-08-12 13:16:07 +02:00 committed by Michael Zanetti
parent d8dccda9fa
commit 67deeb1e0e
11 changed files with 37 additions and 15 deletions

View File

@ -17,6 +17,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "bluetoothlowenergydevice.h" #include "bluetoothlowenergydevice.h"
#include "loggingcategories.h"
BluetoothLowEnergyDevice::BluetoothLowEnergyDevice(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType, QObject *parent) : BluetoothLowEnergyDevice::BluetoothLowEnergyDevice(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType, QObject *parent) :
QObject(parent), m_deviceInfo(deviceInfo) QObject(parent), m_deviceInfo(deviceInfo)
@ -69,21 +70,21 @@ bool BluetoothLowEnergyDevice::isConnected() const
void BluetoothLowEnergyDevice::connected() void BluetoothLowEnergyDevice::connected()
{ {
m_connected = true; m_connected = true;
qDebug() << "connected to bluetooth LE device:" << name() << address().toString(); qCDebug(dcHardware) << "Connected to Bluetooth LE device:" << name() << address().toString();
emit connectionStatusChanged(); emit connectionStatusChanged();
qDebug() << "discover services..."; qCDebug(dcHardware) << "Discover Bluetooth LE services...";
m_controller->discoverServices(); m_controller->discoverServices();
} }
void BluetoothLowEnergyDevice::disconnected() void BluetoothLowEnergyDevice::disconnected()
{ {
m_connected = false; m_connected = false;
qWarning() << "disconnected from bluetooth LE device:" << name() << address().toString(); qCWarning(dcHardware) << "Disconnected from Bluetooth LE device:" << name() << address().toString();
emit connectionStatusChanged(); emit connectionStatusChanged();
} }
void BluetoothLowEnergyDevice::deviceError(const QLowEnergyController::Error &error) void BluetoothLowEnergyDevice::deviceError(const QLowEnergyController::Error &error)
{ {
if (isConnected()) if (isConnected())
qWarning() << "ERROR: Bluetooth LE device:" << name() << address().toString() << ": " << error << m_controller->errorString(); qCWarning(dcHardware) << "Bluetooth LE device:" << name() << address().toString() << ": " << error << m_controller->errorString();
} }

View File

@ -35,6 +35,7 @@
*/ */
#include "bluetoothscanner.h" #include "bluetoothscanner.h"
#include "loggingcategories.h"
/*! Construct the hardware resource BluetoothScanner with the given \a parent. */ /*! Construct the hardware resource BluetoothScanner with the given \a parent. */
BluetoothScanner::BluetoothScanner(QObject *parent) : BluetoothScanner::BluetoothScanner(QObject *parent) :
@ -54,7 +55,7 @@ bool BluetoothScanner::isAvailable()
// Check if Bluetooth is available on this device // Check if Bluetooth is available on this device
if (!localDevice.isValid()) { if (!localDevice.isValid()) {
qWarning() << "ERROR: no bluetooth device found."; qCWarning(dcHardware) << "No Bluetooth device found.";
m_available = false; m_available = false;
return false; return false;
} }
@ -68,7 +69,7 @@ bool BluetoothScanner::isAvailable()
// Get connected devices // Get connected devices
QList<QBluetoothHostInfo> remotes = localDevice.allDevices(); QList<QBluetoothHostInfo> remotes = localDevice.allDevices();
if (remotes.isEmpty()) { if (remotes.isEmpty()) {
qWarning() << "ERROR: no bluetooth host info found."; qCWarning(dcHardware) << "No Bluetooth host info found.";
m_available = false; m_available = false;
return false; return false;
} }
@ -81,7 +82,7 @@ bool BluetoothScanner::isAvailable()
connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BluetoothScanner::deviceDiscovered); connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BluetoothScanner::deviceDiscovered);
connect(m_discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), this, SLOT(onError(QBluetoothDeviceDiscoveryAgent::Error))); connect(m_discoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), this, SLOT(onError(QBluetoothDeviceDiscoveryAgent::Error)));
qDebug() << "--> Bluetooth discovery created successfully."; qCDebug(dcDeviceManager) << "--> Bluetooth discovery created successfully.";
m_available = true; m_available = true;
return true; return true;
} }
@ -101,7 +102,7 @@ bool BluetoothScanner::discover(const PluginId &pluginId)
m_deviceInfos.clear(); m_deviceInfos.clear();
m_discoveryAgent->start(); m_discoveryAgent->start();
m_timer->start(); m_timer->start();
qDebug() << "Bluetooth discovery started..."; qCDebug(dcHardware) << "Bluetooth discovery started...";
return true; return true;
} }
return false; return false;
@ -114,7 +115,7 @@ void BluetoothScanner::deviceDiscovered(const QBluetoothDeviceInfo &device)
if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) { if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
bluetoothLE = true; bluetoothLE = true;
} }
qDebug() << "Bluetooth device discovered:" << device.name() << device.address() << "LE:" << bluetoothLE; qCDebug(dcHardware) << "Bluetooth device discovered:" << device.name() << device.address() << "LE:" << bluetoothLE;
m_deviceInfos.append(device); m_deviceInfos.append(device);
} }
@ -131,12 +132,12 @@ void BluetoothScanner::onError(QBluetoothDeviceDiscoveryAgent::Error error)
if (isRunning()) if (isRunning())
m_discoveryAgent->stop(); m_discoveryAgent->stop();
qWarning() << "ERROR: Bluetooth discovery:" << m_discoveryAgent->errorString(); qCWarning(dcHardware) << "Bluetooth discovery error:" << m_discoveryAgent->errorString();
} }
void BluetoothScanner::discoveryTimeout() void BluetoothScanner::discoveryTimeout()
{ {
qDebug() << "Bluetooth discovery finished."; qCDebug(dcHardware) << "Bluetooth discovery finished.";
m_discoveryAgent->stop(); m_discoveryAgent->stop();
emit bluetoothDiscoveryFinished(m_pluginId, m_deviceInfos); emit bluetoothDiscoveryFinished(m_pluginId, m_deviceInfos);
} }

View File

@ -111,7 +111,7 @@ bool Radio433::enable()
// return false; // return false;
// } // }
} }
qCDebug(dcHardware) << "--> Radio 433 MHz GPIO's enabled."; qCDebug(dcDeviceManager) << "--> Radio 433 MHz GPIO's enabled.";
#endif #endif
return true; return true;
@ -134,7 +134,7 @@ bool Radio433::disabel()
void Radio433::brennenstuhlAvailableChanged(const bool &available) void Radio433::brennenstuhlAvailableChanged(const bool &available)
{ {
if (available) { if (available) {
qCDebug(dcHardware) << "--> Radio 433 MHz Brennenstuhl LAN Gateway available."; qCDebug(dcDeviceManager) << "--> Radio 433 MHz Brennenstuhl LAN Gateway available.";
} else { } else {
qCWarning(dcHardware) << "--> Radio 433 MHz Brennenstuhl LAN Gateway NOT available."; qCWarning(dcHardware) << "--> Radio 433 MHz Brennenstuhl LAN Gateway NOT available.";
} }

View File

@ -46,7 +46,7 @@ NetworkManager::NetworkManager(QObject *parent) :
m_manager = new QNetworkAccessManager(this); m_manager = new QNetworkAccessManager(this);
connect(m_manager, &QNetworkAccessManager::finished, this, &NetworkManager::replyFinished); connect(m_manager, &QNetworkAccessManager::finished, this, &NetworkManager::replyFinished);
qCDebug(dcHardware) << "--> Network manager created successfully."; qCDebug(dcDeviceManager) << "--> Network manager created successfully.";
} }
/*! Posts a request to obtain the contents of the target \a request from the plugin with the given \a pluginId /*! Posts a request to obtain the contents of the target \a request from the plugin with the given \a pluginId

View File

@ -78,7 +78,7 @@ UpnpDiscovery::UpnpDiscovery(QObject *parent) :
connect(this,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError))); connect(this,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError)));
connect(this, &UpnpDiscovery::readyRead, this, &UpnpDiscovery::readData); connect(this, &UpnpDiscovery::readyRead, this, &UpnpDiscovery::readData);
qCDebug(dcHardware) << "--> UPnP discovery created successfully."; qCDebug(dcDeviceManager) << "--> UPnP discovery created successfully.";
} }
/*! Returns false, if the \l{UpnpDiscovery} resource is not available. Returns true, if a device with /*! Returns false, if the \l{UpnpDiscovery} resource is not available. Returns true, if a device with

View File

@ -16,6 +16,7 @@
* * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef BLUETOOTH_LE
#include "aveabulb.h" #include "aveabulb.h"
AveaBulb::AveaBulb(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType, QObject *parent) : AveaBulb::AveaBulb(const QBluetoothDeviceInfo &deviceInfo, const QLowEnergyController::RemoteAddressType &addressType, QObject *parent) :
@ -570,3 +571,5 @@ bool AveaBulb::setMagicHour(ActionId actionId)
sendNextCommand(); sendNextCommand();
return true; return true;
} }
#endif // BLUETOOTH_LE

View File

@ -19,6 +19,8 @@
#ifndef AVEABULB_H #ifndef AVEABULB_H
#define AVEABULB_H #define AVEABULB_H
#ifdef BLUETOOTH_LE
#include <QObject> #include <QObject>
#include <QQueue> #include <QQueue>
@ -95,5 +97,6 @@ public slots:
bool setMagicHour(ActionId actionId); bool setMagicHour(ActionId actionId);
}; };
#endif // BLUETOOTH_LE
#endif // AVEABULB_H #endif // AVEABULB_H

View File

@ -16,6 +16,8 @@
* * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef BLUETOOTH_LE
#include "commandrequest.h" #include "commandrequest.h"
CommandRequest::CommandRequest() : CommandRequest::CommandRequest() :
@ -46,3 +48,5 @@ QByteArray CommandRequest::value() const
{ {
return m_value; return m_value;
} }
#endif // BLUETOOTH_LE

View File

@ -19,6 +19,8 @@
#ifndef COMMANDREQUEST_H #ifndef COMMANDREQUEST_H
#define COMMANDREQUEST_H #define COMMANDREQUEST_H
#ifdef BLUETOOTH_LE
#include <QLowEnergyService> #include <QLowEnergyService>
#include <QLowEnergyCharacteristic> #include <QLowEnergyCharacteristic>
#include <QByteArray> #include <QByteArray>
@ -41,4 +43,6 @@ private:
}; };
#endif // BLUETOOTH_LE
#endif // COMMANDREQUEST_H #endif // COMMANDREQUEST_H

View File

@ -397,6 +397,8 @@
\quotefile plugins/deviceplugins/elgato/devicepluginelgato.json \quotefile plugins/deviceplugins/elgato/devicepluginelgato.json
*/ */
#ifdef BLUETOOTH_LE
#include "devicepluginelgato.h" #include "devicepluginelgato.h"
#include "plugin/device.h" #include "plugin/device.h"
@ -592,5 +594,6 @@ void DevicePluginElgato::actionFinished(const ActionId actionId, const bool &suc
} }
} }
#endif // BLUETOOTH_LE

View File

@ -19,6 +19,8 @@
#ifndef DEVICEPLUGINELGATO_H #ifndef DEVICEPLUGINELGATO_H
#define DEVICEPLUGINELGATO_H #define DEVICEPLUGINELGATO_H
#ifdef BLUETOOTH_LE
#include "plugin/deviceplugin.h" #include "plugin/deviceplugin.h"
#include "bluetooth/bluetoothlowenergydevice.h" #include "bluetooth/bluetoothlowenergydevice.h"
#include "aveabulb.h" #include "aveabulb.h"
@ -49,5 +51,6 @@ private slots:
void bulbAvailableChanged(); void bulbAvailableChanged();
void actionFinished(const ActionId actionId, const bool &success); void actionFinished(const ActionId actionId, const bool &success);
}; };
#endif // BLUETOOTH_LE
#endif // DEVICEPLUGINELGATO_H #endif // DEVICEPLUGINELGATO_H