summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2014-07-11 23:31:28 +0200
committerTomasz Sterna <tomek@xiaoka.com>2014-07-11 23:31:28 +0200
commit6a8cdaf2f718fef8a826fd98241050a7d3cbfb3d (patch)
tree46a5d8db858b45d633b72a74f8a7ce011ec3cbe9 /daemon
parentefb33d6494d88c27c8766553b6a963ddf2654458 (diff)
Use Log4Qt in daemon
Diffstat (limited to 'daemon')
-rw-r--r--daemon/daemon.cpp75
-rw-r--r--daemon/daemon.pro16
-rw-r--r--daemon/dbusconnector.cpp12
-rw-r--r--daemon/dbusconnector.h2
-rw-r--r--daemon/manager.cpp36
-rw-r--r--daemon/manager.h2
-rw-r--r--daemon/voicecallhandler.cpp11
-rw-r--r--daemon/voicecallhandler.h3
-rw-r--r--daemon/voicecallmanager.cpp6
-rw-r--r--daemon/voicecallmanager.h3
-rw-r--r--daemon/watchconnector.cpp26
-rw-r--r--daemon/watchconnector.h5
12 files changed, 143 insertions, 54 deletions
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index ab61171..eba9afa 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -30,6 +30,17 @@
#include <signal.h>
#include <QCoreApplication>
+#include <QStandardPaths>
+#include <QFile>
+#include <QDir>
+#include <QFileInfo>
+
+#include "LogManager"
+#include "SystemlogAppender"
+#include "FileAppender"
+#include "helpers/factory.h"
+#include "Appender"
+#include "PropertyConfigurator"
void signalhandler(int sig)
{
@@ -43,10 +54,74 @@ void signalhandler(int sig)
}
}
+// For some reason exactly SystemLogAppender doesn't have a factory registered in log4qt,
+// so in order for it to be instantiatable from .conf file (or even in general?) we declare factory
+// right here and will register it in initLoggin()
+Log4Qt::Appender *create_system_log_appender() {
+ return new Log4Qt::SystemLogAppender;
+}
+
+void initLogging()
+{
+ // Should really be done in log4qt, but somehow it's missing these
+ Log4Qt::Factory::registerAppender("org.apache.log4j.SystemLogAppender", create_system_log_appender);
+
+ // Sailfish OS-specific locations for the app settings files and app's own files
+ const QString logConfigFilePath(QStandardPaths::standardLocations(QStandardPaths::ConfigLocation).at(0)
+ + "pebble/log4qt.conf");
+ const QString fallbackLogConfigPath("/usr/share/pebble/log4qt.conf");
+
+ const QString& usedConfigFile = QFile::exists(logConfigFilePath) ? logConfigFilePath : fallbackLogConfigPath;
+ Log4Qt::PropertyConfigurator::configure(usedConfigFile);
+
+ // Uglyish hack for replacing $XDG_CACHE_HOME with the proper cache directory
+ // TODO: Implement replacing of $XDG_CACHE_HOME (and other vars?) with the proper values before configuring log4qt
+
+ // Iterate all appenders attached to root logger and whenever a FileAppender (or its descender found), replace
+ // $XDG_CACHE_HOME with the proper folder name
+ QList<Log4Qt::Appender *> appenders = Log4Qt::LogManager::rootLogger()->appenders();
+ QList<Log4Qt::Appender *>::iterator i;
+ QDir pathCreator;
+ for (i = appenders.begin(); i != appenders.end(); ++i) {
+ Log4Qt::FileAppender* fa = qobject_cast<Log4Qt::FileAppender*>(*i);
+ if(fa) {
+ QString filename = fa->file();
+
+ // As per March 2014 on emulator QStandardPaths::CacheLocation is /home/nemo/.cache
+ // while on device it is /home/nemo/.cache/app-name
+ // both things are fine, logging path will just be a little deeper on device
+ filename.replace("$XDG_CACHE_HOME",
+ QStandardPaths::standardLocations(QStandardPaths::CacheLocation).at(0)
+ );
+ // make sure loggin dir exists
+ QFileInfo fi(filename);
+ if(!pathCreator.mkpath(fi.path())) {
+ Log4Qt::LogManager::rootLogger()->error("Failed to create dir for logging: %1", fi.path());
+ }
+
+ fa->setFile(filename);
+ fa->activateOptions();
+ }
+ }
+
+ // For capturing qDebug() and console.log() messages
+ // Note that console.log() might fail in Sailfish OS device builds. Not sure why, but it seems like
+ // console.log() exactly in Sailfish OS device release builds doesn't go through the same qDebug() channel
+ Log4Qt::LogManager::setHandleQtMessages(true);
+
+ qDebug() << "Using following log config file: " << usedConfigFile;
+
+ Log4Qt::Logger::logger(QLatin1String("Main Logger"))->info("Logging started");
+}
+
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
+ // Init logging should be called after app object creation as initLogging() will examine
+ // QCoreApplication for determining the .conf files locations
+ initLogging();
+
watch::WatchConnector watch;
DBusConnector dbus;
VoiceCallManager voice;
diff --git a/daemon/daemon.pro b/daemon/daemon.pro
index aca65f1..9d1a441 100644
--- a/daemon/daemon.pro
+++ b/daemon/daemon.pro
@@ -1,7 +1,6 @@
TARGET = pebbled
CONFIG += console
-CONFIG -= app_bundle
CONFIG += link_pkgconfig
QT -= gui
@@ -10,7 +9,7 @@ PKGCONFIG += commhistory-qt5 mlite5
QMAKE_CXXFLAGS += -std=c++0x
LIBS += -L$$OUT_PWD/../ext/Log4Qt/ -llog4qt
-QMAKE_RPATHDIR += /usr/share/$$TARGET/lib
+QMAKE_RPATHDIR += /usr/share/pebble/lib
INCLUDEPATH += ../ext/Log4Qt/src ../ext/Log4Qt/deploy/include
SOURCES += \
@@ -35,7 +34,7 @@ OTHER_FILES += \
../log4qt-debug.conf \
../log4qt-release.conf
-INSTALLS += target pebbled config
+INSTALLS += target pebbled confile lib
target.path = /usr/bin
@@ -44,15 +43,18 @@ pebbled.path = /usr/lib/systemd/user
CONFIG(debug, debug|release) {
message(Debug build)
- log4qt_demo_config.extra = cp $$PWD/../../log4qt-debug.conf $$OUT_PWD/../../log4qt.conf
+ confile.extra = cp $$PWD/../log4qt-debug.conf $$OUT_PWD/../log4qt.conf
}
else {
message(Release build)
- log4qt_demo_config.extra = cp $$PWD/../../log4qt-release.conf $$OUT_PWD/../../log4qt.conf
+ confile.extra = cp $$PWD/../log4qt-release.conf $$OUT_PWD/../log4qt.conf
}
-config.files = $$OUT_PWD/../../log4qt.conf
-config.path = /usr/share/$$TARGET
+confile.files = $$OUT_PWD/../log4qt.conf
+confile.path = /usr/share/pebble
+
+lib.files += $$OUT_PWD/../ext/Log4Qt/*.s*
+lib.path = /usr/share/pebble/lib
# so QtCreator could find commhistory headers... :-(
INCLUDEPATH += $$[QT_HOST_PREFIX]/include/commhistory-qt5
diff --git a/daemon/dbusconnector.cpp b/daemon/dbusconnector.cpp
index e5bed8f..2ad753d 100644
--- a/daemon/dbusconnector.cpp
+++ b/daemon/dbusconnector.cpp
@@ -25,14 +25,14 @@ bool DBusConnector::findPebble()
"org.bluez.Manager",
"ListAdapters"));
if (not ListAdaptersReply.isValid()) {
- qWarning() << ListAdaptersReply.error().message();
+ logger()->error() << ListAdaptersReply.error().message();
return false;
}
QList<QDBusObjectPath> adapters = ListAdaptersReply.value();
if (adapters.isEmpty()) {
- qWarning() << "No BT adapters found";
+ logger()->debug() << "No BT adapters found";
return false;
}
@@ -41,7 +41,7 @@ bool DBusConnector::findPebble()
"org.bluez.Adapter",
"GetProperties"));
if (not AdapterPropertiesReply.isValid()) {
- qWarning() << AdapterPropertiesReply.error().message();
+ logger()->error() << AdapterPropertiesReply.error().message();
return false;
}
@@ -57,16 +57,16 @@ bool DBusConnector::findPebble()
"org.bluez.Device",
"GetProperties"));
if (not DevicePropertiesReply.isValid()) {
- qWarning() << DevicePropertiesReply.error().message();
+ logger()->error() << DevicePropertiesReply.error().message();
continue;
}
const QVariantMap &dict = DevicePropertiesReply.value();
QString tmp = dict["Name"].toString();
- qDebug() << "Found BT device:" << tmp;
+ logger()->debug() << "Found BT device:" << tmp;
if (tmp.startsWith("Pebble")) {
- qDebug() << "Found Pebble:" << tmp;
+ logger()->debug() << "Found Pebble:" << tmp;
pebbleProps = dict;
emit pebbleChanged();
return true;
diff --git a/daemon/dbusconnector.h b/daemon/dbusconnector.h
index e166238..98f6e58 100644
--- a/daemon/dbusconnector.h
+++ b/daemon/dbusconnector.h
@@ -3,10 +3,12 @@
#include <QObject>
#include <QVariantMap>
+#include "Logger"
class DBusConnector : public QObject
{
Q_OBJECT
+ LOG4QT_DECLARE_QCLASS_LOGGER
Q_PROPERTY(QVariantMap pebble READ pebble NOTIFY pebbleChanged)
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index f25e724..c045c1b 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -32,7 +32,7 @@ Manager::Manager(watch::WatchConnector *watch, DBusConnector *dbus, VoiceCallMan
notification.setImage("icon-system-bluetooth-device");
if (btDevice.isValid()) {
- qDebug() << "BT local name:" << btDevice.name();
+ logger()->debug() << "BT local name:" << btDevice.name();
connect(dbus, SIGNAL(pebbleChanged()), SLOT(onPebbleChanged()));
dbus->findPebble();
}
@@ -51,7 +51,7 @@ void Manager::onPebbleChanged()
const QVariantMap & pebble = dbus->pebble();
QString name = pebble["Name"].toString();
if (name.isEmpty()) {
- qDebug() << "Pebble gone";
+ logger()->debug() << "Pebble gone";
} else {
watch->deviceConnect(name, pebble["Address"].toString());
}
@@ -62,19 +62,19 @@ void Manager::onConnectedChanged()
QString message = QString("%1 %2")
.arg(watch->name().isEmpty() ? "Pebble" : watch->name())
.arg(watch->isConnected() ? "connected" : "disconnected");
- qDebug() << message;
+ logger()->debug() << message;
if (notification.isPublished()) notification.remove();
notification.setBody(message);
if (!notification.publish()) {
- qDebug() << "Failed publishing notification";
+ logger()->debug() << "Failed publishing notification";
}
}
void Manager::onActiveVoiceCallChanged()
{
- qDebug() << "Manager::onActiveVoiceCallChanged()";
+ logger()->debug() << "Manager::onActiveVoiceCallChanged()";
VoiceCallHandler* handler = voice->activeVoiceCall();
if (handler) {
@@ -87,11 +87,11 @@ void Manager::onActiveVoiceCallStatusChanged()
{
VoiceCallHandler* handler = voice->activeVoiceCall();
if (!handler) {
- qWarning() << "ActiveVoiceCallStatusChanged but no activeVoiceCall??";
+ logger()->debug() << "ActiveVoiceCallStatusChanged but no activeVoiceCall??";
return;
}
- qDebug() << "handlerId:" << handler->handlerId()
+ logger()->debug() << "handlerId:" << handler->handlerId()
<< "providerId:" << handler->providerId()
<< "status:" << handler->status()
<< "statusText:" << handler->statusText()
@@ -99,28 +99,28 @@ void Manager::onActiveVoiceCallStatusChanged()
<< "incoming:" << handler->isIncoming();
if (!watch->isConnected()) {
- qDebug() << "Watch is not connected";
+ logger()->debug() << "Watch is not connected";
return;
}
switch ((VoiceCallHandler::VoiceCallStatus)handler->status()) {
case VoiceCallHandler::STATUS_ALERTING:
case VoiceCallHandler::STATUS_DIALING:
- qDebug() << "Tell outgoing:" << handler->lineId();
+ logger()->debug() << "Tell outgoing:" << handler->lineId();
watch->ring(handler->lineId(), findPersonByNumber(handler->lineId()), false);
break;
case VoiceCallHandler::STATUS_INCOMING:
case VoiceCallHandler::STATUS_WAITING:
- qDebug() << "Tell incoming:" << handler->lineId();
+ logger()->debug() << "Tell incoming:" << handler->lineId();
watch->ring(handler->lineId(), findPersonByNumber(handler->lineId()));
break;
case VoiceCallHandler::STATUS_NULL:
case VoiceCallHandler::STATUS_DISCONNECTED:
- qDebug() << "Endphone";
+ logger()->debug() << "Endphone";
watch->endPhoneCall();
break;
case VoiceCallHandler::STATUS_ACTIVE:
- qDebug() << "Startphone";
+ logger()->debug() << "Startphone";
watch->startPhoneCall();
break;
case VoiceCallHandler::STATUS_HELD:
@@ -142,7 +142,7 @@ QString Manager::findPersonByNumber(QString number)
void Manager::onVoiceError(const QString &message)
{
- qWarning() << "Error: " << message;
+ logger()->error() << "Error: " << message;
}
void Manager::hangupAll()
@@ -155,7 +155,7 @@ void Manager::hangupAll()
void Manager::onConversationGroupAdded(GroupObject *group)
{
if (!group) {
- qWarning() << "Got null conversation group";
+ logger()->debug() << "Got null conversation group";
return;
}
@@ -168,7 +168,7 @@ void Manager::onUnreadMessagesChanged()
{
GroupObject *group = qobject_cast<GroupObject*>(sender());
if (!group) {
- qWarning() << "Got unreadMessagesChanged for null group";
+ logger()->debug() << "Got unreadMessagesChanged for null group";
return;
}
processUnreadMessages(group);
@@ -179,10 +179,10 @@ void Manager::processUnreadMessages(GroupObject *group)
if (group->unreadMessages()) {
QString name = group->contactName();
QString message = group->lastMessageText();
- qDebug() << "Msg:" << message;
- qDebug() << "From:" << name;
+ logger()->debug() << "Msg:" << message;
+ logger()->debug() << "From:" << name;
watch->sendSMSNotification(name.isEmpty()?"Unknown":name, message);
} else {
- qWarning() << "Got processUnreadMessages for group with no new messages";
+ logger()->debug() << "Got processUnreadMessages for group with no new messages";
}
}
diff --git a/daemon/manager.h b/daemon/manager.h
index 8d3c8de..db0d0d3 100644
--- a/daemon/manager.h
+++ b/daemon/manager.h
@@ -11,6 +11,7 @@
#include <QtContacts/QContactDetailFilter>
#include <CommHistory/GroupModel>
#include <MNotification>
+#include "Logger"
using namespace QtContacts;
using namespace CommHistory;
@@ -18,6 +19,7 @@ using namespace CommHistory;
class Manager : public QObject
{
Q_OBJECT
+ LOG4QT_DECLARE_QCLASS_LOGGER
friend class PebbledProxy;
diff --git a/daemon/voicecallhandler.cpp b/daemon/voicecallhandler.cpp
index 1a006f1..c8ffe89 100644
--- a/daemon/voicecallhandler.cpp
+++ b/daemon/voicecallhandler.cpp
@@ -48,7 +48,7 @@ VoiceCallHandler::VoiceCallHandler(const QString &handlerId, QObject *parent)
: QObject(parent), d_ptr(new VoiceCallHandlerPrivate(this, handlerId))
{
Q_D(VoiceCallHandler);
- qDebug() << QString("Creating D-Bus interface to: ") + handlerId;
+ logger()->debug() << QString("Creating D-Bus interface to: ") + handlerId;
d->interface = new QDBusInterface("org.nemomobile.voicecall",
"/calls/" + handlerId,
"org.nemomobile.voicecall.VoiceCall",
@@ -178,7 +178,8 @@ method return sender=:1.13 -> dest=:1.150 reply_serial=2
QDBusReply<QVariantMap> reply = props.call("GetAll", d->interface->interface());
if (reply.isValid()) {
QVariantMap props = reply.value();
- qDebug() << props;
+ QString str; QDebug(&str) << props;
+ logger()->debug() << str;
d->providerId = props["providerId"].toString();
d->duration = props["duration"].toInt();
d->status = props["status"].toInt();
@@ -196,7 +197,7 @@ method return sender=:1.13 -> dest=:1.150 reply_serial=2
emit emergencyChanged();
emit forwardedChanged();
} else if (notifyError) {
- qWarning() << "Failed to get VoiceCall properties from VCM D-Bus service.";
+ logger()->error() << "Failed to get VoiceCall properties from VCM D-Bus service.";
emit this->error("Failed to get VoiceCall properties from VCM D-Bus service.");
}
}
@@ -413,10 +414,10 @@ void VoiceCallHandler::onPendingCallFinished(QDBusPendingCallWatcher *watcher)
QDBusPendingReply<bool> reply = *watcher;
if (reply.isError()) {
- qWarning() << QString::fromLatin1("Received error reply for member: %1 (%2)").arg(reply.reply().member()).arg(reply.error().message());
+ logger()->error() << QString::fromLatin1("Received error reply for member: %1 (%2)").arg(reply.reply().member()).arg(reply.error().message());
emit this->error(reply.error().message());
watcher->deleteLater();
} else {
- qDebug() << QString::fromLatin1("Received successful reply for member: %1").arg(reply.reply().member());
+ logger()->debug() << QString::fromLatin1("Received successful reply for member: %1").arg(reply.reply().member());
}
}
diff --git a/daemon/voicecallhandler.h b/daemon/voicecallhandler.h
index 678d8f8..f96a97a 100644
--- a/daemon/voicecallhandler.h
+++ b/daemon/voicecallhandler.h
@@ -3,12 +3,13 @@
#include <QObject>
#include <QDateTime>
-
#include <QDBusPendingCallWatcher>
+#include "Logger"
class VoiceCallHandler : public QObject
{
Q_OBJECT
+ LOG4QT_DECLARE_QCLASS_LOGGER
Q_ENUMS(VoiceCallStatus)
diff --git a/daemon/voicecallmanager.cpp b/daemon/voicecallmanager.cpp
index 90a3812..21d3d49 100644
--- a/daemon/voicecallmanager.cpp
+++ b/daemon/voicecallmanager.cpp
@@ -98,7 +98,7 @@ QString VoiceCallManager::defaultProviderId() const
{
Q_D(const VoiceCallManager);
if(d->providers.count() == 0) {
- qWarning() << Q_FUNC_INFO << "No provider added";
+ logger()->debug() << Q_FUNC_INFO << "No provider added";
return QString::null;
}
@@ -288,7 +288,7 @@ void VoiceCallManager::onPendingCallFinished(QDBusPendingCallWatcher *watcher)
if (reply.isError()) {
emit this->error(reply.error().message());
} else {
- qDebug() << QString("Received successful reply for member: ") + reply.reply().member();
+ logger()->debug() << QString("Received successful reply for member: ") + reply.reply().member();
}
watcher->deleteLater();
@@ -301,7 +301,7 @@ void VoiceCallManager::onPendingSilenceFinished(QDBusPendingCallWatcher *watcher
if (reply.isError()) {
emit this->error(reply.error().message());
} else {
- qDebug() << QString("Received successful reply for member: ") + reply.reply().member();
+ logger()->debug() << QString("Received successful reply for member: ") + reply.reply().member();
}
watcher->deleteLater();
diff --git a/daemon/voicecallmanager.h b/daemon/voicecallmanager.h
index de18781..afb9a11 100644
--- a/daemon/voicecallmanager.h
+++ b/daemon/voicecallmanager.h
@@ -4,9 +4,9 @@
#include "voicecallhandler.h"
#include <QObject>
-
#include <QDBusInterface>
#include <QDBusPendingCallWatcher>
+#include "Logger"
class VoiceCallProviderData
{
@@ -27,6 +27,7 @@ typedef QList<VoiceCallHandler*> VoiceCallHandlerList;
class VoiceCallManager : public QObject
{
Q_OBJECT
+ LOG4QT_DECLARE_QCLASS_LOGGER
Q_PROPERTY(QDBusInterface* interface READ interface)
diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp
index dbcd831..d999229 100644
--- a/daemon/watchconnector.cpp
+++ b/daemon/watchconnector.cpp
@@ -18,10 +18,10 @@ void WatchConnector::deviceDiscovered(const QBluetoothDeviceInfo &device)
{
//FIXME TODO: Configurable
if (device.name().startsWith("Pebble")) {
- qDebug() << "Found Pebble:" << device.name() << '(' << device.address().toString() << ')';
+ logger()->debug() << "Found Pebble: " << device.name() << " (" << device.address().toString() << ')';
handleWatch(device.name(), device.address().toString());
} else {
- qDebug() << "Found other device:" << device.name() << '(' << device.address().toString() << ')';
+ logger()->debug() << "Found other device: " << device.name() << " (" << device.address().toString() << ')';
}
}
@@ -32,7 +32,7 @@ void WatchConnector::deviceConnect(const QString &name, const QString &address)
void WatchConnector::reconnect()
{
- qDebug() << "reconnect" << _last_name;
+ logger()->debug() << "reconnect " << _last_name;
if (!_last_name.isEmpty() && !_last_address.isEmpty()) {
deviceConnect(_last_name, _last_address);
}
@@ -40,14 +40,14 @@ void WatchConnector::reconnect()
void WatchConnector::disconnect()
{
- qDebug() << __FUNCTION__;
+ logger()->debug() << __FUNCTION__;
socket->close();
socket->deleteLater();
}
void WatchConnector::handleWatch(const QString &name, const QString &address)
{
- qDebug() << "handleWatch" << name << address;
+ logger()->debug() << "handleWatch " << name << " " << address;
if (socket != nullptr && socket->isOpen()) {
socket->close();
socket->deleteLater();
@@ -58,7 +58,7 @@ void WatchConnector::handleWatch(const QString &name, const QString &address)
_last_address = address;
if (emit_name) emit nameChanged();
- qDebug() << "Creating socket";
+ logger()->debug() << "Creating socket";
socket = new QBluetoothSocket(QBluetoothSocket::RfcommSocket);
connect(socket, SIGNAL(readyRead()), SLOT(onReadSocket()));
@@ -128,8 +128,8 @@ void WatchConnector::decodeMsg(QByteArray data)
endpoint = (data.at(index) << 8) + data.at(index+1);
index += 2;
- qDebug() << "Length:" << datalen << " Endpoint:" << decodeEndpoint(endpoint);
- qDebug() << "Data:" << data.mid(index).toHex();
+ logger()->debug() << "Length:" << datalen << " Endpoint:" << decodeEndpoint(endpoint);
+ logger()->debug() << "Data:" << data.mid(index).toHex();
if (endpoint == watchPHONE_CONTROL) {
if (data.length() >= 5) {
if (data.at(4) == callHANGUP) {
@@ -141,7 +141,7 @@ void WatchConnector::decodeMsg(QByteArray data)
void WatchConnector::onReadSocket()
{
- qDebug() << "read";
+ logger()->debug() << "read";
QBluetoothSocket *socket = qobject_cast<QBluetoothSocket *>(sender());
if (!socket) return;
@@ -155,7 +155,7 @@ void WatchConnector::onReadSocket()
void WatchConnector::onConnected()
{
- qDebug() << "Connected!";
+ logger()->debug() << "Connected!";
bool was_connected = is_connected;
is_connected = true;
if (not was_connected) emit connectedChanged();
@@ -163,7 +163,7 @@ void WatchConnector::onConnected()
void WatchConnector::onDisconnected()
{
- qDebug() << "Disconnected!";
+ logger()->debug() << "Disconnected!";
bool was_connected = is_connected;
is_connected = false;
@@ -180,7 +180,7 @@ void WatchConnector::onDisconnected()
}
void WatchConnector::onError(QBluetoothSocket::SocketError error) {
- qWarning() << "Error connecting Pebble" << error << socket->errorString();
+ logger()->error() << "Error connecting Pebble: " << error << socket->errorString();
}
void WatchConnector::sendData(const QByteArray &data)
@@ -192,7 +192,7 @@ void WatchConnector::sendData(const QByteArray &data)
void WatchConnector::sendMessage(unsigned int endpoint, QByteArray data)
{
- qDebug() << "Sending message";
+ logger()->debug() << "Sending message";
QByteArray msg;
// First send the length
diff --git a/daemon/watchconnector.h b/daemon/watchconnector.h
index eaeccdc..4015870 100644
--- a/daemon/watchconnector.h
+++ b/daemon/watchconnector.h
@@ -33,9 +33,11 @@
#include <QObject>
#include <QPointer>
#include <QStringList>
+#include <QTimer>
#include <QBluetoothDeviceInfo>
#include <QBluetoothSocket>
#include <QBluetoothServiceInfo>
+#include "Logger"
using namespace QtBluetooth;
@@ -45,8 +47,11 @@ namespace watch
class WatchConnector : public QObject
{
Q_OBJECT
+ LOG4QT_DECLARE_QCLASS_LOGGER
+
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(QString connected READ isConnected NOTIFY connectedChanged)
+
public:
enum {
watchTIME = 11,