summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libsowatch/declarativewatchlet.h3
-rw-r--r--libsowatch/graphicswatchlet.h3
-rw-r--r--libsowatch/libsowatch.pro45
-rw-r--r--libsowatch/notification.cpp13
-rw-r--r--libsowatch/notification.h40
-rw-r--r--libsowatch/notificationplugininterface.cpp7
-rw-r--r--libsowatch/notificationplugininterface.h29
-rw-r--r--libsowatch/sowatch.h1
-rw-r--r--libsowatch/sowatch_global.h10
-rw-r--r--libsowatch/watch.cpp51
-rw-r--r--libsowatch/watch.h29
-rw-r--r--libsowatch/watchpaintengine.cpp48
-rw-r--r--libsowatch/watchpaintengine.h5
-rw-r--r--libsowatch/watchplugininterface.h8
-rw-r--r--libsowatch/watchserver.cpp5
-rw-r--r--libsowatch/watchserver.h9
-rw-r--r--libsowatch/watchsimulator.cpp4
-rw-r--r--libsowatch/watchsimulator.h2
-rw-r--r--metawatch/idle_call.bmpbin0 -> 134 bytes
-rw-r--r--metawatch/idle_gmail.bmpbin0 -> 134 bytes
-rw-r--r--metawatch/idle_sms.bmpbin0 -> 134 bytes
-rw-r--r--metawatch/metawatch.cpp261
-rw-r--r--metawatch/metawatch.h69
-rw-r--r--metawatch/metawatch.pro32
-rw-r--r--metawatch/metawatchpaintengine.cpp28
-rw-r--r--metawatch/metawatchpaintengine.h9
-rw-r--r--metawatch/metawatchplugin.cpp12
-rw-r--r--metawatch/metawatchplugin.h4
-rw-r--r--metawatch/metawatchsimulator.cpp3
-rw-r--r--metawatch/metawatchsimulator.h1
-rw-r--r--metawatch/uires.qrc7
-rw-r--r--qtc_packaging/debian_harmattan/changelog2
-rw-r--r--qtc_packaging/debian_harmattan/control4
-rw-r--r--sowatch.pro10
-rw-r--r--sowatch.pro.user214
-rw-r--r--sowatchd/daemon.cpp83
-rw-r--r--sowatchd/daemon.h30
-rw-r--r--sowatchd/main.cpp20
-rw-r--r--sowatchd/sowatchd.pro38
-rw-r--r--sowsim/sowsim.pro14
40 files changed, 908 insertions, 245 deletions
diff --git a/libsowatch/declarativewatchlet.h b/libsowatch/declarativewatchlet.h
index 1e94007..ea31a33 100644
--- a/libsowatch/declarativewatchlet.h
+++ b/libsowatch/declarativewatchlet.h
@@ -5,13 +5,14 @@
#include <QtDeclarative/QDeclarativeComponent>
#include <QtDeclarative/QDeclarativeItem>
#include "graphicswatchlet.h"
+#include "sowatch_global.h"
namespace sowatch
{
class DeclarativeWatchWrapper;
-class DeclarativeWatchlet : public GraphicsWatchlet
+class SOWATCH_EXPORT DeclarativeWatchlet : public GraphicsWatchlet
{
Q_OBJECT
public:
diff --git a/libsowatch/graphicswatchlet.h b/libsowatch/graphicswatchlet.h
index 9754062..d2cbb37 100644
--- a/libsowatch/graphicswatchlet.h
+++ b/libsowatch/graphicswatchlet.h
@@ -4,11 +4,12 @@
#include <QtGui/QGraphicsScene>
#include <QtGui/QRegion>
#include "watchlet.h"
+#include "sowatch_global.h"
namespace sowatch
{
-class GraphicsWatchlet : public Watchlet
+class SOWATCH_EXPORT GraphicsWatchlet : public Watchlet
{
Q_OBJECT
public:
diff --git a/libsowatch/libsowatch.pro b/libsowatch/libsowatch.pro
index a5b4fd8..38d3389 100644
--- a/libsowatch/libsowatch.pro
+++ b/libsowatch/libsowatch.pro
@@ -4,12 +4,12 @@
#
#-------------------------------------------------
-QT += gui dbus declarative
+QT += gui declarative
CONFIG += mobility
-MOBILITY += connectivity
-TARGET = libsowatch
+TARGET = sowatch
TEMPLATE = lib
+VERSION = 1.0.0
DEFINES += SOWATCH_LIBRARY
@@ -24,7 +24,9 @@ SOURCES += \
graphicswatchlet.cpp \
declarativewatchwrapper.cpp \
declarativewatchlet.cpp \
- watchplugininterface.cpp
+ watchplugininterface.cpp \
+ notification.cpp \
+ notificationplugininterface.cpp
HEADERS +=\
watchsimulator.h \
@@ -39,24 +41,11 @@ HEADERS +=\
declarativewatchwrapper.h \
declarativewatchlet.h \
sowatch_global.h \
- watchplugininterface.h
-
-FORMS +=
-
-install_headers.files =\
- watchsimulator.h \
- watchserver.h \
- watchpaintengine.h \
- watchmanager.h \
- watchlet.h \
- watch.h \
- testwatchlet.h \
- testdeclarativewatchlet.h \
- sowatch.h \
- graphicswatchlet.h \
- declarativewatchwrapper.h \
- declarativewatchlet.h \
- sowatch_global.h
+ watchplugininterface.h \
+ notification.h \
+ notificationplugininterface.h
+
+install_headers.files = $$HEADERS
symbian {
MMP_RULES += EXPORTUNFROZEN
@@ -84,3 +73,15 @@ unix:!symbian {
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libsowatch/notification.cpp b/libsowatch/notification.cpp
new file mode 100644
index 0000000..55f3e78
--- /dev/null
+++ b/libsowatch/notification.cpp
@@ -0,0 +1,13 @@
+#include "notification.h"
+
+using namespace sowatch;
+
+Notification::Notification(Type type, const QDateTime& dateTime, QString title, QString body)
+ : _type(type), _dateTime(dateTime), _title(title), _body(body)
+{
+}
+
+Notification::~Notification()
+{
+
+}
diff --git a/libsowatch/notification.h b/libsowatch/notification.h
new file mode 100644
index 0000000..7f463bf
--- /dev/null
+++ b/libsowatch/notification.h
@@ -0,0 +1,40 @@
+#ifndef NOTIFICATION_H
+#define NOTIFICATION_H
+
+#include <QtCore/QString>
+#include <QtCore/QDateTime>
+#include "sowatch_global.h"
+
+namespace sowatch
+{
+
+class SOWATCH_EXPORT Notification
+{
+public:
+ enum Type {
+ OtherNotification = 0,
+ EmailNotification,
+ CallNotification,
+ SmsNotification,
+ ImNotification,
+ TypeCount
+ };
+
+ Notification(Type type, const QDateTime& dateTime, QString title, QString body);
+ ~Notification();
+
+ inline Type type() const { return _type; }
+ inline QDateTime dateTime() const { return _dateTime; }
+ inline QString title() const { return _title; }
+ inline QString body() const { return _body; }
+
+protected:
+ Type _type;
+ QDateTime _dateTime;
+ QString _title;
+ QString _body;
+};
+
+}
+
+#endif // NOTIFICATION_H
diff --git a/libsowatch/notificationplugininterface.cpp b/libsowatch/notificationplugininterface.cpp
new file mode 100644
index 0000000..e32060a
--- /dev/null
+++ b/libsowatch/notificationplugininterface.cpp
@@ -0,0 +1,7 @@
+#include "notificationplugininterface.h"
+
+using namespace sowatch;
+
+NotificationPluginInterface::~NotificationPluginInterface()
+{
+}
diff --git a/libsowatch/notificationplugininterface.h b/libsowatch/notificationplugininterface.h
new file mode 100644
index 0000000..1a312a1
--- /dev/null
+++ b/libsowatch/notificationplugininterface.h
@@ -0,0 +1,29 @@
+#ifndef NOTIFICATIONPLUGININTERFACE_H
+#define NOTIFICATIONPLUGININTERFACE_H
+
+#include <QtPlugin>
+#include "sowatch_global.h"
+#include "notification.h"
+
+namespace sowatch
+{
+
+class Notification;
+
+class SOWATCH_EXPORT NotificationPluginInterface
+{
+public:
+ virtual ~NotificationPluginInterface();
+
+ int getCount(Notification::Type type);
+
+signals:
+ void incomingNotification(const Notification& n);
+ void unreadCountChanged(Notification::Type type);
+};
+
+}
+
+Q_DECLARE_INTERFACE(sowatch::NotificationPluginInterface, "com.javispedro.sowatch.NotificationPluginInterface")
+
+#endif // NOTIFICATIONPLUGININTERFACE_H
diff --git a/libsowatch/sowatch.h b/libsowatch/sowatch.h
index 0463389..8c56954 100644
--- a/libsowatch/sowatch.h
+++ b/libsowatch/sowatch.h
@@ -6,6 +6,7 @@
#include "watchlet.h"
#include "graphicswatchlet.h"
#include "declarativewatchlet.h"
+#include "notification.h"
#include "watchserver.h"
#include "watchsimulator.h"
#include "watchplugininterface.h"
diff --git a/libsowatch/sowatch_global.h b/libsowatch/sowatch_global.h
index a3b40e6..977bd53 100644
--- a/libsowatch/sowatch_global.h
+++ b/libsowatch/sowatch_global.h
@@ -9,4 +9,14 @@
# define SOWATCH_EXPORT Q_DECL_IMPORT
#endif
+#if defined(Q_WS_MAEMO_5)
+# define SOWATCH_DRIVERS_DIR "/opt/sowatch/drivers"
+# define SOWATCH_NOTIFICATIONS_DIR "/opt/sowatch/notifications"
+# define SOWATCH_WATCHLETS_DIR "/opt/sowatch/watchlets"
+#elif defined(Q_OS_LINUX)
+# define SOWATCH_DRIVERS_DIR "/usr/lib/sowatch/drivers"
+# define SOWATCH_NOTIFICATIONS_DIR "/usr/lib/sowatch/notifications"
+# define SOWATCH_WATCHLETS_DIR "/usr/lib/sowatch/watchlets"
+#endif
+
#endif // SOWATCH_GLOBAL_H
diff --git a/libsowatch/watch.cpp b/libsowatch/watch.cpp
index e8da790..7792693 100644
--- a/libsowatch/watch.cpp
+++ b/libsowatch/watch.cpp
@@ -3,60 +3,13 @@
using namespace sowatch;
-Watch::Watch(const QImage& image, QObject* parent) :
- QObject(parent), _image(image), _paintEngine(0)
+Watch::Watch(QObject* parent) :
+ QObject(parent)
{
}
Watch::~Watch()
{
- if (_paintEngine) {
- delete _paintEngine;
- }
-}
-
-QPaintEngine* Watch::paintEngine() const
-{
- if (!_paintEngine) {
- _paintEngine = new WatchPaintEngine(const_cast<Watch*>(this),
- const_cast<QImage*>(&_image));
- }
-
- return _paintEngine;
-}
-int Watch::metric(PaintDeviceMetric metric) const
-{
- switch (metric) {
- case PdmWidth:
- return _image.width();
- case PdmHeight:
- return _image.height();
- case PdmWidthMM:
- return _image.widthMM();
- case PdmHeightMM:
- return _image.heightMM();
- case PdmNumColors:
- return _image.numColors();
- case PdmDepth:
- return _image.depth();
- case PdmDpiX:
- return _image.logicalDpiX();
- case PdmDpiY:
- return _image.logicalDpiY();
- case PdmPhysicalDpiX:
- return _image.physicalDpiX();
- case PdmPhysicalDpiY:
- return _image.physicalDpiY();
- }
-
- return -1;
-}
-
-void Watch::update(const QRect &rect)
-{
- QList<QRect> rects;
- rects << rect;
- update(rects);
}
diff --git a/libsowatch/watch.h b/libsowatch/watch.h
index 3581ada..056bfe0 100644
--- a/libsowatch/watch.h
+++ b/libsowatch/watch.h
@@ -2,8 +2,10 @@
#define WATCH_H
#include <QtCore/QObject>
+#include <QtCore/QDateTime>
#include <QtGui/QPaintDevice>
#include <QtGui/QImage>
+#include "notification.h"
namespace sowatch
{
@@ -13,18 +15,22 @@ class Watch : public QObject, public QPaintDevice
Q_OBJECT
Q_PROPERTY(QString model READ model)
Q_PROPERTY(bool connected READ isConnected)
+ Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime)
+
public:
- explicit Watch(const QImage& image, QObject* parent = 0);
+ explicit Watch(QObject* parent = 0);
~Watch();
- QPaintEngine* paintEngine() const;
- int metric(PaintDeviceMetric metric) const;
-
- Q_INVOKABLE virtual QString model() const = 0;
- Q_INVOKABLE virtual bool isConnected() const = 0;
+ virtual QString model() const = 0;
+ virtual bool isConnected() const = 0;
/** Indicates if watch is too busy atm and we should limit frame rate. */
- Q_INVOKABLE virtual bool busy() const = 0;
+ virtual bool busy() const = 0;
+
+ virtual QDateTime dateTime() = 0;
+ virtual void setDateTime(const QDateTime& dateTime) = 0;
+
+ virtual void updateNotificationCount(Notification::Type type, int count) = 0;
signals:
void connected();
@@ -33,15 +39,8 @@ signals:
void buttonReleased(int button);
public slots:
- virtual void update(const QList<QRect>& rects) = 0;
- virtual void update(const QRect& rect);
virtual void vibrate(bool on) = 0;
-
-protected:
- QImage _image;
- mutable QPaintEngine* _paintEngine;
-
-friend class WatchPaintEngine;
+ virtual void showNotification(const Notification& n) = 0;
};
}
diff --git a/libsowatch/watchpaintengine.cpp b/libsowatch/watchpaintengine.cpp
index 18cfb60..6c509cb 100644
--- a/libsowatch/watchpaintengine.cpp
+++ b/libsowatch/watchpaintengine.cpp
@@ -6,29 +6,12 @@
using namespace sowatch;
-WatchPaintEngine::WatchPaintEngine(Watch* watch, QImage* image)
+WatchPaintEngine::WatchPaintEngine(Watch* watch)
: QPaintEngine(QPaintEngine::AllFeatures),
_watch(watch), _painter(),
_hasPen(false), _hasBrush(false), _clipEnabled(false)
{
- Q_UNUSED(image);
-}
-
-bool WatchPaintEngine::begin(QPaintDevice *pdev)
-{
- _damaged = QRegion();
- _watch = static_cast<Watch*>(pdev);
-
- return _painter.begin(&_watch->_image);
-}
-bool WatchPaintEngine::end()
-{
- bool ret = _painter.end();
- if (ret) {
- _watch->update(_damaged.rects().toList());
- }
- return ret;
}
void WatchPaintEngine::damageMappedRect(const QRect &r)
@@ -47,7 +30,7 @@ void WatchPaintEngine::damageRect(const QRect &r)
void WatchPaintEngine::damageRect(const QRectF &r)
{
- damageMappedRect(_transform.mapRect(r).toRect());
+ damageMappedRect(_transform.mapRect(r).toAlignedRect());
}
void WatchPaintEngine::damagePenStroke(const QLineF &line)
@@ -57,13 +40,16 @@ void WatchPaintEngine::damagePenStroke(const QLineF &line)
const qreal a = line.angle();
const qreal sn = sinf(a);
const qreal cs = cosf(a);
- const qreal w = _penWidth = 0.0 ? 1.0 : _penWidth;
+ const qreal w = _penWidth == 0.0 ? 1.0 : _penWidth;
const qreal x1 = line.x1();
const qreal x2 = line.x2();
- const qreal y1 = line.x1();
+ const qreal y1 = line.y1();
const qreal y2 = line.y2();
- damageRect(QRectF(x1-(w*sn/2.0f), y1+(w*cs/2.0f), x2+(w*sn/2.0f), y2-(w*cs/2.0f)).normalized());
+ QPointF p1(x1-(w*sn/2.0f), y1+(w*cs/2.0f));
+ QPointF p2(x2+(w*sn/2.0f), y2-(w*cs/2.0f));
+ QRectF r = QRectF(p1, p2).normalized();
+ damageRect(r);
}
void WatchPaintEngine::updateClipRegion(const QRegion& region, Qt::ClipOperation op)
@@ -140,24 +126,22 @@ void WatchPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRec
void WatchPaintEngine::drawPoints(const QPointF *points, int pointCount)
{
- const qreal penWidth = _painter.pen().widthF();
int i;
for (i = 0; i < pointCount; i++) {
const QPointF& p = points[i];
- damageRect(QRect(p.x() - penWidth/2, p.y() - penWidth/2,
- p.x() + penWidth/2, p.y() + penWidth/2));
+ damageRect(QRectF(p.x() - _penWidth/2.0f, p.y() - _penWidth/2.0f,
+ _penWidth, _penWidth));
}
_painter.drawPoints(points, pointCount);
}
void WatchPaintEngine::drawPoints(const QPoint *points, int pointCount)
{
- const qreal penWidth = _painter.pen().widthF();
int i;
for (i = 0; i < pointCount; i++) {
const QPoint& p = points[i];
- damageRect(QRect(p.x() - penWidth/2, p.y() - penWidth/2,
- p.x() + penWidth/2, p.y() + penWidth/2));
+ damageRect(QRect(p.x() - _penWidth/2, p.y() - _penWidth/2,
+ _penWidth, _penWidth));
}
_painter.drawPoints(points, pointCount);
}
@@ -225,8 +209,10 @@ void WatchPaintEngine::drawRects(const QRect *rects, int rectCount)
void WatchPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
{
- const qreal height = textItem.ascent() + textItem.descent();
- damageRect(QRect(p.x(), p.y(), p.x() + textItem.width(), p.y() + height));
+ const qreal ascent = textItem.ascent();
+ const qreal descent = textItem.descent();
+ const qreal w = textItem.width();
+ damageRect(QRect(p.x(), p.y() - ascent, w, ascent + descent));
_painter.drawTextItem(p, textItem);
}
@@ -269,7 +255,7 @@ void WatchPaintEngine::updateState(const QPaintEngineState &state)
}
if (flags & QPaintEngine::DirtyClipPath)
{
- QRegion region = state.clipPath().boundingRect().toRect();
+ QRegion region = state.clipPath().boundingRect().toAlignedRect();
updateClipRegion(region, state.clipOperation());
_painter.setClipPath(state.clipPath(), state.clipOperation());
}
diff --git a/libsowatch/watchpaintengine.h b/libsowatch/watchpaintengine.h
index 14181fa..14d8f61 100644
--- a/libsowatch/watchpaintengine.h
+++ b/libsowatch/watchpaintengine.h
@@ -11,10 +11,7 @@ class Watch;
class WatchPaintEngine : public QPaintEngine
{
public:
- WatchPaintEngine(Watch* watch, QImage* image);
-
- bool begin(QPaintDevice *pdev);
- bool end();
+ WatchPaintEngine(Watch* watch);
void drawEllipse(const QRectF &r);
void drawEllipse(const QRect &r);
diff --git a/libsowatch/watchplugininterface.h b/libsowatch/watchplugininterface.h
index 6b32385..e360dea 100644
--- a/libsowatch/watchplugininterface.h
+++ b/libsowatch/watchplugininterface.h
@@ -1,21 +1,23 @@
#ifndef WATCHPLUGININTERFACE_H
#define WATCHPLUGININTERFACE_H
-#include <QtCore/QObject>
+#include <QtPlugin>
+#include <QtCore/QSettings>
#include <QtCore/QStringList>
+#include "sowatch_global.h"
namespace sowatch
{
class Watch;
-class WatchPluginInterface
+class SOWATCH_EXPORT WatchPluginInterface
{
public:
virtual ~WatchPluginInterface();
virtual QStringList drivers() = 0;
- virtual Watch* getWatch(const QString& driver, const QString& connId, QObject *parent = 0) = 0;
+ virtual Watch* getWatch(const QString& driver, QSettings& settings, QObject *parent = 0) = 0;
};
}
diff --git a/libsowatch/watchserver.cpp b/libsowatch/watchserver.cpp
index ad49995..5ee8a90 100644
--- a/libsowatch/watchserver.cpp
+++ b/libsowatch/watchserver.cpp
@@ -36,6 +36,11 @@ void WatchServer::closeWatchlet()
_currentWatchlet = 0;
}
+void WatchServer::notification(const Notification &n)
+{
+ Q_UNUSED(n);
+}
+
void WatchServer::registerWatchlet(Watchlet *watchlet)
{
Q_ASSERT(watchlet->_server == this);
diff --git a/libsowatch/watchserver.h b/libsowatch/watchserver.h
index 78454d4..f8bed67 100644
--- a/libsowatch/watchserver.h
+++ b/libsowatch/watchserver.h
@@ -4,16 +4,20 @@
#include <QtCore/QObject>
#include <QtCore/QMap>
+#include "sowatch_global.h"
+
namespace sowatch
{
class Watch;
class Watchlet;
+class Notification;
-class WatchServer : public QObject
+class SOWATCH_EXPORT WatchServer : public QObject
{
Q_OBJECT
- Q_PROPERTY(Watch* watch READ watch)
+ Q_PROPERTY(Watch* watch READ watch CONSTANT)
+
public:
explicit WatchServer(Watch* watch, QObject* parent = 0);
@@ -25,6 +29,7 @@ public:
signals:
public slots:
+ void notification(const Notification& n);
protected:
Watch* _watch;
diff --git a/libsowatch/watchsimulator.cpp b/libsowatch/watchsimulator.cpp
index 464f3a5..47496f2 100644
--- a/libsowatch/watchsimulator.cpp
+++ b/libsowatch/watchsimulator.cpp
@@ -4,8 +4,8 @@
using namespace sowatch;
-WatchSimulator::WatchSimulator(const QImage& image, QObject* parent) :
- Watch(image, parent)
+WatchSimulator::WatchSimulator(QObject* parent) :
+ Watch(parent)
{
}
diff --git a/libsowatch/watchsimulator.h b/libsowatch/watchsimulator.h
index 564118c..aa8586d 100644
--- a/libsowatch/watchsimulator.h
+++ b/libsowatch/watchsimulator.h
@@ -12,7 +12,7 @@ class WatchSimulator : public Watch
{
Q_OBJECT
public:
- explicit WatchSimulator(const QImage& image, QObject *parent = 0);
+ explicit WatchSimulator(QObject *parent = 0);
};
}
diff --git a/metawatch/idle_call.bmp b/metawatch/idle_call.bmp
new file mode 100644
index 0000000..2b69eea
--- /dev/null
+++ b/metawatch/idle_call.bmp
Binary files differ
diff --git a/metawatch/idle_gmail.bmp b/metawatch/idle_gmail.bmp
new file mode 100644
index 0000000..fd129b0
--- /dev/null
+++ b/metawatch/idle_gmail.bmp
Binary files differ
diff --git a/metawatch/idle_sms.bmp b/metawatch/idle_sms.bmp
new file mode 100644
index 0000000..095ca62
--- /dev/null
+++ b/metawatch/idle_sms.bmp
Binary files differ
diff --git a/metawatch/metawatch.cpp b/metawatch/metawatch.cpp
index b968fad..e6d8ea6 100644
--- a/metawatch/metawatch.cpp
+++ b/metawatch/metawatch.cpp
@@ -9,6 +9,10 @@ QTM_USE_NAMESPACE
#define SINGLE_LINE_UPDATE 0
+const int MetaWatch::connectRetryTimes[] = {
+ 5, 10, 30, 60, 120, 300
+};
+
const quint8 MetaWatch::bitRevTable[16] = {
0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
};
@@ -71,34 +75,77 @@ const quint16 MetaWatch::crcTable[256] = {
#endif
MetaWatch::MetaWatch(const QBluetoothAddress& address, QObject *parent) :
- Watch(QImage(96, 96, QImage::Format_MonoLSB), parent),
- _socket(new QBluetoothSocket(QBluetoothSocket::RfcommSocket)),
- _sendTimer(new QTimer(this))
+ Watch(parent),
+ _paintEngine(0),
+ _address(address),
+ _socket(0),
+ _connectRetries(0),
+ _connected(false),
+ _connectTimer(new QTimer(this)),
+ _connectAlignedTimer(new QSystemAlignedTimer(this)),
+ _sendTimer(new QTimer(this)),
+ _currentMode(IdleMode),
+ _paintMode(IdleMode)
{
- connect(_socket, SIGNAL(connected()), SLOT(socketConnected()));
- connect(_socket, SIGNAL(disconnected()), SLOT(socketDisconnected()));
- connect(_socket, SIGNAL(readyRead()), SLOT(socketData()));
- connect(_socket, SIGNAL(error(QBluetoothSocket::SocketError)),
- SLOT(socketError(QBluetoothSocket::SocketError)));
- connect(_socket, SIGNAL(stateChanged(QBluetoothSocket::SocketState)),
- SLOT(socketState(QBluetoothSocket::SocketState)));
+ QImage baseImage(screenWidth, screenHeight, QImage::Format_MonoLSB);
+ baseImage.setColor(0, QColor(Qt::white).rgb());
+ baseImage.setColor(1, QColor(Qt::black).rgb());
+ _image[IdleMode] = baseImage;
+ _image[ApplicationMode] = baseImage;
+ _image[NotificationMode] = baseImage;
+
+ _connectTimer->setSingleShot(true);
+ _connectAlignedTimer->setSingleShot(true);
+ connect(_connectTimer, SIGNAL(timeout()), SLOT(retryConnect()));
+ connect(_connectAlignedTimer, SIGNAL(timeout()), SLOT(retryConnect()));
_sendTimer->setInterval(30);
connect(_sendTimer, SIGNAL(timeout()), SLOT(timedSend()));
- _socket->connectToService(address, 1, QIODevice::ReadWrite | QIODevice::Unbuffered);
+ retryConnect();
+}
+
+MetaWatch::~MetaWatch()
+{
+ delete _paintEngine;
}
QPaintEngine* MetaWatch::paintEngine() const
{
if (!_paintEngine) {
- _paintEngine = new MetaWatchPaintEngine(const_cast<MetaWatch*>(this),
- const_cast<QImage*>(&_image));
+ _paintEngine = new MetaWatchPaintEngine(const_cast<MetaWatch*>(this));
}
return _paintEngine;
}
+int MetaWatch::metric(PaintDeviceMetric metric) const
+{
+ switch (metric) {
+ case PdmWidth:
+ return screenWidth;
+ case PdmHeight:
+ return _currentMode == IdleMode ?
+ screenHeight - systemAreaHeight: screenHeight;
+ case PdmWidthMM:
+ return 24;
+ case PdmHeightMM:
+ return _currentMode == IdleMode ? 16 : 24;
+ case PdmNumColors:
+ return 2;
+ case PdmDepth:
+ return 1;
+ case PdmDpiX:
+ case PdmPhysicalDpiX:
+ return 100;
+ case PdmDpiY:
+ case PdmPhysicalDpiY:
+ return 100;
+ }
+
+ return -1;
+}
+
QString MetaWatch::model() const
{
return "metawatch-digital";
@@ -106,41 +153,19 @@ QString MetaWatch::model() const
bool MetaWatch::isConnected() const
{
- return _socket->state() == QBluetoothSocket::ConnectedState;
+ return _connected;
}
bool MetaWatch::busy() const
{
- return _socket->state() != QBluetoothSocket::ConnectedState ||
+ return !_connected ||
+ _socket->state() != QBluetoothSocket::ConnectedState ||
_toSend.size() > 20;
}
-void MetaWatch::update(const QList<QRect> &rects)
-{
- if (_socket->state() != QBluetoothSocket::ConnectedState) return;
- const QRect imageRect = _image.rect();
- QVector<bool> lines(_image.height(), false);
-
- foreach (const QRect& rect, rects) {
- QRect r = rect.intersect(imageRect);
- for (int i = r.top(); i <= r.bottom(); i++) {
- lines[i] = true;
- }
- }
-
- updateLines(ApplicationMode, _image, lines);
- updateDisplay(ApplicationMode);
-}
-
-void MetaWatch::clear(bool white)
-{qDebug() << "MWclear" << white;
- if (_socket->state() != QBluetoothSocket::ConnectedState) return;
- loadTemplate(ApplicationMode, white ? 1 : 0);
-}
-
-void MetaWatch::vibrate(bool on)
+QDateTime MetaWatch::dateTime()
{
-
+ return QDateTime::currentDateTime(); // TODO
}
void MetaWatch::setDateTime(const QDateTime &dateTime)
@@ -149,7 +174,7 @@ void MetaWatch::setDateTime(const QDateTime &dateTime)
const QDate& date = dateTime.date();
const QTime& time = dateTime.time();
- msg.data[0] = date.year() & 0xF00;
+ msg.data[0] = (date.year() & 0xF00) >> 8;
msg.data[1] = date.year() & 0xFF;
msg.data[2] = date.month();
msg.data[3] = date.day();
@@ -163,6 +188,81 @@ void MetaWatch::setDateTime(const QDateTime &dateTime)
send(msg);
}
+void MetaWatch::updateNotificationCount(Notification::Type type, int count)
+{
+ Q_UNUSED(type);
+ Q_UNUSED(count); // TODO
+}
+
+void MetaWatch::vibrate(bool on)
+{
+ Q_UNUSED(on); // TODO
+}
+
+void MetaWatch::showNotification(const Notification &n)
+{
+ Q_UNUSED(n); // TODO
+}
+
+MetaWatch::Mode MetaWatch::currentMode() const
+{
+ return _currentMode;
+}
+
+MetaWatch::Mode MetaWatch::paintTargetMode() const
+{
+ return _paintMode;
+}
+
+QImage* MetaWatch::imageFor(Mode mode)
+{
+ return &_image[mode];
+}
+
+void MetaWatch::update(Mode mode, const QList<QRect> &rects)
+{
+ if (!_connected) return;
+ const QRect clipRect(0, 0, screenWidth, screenHeight);
+ QVector<bool> lines(screenHeight, false);
+
+ foreach (const QRect& rect, rects) {
+ QRect r = rect.intersect(clipRect);
+ for (int i = r.top(); i <= r.bottom(); i++) {
+ lines[i] = true;
+ }
+ }
+
+ updateLines(mode, _image[mode], lines);
+ if (mode == _currentMode) {
+ updateDisplay(mode);
+ }
+}
+
+void MetaWatch::clear(Mode mode, bool black)
+{
+ if (!_connected) return;
+ loadTemplate(mode, black ? 1 : 0);
+}
+
+void MetaWatch::renderIdleScreen()
+{
+ _paintMode = IdleMode;
+ QPainter p(this);
+ p.fillRect(0, 0, screenWidth, screenHeight, Qt::white);
+ p.setPen(QPen(Qt::black, 1.0, Qt::DashLine));
+ p.drawLine(0, systemAreaHeight + 2, screenWidth, systemAreaHeight + 2);
+ p.drawLine(0, systemAreaHeight * 2 + 3, screenWidth, systemAreaHeight * 2 + 3);
+ p.setPen(Qt::black);
+ p.drawText(1, systemAreaHeight + 16, "Space Weather!");
+ QImage idle_mail(QString(":/metawatch/idle_gmail.bmp"));
+ QImage idle_call(QString(":/metawatch/idle_call.bmp"));
+ QImage idle_sms(QString(":/metawatch/idle_sms.bmp"));
+ p.drawImage(4, systemAreaHeight * 2 + 6, idle_mail);
+ p.drawImage(32 + 4, systemAreaHeight * 2 + 6, idle_call);
+ p.drawImage(32 * 2 + 4, systemAreaHeight * 2 + 6, idle_sms);
+ p.drawText(14, 93, "Too many!");
+}
+
quint16 MetaWatch::calcCrc(const QByteArray &data, int size)
{
quint16 remainder = 0xFFFF;
@@ -277,6 +377,13 @@ void MetaWatch::configureWatchMode(Mode mode, int timeout, bool invert)
send(msg);
}
+void MetaWatch::configureIdleSystemArea(bool entireScreen)
+{
+ Message msg(ConfigureIdleBufferSize, QByteArray(26, 0));
+ msg.data[0] = entireScreen ? 1 : 0;
+ send(msg);
+}
+
void MetaWatch::updateDisplay(Mode mode, bool copy)
{
Message msg(UpdateDisplay, QByteArray(),
@@ -305,20 +412,54 @@ void MetaWatch::handleButtonEvent(const Message &msg)
void MetaWatch::socketConnected()
{
- qDebug() << "connected";
- _partialReceived.type = NoMessage;
- _partialReceived.data.clear();
- _buttonState = 0;
- setDateTime(QDateTime::currentDateTime());
- configureWatchMode(ApplicationMode);
- emit connected();
+ if (!_connected) {
+ qDebug() << "connected";
+
+ _connected = true;
+ _connectRetries = 0;
+ _partialReceived.type = NoMessage;
+ _partialReceived.data.clear();
+ _currentMode = IdleMode;
+ _paintMode = IdleMode;
+ _buttonState = 0;
+
+ setDateTime(QDateTime::currentDateTime());
+ configureIdleSystemArea(false);
+ configureWatchMode(ApplicationMode, 240);
+ configureWatchMode(NotificationMode, 30);
+
+ renderIdleScreen();
+
+ emit connected();
+ }
}
void MetaWatch::socketDisconnected()
{
- _toSend.clear();
- _sendTimer->stop();
- emit disconnected();
+ if (_connected) {
+ qDebug() << "disconnected";
+
+ _connected = false;
+ _toSend.clear();
+ _sendTimer->stop();
+
+ emit disconnected();
+ }
+
+ int timeToNextRetry;
+ if (_connectRetries >= connectRetryTimesSize) {
+ timeToNextRetry = connectRetryTimes[connectRetryTimesSize - 1];
+ } else {
+ timeToNextRetry = connectRetryTimes[_connectRetries];
+ _connectRetries++;
+ }
+ qDebug() << "Backing off for " << timeToNextRetry << "seconds for next retry";
+ _connectAlignedTimer->start(timeToNextRetry / 2, timeToNextRetry * 2);
+ if (_connectAlignedTimer->lastError() != QSystemAlignedTimer::NoError) {
+ // I would like to know why QtM couldn't _emulate_ here using a QTimer by itself.
+ qDebug() << "Note: using plain QTimer for retry";
+ _connectTimer->start(timeToNextRetry * 1000);
+ }
}
void MetaWatch::socketData()
@@ -377,6 +518,22 @@ void MetaWatch::socketState(QBluetoothSocket::SocketState error)
qDebug() << "socket is in" << error;
}
+void MetaWatch::retryConnect()
+{
+ delete _socket;
+ _socket = new QBluetoothSocket(QBluetoothSocket::RfcommSocket);
+
+ connect(_socket, SIGNAL(connected()), SLOT(socketConnected()));
+ connect(_socket, SIGNAL(disconnected()), SLOT(socketDisconnected()));
+ connect(_socket, SIGNAL(readyRead()), SLOT(socketData()));
+ connect(_socket, SIGNAL(error(QBluetoothSocket::SocketError)),
+ SLOT(socketError(QBluetoothSocket::SocketError)));
+ connect(_socket, SIGNAL(stateChanged(QBluetoothSocket::SocketState)),
+ SLOT(socketState(QBluetoothSocket::SocketState)));
+
+ _socket->connectToService(_address, 1, QIODevice::ReadWrite | QIODevice::Unbuffered);
+}
+
void MetaWatch::timedSend()
{
if (_toSend.count() > 0) {
@@ -393,6 +550,8 @@ void MetaWatch::realSend(const Message &msg)
QByteArray data;
quint16 crc;
+ Q_ASSERT(_connected && _socket);
+
data.resize(msgSize + 6);
data[0] = 0x01;
data[1] = msgSize + 6;
diff --git a/metawatch/metawatch.h b/metawatch/metawatch.h
index 80a1894..68e24c3 100644
--- a/metawatch/metawatch.h
+++ b/metawatch/metawatch.h
@@ -1,18 +1,22 @@
#ifndef METAWATCH_H
#define METAWATCH_H
-#include <QtConnectivity/QBluetoothAddress>
-#include <QtConnectivity/QBluetoothSocket>
#include <QtCore/QQueue>
#include <QtCore/QTimer>
+#include <QtConnectivity/QBluetoothAddress>
+#include <QtConnectivity/QBluetoothSocket>
+#include <QtSystemInfo/QSystemAlignedTimer>
#include "watch.h"
using QTM_PREPEND_NAMESPACE(QBluetoothSocket);
using QTM_PREPEND_NAMESPACE(QBluetoothAddress);
+using QTM_PREPEND_NAMESPACE(QSystemAlignedTimer);
namespace sowatch
{
+class MetaWatchPaintEngine;
+
class MetaWatch : public Watch
{
Q_OBJECT
@@ -20,17 +24,11 @@ class MetaWatch : public Watch
public:
explicit MetaWatch(const QBluetoothAddress& address, QObject *parent = 0);
+ ~MetaWatch();
- QPaintEngine* paintEngine() const;
-
- QString model() const;
- bool isConnected() const;
- bool busy() const;
- void update(const QList<QRect>& rects);
- void clear(bool white = false);
- void vibrate(bool on);
-
- void setDateTime(const QDateTime& dateTime);
+ static const int screenWidth = 96;
+ static const int screenHeight = 96;
+ static const int systemAreaHeight = 30;
enum MessageType {
NoMessage = 0,
@@ -64,27 +62,62 @@ public:
enum Mode {
IdleMode = 0,
- ApplicationMode = 1
+ ApplicationMode = 1,
+ NotificationMode = 2
};
+ QPaintEngine* paintEngine() const;
+ int metric(PaintDeviceMetric metric) const;
+
+ QString model() const;
+ bool isConnected() const;
+ bool busy() const;
+
+ QDateTime dateTime();
+ void setDateTime(const QDateTime& dateTime);
+
+ void updateNotificationCount(Notification::Type type, int count);
+
+ void vibrate(bool on);
+ void showNotification(const Notification& n);
+
+ Mode currentMode() const;
+ Mode paintTargetMode() const;
+ QImage* imageFor(Mode mode);
+ void clear(Mode mode, bool black = false);
+ void update(Mode mode, const QList<QRect>& rects = QList<QRect>());
+
+ void renderIdleScreen();
+
protected:
+ mutable MetaWatchPaintEngine* _paintEngine;
+ QImage _image[3];
+
+ QBluetoothAddress _address;
QBluetoothSocket* _socket;
+ static const int connectRetryTimesSize = 6;
+ static const int connectRetryTimes[connectRetryTimesSize];
+ short _connectRetries;
+ bool _connected;
+ QTimer* _connectTimer;
+ QSystemAlignedTimer* _connectAlignedTimer;
+
struct Message {
MessageType type;
quint8 options;
QByteArray data;
Message(MessageType ntype = NoMessage, QByteArray ndata = QByteArray(), quint8 noptions = 0) :
type(ntype), options(noptions), data(ndata)
- {
-
- }
+ { }
};
QQueue<Message> _toSend;
QTimer* _sendTimer;
Message _partialReceived;
+ Mode _currentMode;
+ Mode _paintMode;
quint8 _buttonState;
static const quint8 bitRevTable[16];
@@ -98,7 +131,8 @@ protected:
void updateLine(Mode mode, const QImage& image, int line);
void updateLines(Mode mode, const QImage& image, int lineA, int lineB);
void updateLines(Mode mode, const QImage& image, const QVector<bool>& lines);
- void configureWatchMode(Mode mode, int timeout = 10, bool invert = false);
+ void configureWatchMode(Mode mode, int timeout, bool invert = false);
+ void configureIdleSystemArea(bool entireScreen);
void updateDisplay(Mode mode, bool copy = true);
void loadTemplate(Mode mode, int templ);
@@ -111,6 +145,7 @@ protected slots:
void socketData();
void socketError(QBluetoothSocket::SocketError error);
void socketState(QBluetoothSocket::SocketState error);
+ void retryConnect();
void timedSend();
private:
diff --git a/metawatch/metawatch.pro b/metawatch/metawatch.pro
index d8c63c4..fe04b11 100644
--- a/metawatch/metawatch.pro
+++ b/metawatch/metawatch.pro
@@ -6,8 +6,9 @@
TARGET = metawatch
TEMPLATE = lib
+# CONFIG += plugin # Stupid Qt creator doesn't want to deploy plugins
CONFIG += mobility
-MOBILITY += connectivity
+MOBILITY += connectivity systeminfo
SOURCES += metawatchplugin.cpp \
metawatchsimulatorform.cpp \
@@ -24,6 +25,22 @@ HEADERS += metawatchplugin.h \
FORMS += \
metawatchsimulatorform.ui
+RESOURCES += \
+ uires.qrc
+
+OTHER_FILES += \
+ idle_sms.bmp \
+ idle_gmail.bmp \
+ idle_call.bmp
+
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -llibsowatch
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -llibsowatch
+else:symbian: LIBS += -llibsowatch
+else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -llibsowatch
+
+INCLUDEPATH += $$PWD/../libsowatch
+DEPENDPATH += $$PWD/../libsowatch
+
symbian {
MMP_RULES += EXPORTUNFROZEN
TARGET.UID3 = 0xE4DC26B0
@@ -36,18 +53,9 @@ symbian {
unix:!symbian {
maemo5 {
- target.path = /opt/usr/lib
+ target.path = /opt/sowatch/drivers
} else {
- target.path = /usr/lib
+ target.path = /usr/lib/sowatch/drivers
}
INSTALLS += target
}
-
-
-win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -llibsowatch
-else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -llibsowatch
-else:symbian: LIBS += -llibsowatch
-else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -llibsowatch
-
-INCLUDEPATH += $$PWD/../libsowatch
-DEPENDPATH += $$PWD/../libsowatch
diff --git a/metawatch/metawatchpaintengine.cpp b/metawatch/metawatchpaintengine.cpp
index 71ad452..58a7b9d 100644
--- a/metawatch/metawatchpaintengine.cpp
+++ b/metawatch/metawatchpaintengine.cpp
@@ -3,19 +3,37 @@
using namespace sowatch;
-MetaWatchPaintEngine::MetaWatchPaintEngine(MetaWatch* watch, QImage* image) :
- WatchPaintEngine(watch, image), _watch(watch),
- _imageRect(image->rect())
+MetaWatchPaintEngine::MetaWatchPaintEngine(MetaWatch* watch) :
+ WatchPaintEngine(watch), _watch(watch),
+ _imageRect(0, 0, MetaWatch::screenWidth, MetaWatch::screenHeight)
{
}
+bool MetaWatchPaintEngine::begin(QPaintDevice *pdev)
+{
+ _damaged = QRegion();
+ _watch = static_cast<MetaWatch*>(pdev);
+ _mode = _watch->paintTargetMode();
+
+ return _painter.begin(_watch->imageFor(_mode));
+}
+
+bool MetaWatchPaintEngine::end()
+{
+ bool ret = _painter.end();
+ if (ret) {
+ _watch->update(_mode, _damaged.rects().toList());
+ }
+ return ret;
+}
+
void MetaWatchPaintEngine::drawRects(const QRectF *rects, int rectCount)
{
int i;
for (i = 0; i < rectCount; i++) {
const QRectF& r = rects[i];
if (_hasBrush && fillsEntireImage(r.toRect()) && (_isBrushBlack | _isBrushWhite)) {
- _watch->clear(_isBrushWhite);
+ _watch->clear(_mode, _isBrushBlack);
_damaged = QRegion();
continue;
}
@@ -38,7 +56,7 @@ void MetaWatchPaintEngine::drawRects(const QRect *rects, int rectCount)
for (i = 0; i < rectCount; i++) {
const QRect& r = rects[i];
if (_hasBrush && fillsEntireImage(r) && (_isBrushBlack | _isBrushWhite)) {
- _watch->clear(_isBrushWhite);
+ _watch->clear(_mode, _isBrushBlack);
_damaged = QRegion();
continue;
}
diff --git a/metawatch/metawatchpaintengine.h b/metawatch/metawatchpaintengine.h
index efc3d6e..c3b7466 100644
--- a/metawatch/metawatchpaintengine.h
+++ b/metawatch/metawatchpaintengine.h
@@ -2,18 +2,20 @@
#define METAWATCHPAINTENGINE_H
#include <QtCore/QRect>
+#include "metawatch.h"
#include "watchpaintengine.h"
namespace sowatch
{
-class MetaWatch;
-
/** This WatchPaintEngine accelerates fillRects by using the MetaWatch's template command. */
class MetaWatchPaintEngine : public WatchPaintEngine
{
public:
- explicit MetaWatchPaintEngine(MetaWatch* watch, QImage* image);
+ explicit MetaWatchPaintEngine(MetaWatch* watch);
+
+ bool begin(QPaintDevice *pdev);
+ bool end();
void drawRects(const QRectF *rects, int rectCount);
void drawRects(const QRect *rects, int rectCount);
@@ -24,6 +26,7 @@ protected:
bool fillsEntireImage(const QRect& rect);
MetaWatch* _watch;
+ MetaWatch::Mode _mode;
QRect _imageRect;
bool _isBrushBlack;
bool _isBrushWhite;
diff --git a/metawatch/metawatchplugin.cpp b/metawatch/metawatchplugin.cpp
index e5eaabf..e56d6db 100644
--- a/metawatch/metawatchplugin.cpp
+++ b/metawatch/metawatchplugin.cpp
@@ -1,8 +1,10 @@
+#include <QtConnectivity/QBluetoothAddress>
#include "metawatch.h"
#include "metawatchsimulator.h"
#include "metawatchplugin.h"
using namespace sowatch;
+QTM_USE_NAMESPACE
MetaWatchPlugin::~MetaWatchPlugin()
{
@@ -17,13 +19,17 @@ QStringList MetaWatchPlugin::drivers()
return d;
}
-Watch* MetaWatchPlugin::getWatch(const QString& driver, const QString& connId, QObject *parent)
+Watch* MetaWatchPlugin::getWatch(const QString& driver, QSettings& settings, QObject *parent)
{
if (driver == "metawatch-digital") {
- return new MetaWatch(QBluetoothAddress(connId), parent);
+ QBluetoothAddress address(settings.value("address").toString());
+ return new MetaWatch(address, parent);
} else if (driver == "metawatch-digital-sim") {
- return new MetaWatchSimulator(parent);
+ //return new MetaWatchSimulator(parent);
+ return 0;
} else {
return 0;
}
}
+
+Q_EXPORT_PLUGIN2(metawatch, MetaWatchPlugin)
diff --git a/metawatch/metawatchplugin.h b/metawatch/metawatchplugin.h
index d0e7c91..9662ec0 100644
--- a/metawatch/metawatchplugin.h
+++ b/metawatch/metawatchplugin.h
@@ -8,13 +8,13 @@ namespace sowatch
class MetaWatchPlugin : public QObject, public WatchPluginInterface {
Q_OBJECT
- Q_INTERFACES(WatchPluginInterface)
+ Q_INTERFACES(sowatch::WatchPluginInterface)
public:
~MetaWatchPlugin();
virtual QStringList drivers();
- virtual Watch* getWatch(const QString& driver, const QString& connId, QObject *parent = 0);
+ virtual Watch* getWatch(const QString& driver, QSettings& settings, QObject *parent = 0);
};
}
diff --git a/metawatch/metawatchsimulator.cpp b/metawatch/metawatchsimulator.cpp
index 11b938a..57a4f0c 100644
--- a/metawatch/metawatchsimulator.cpp
+++ b/metawatch/metawatchsimulator.cpp
@@ -9,7 +9,8 @@
using namespace sowatch;
MetaWatchSimulator::MetaWatchSimulator(QObject *parent) :
- WatchSimulator(QImage(96, 96, QImage::Format_Mono), parent),
+ WatchSimulator(parent),
+ _image(96, 96, QImage::Format_Mono),
_screen(96, 96),
_form(new MetaWatchSimulatorForm),
_nextFrame(QTime::currentTime())
diff --git a/metawatch/metawatchsimulator.h b/metawatch/metawatchsimulator.h
index 674c3c6..38391d0 100644
--- a/metawatch/metawatchsimulator.h
+++ b/metawatch/metawatchsimulator.h
@@ -22,6 +22,7 @@ public:
void vibrate(bool on);
protected:
+ QImage _image;
QPixmap _screen;
MetaWatchSimulatorForm* _form;
QTime _nextFrame;
diff --git a/metawatch/uires.qrc b/metawatch/uires.qrc
new file mode 100644
index 0000000..4be7fc8
--- /dev/null
+++ b/metawatch/uires.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/metawatch">
+ <file>idle_call.bmp</file>
+ <file>idle_gmail.bmp</file>
+ <file>idle_sms.bmp</file>
+ </qresource>
+</RCC>
diff --git a/qtc_packaging/debian_harmattan/changelog b/qtc_packaging/debian_harmattan/changelog
index e199d64..0128649 100644
--- a/qtc_packaging/debian_harmattan/changelog
+++ b/qtc_packaging/debian_harmattan/changelog
@@ -1,4 +1,4 @@
-sowatch (0.0.1) unstable; urgency=low
+sowatch (0.1.1) unstable; urgency=low
* Initial Release.
diff --git a/qtc_packaging/debian_harmattan/control b/qtc_packaging/debian_harmattan/control
index b43216c..fd0b257 100644
--- a/qtc_packaging/debian_harmattan/control
+++ b/qtc_packaging/debian_harmattan/control
@@ -9,6 +9,6 @@ Homepage: <insert the upstream URL, if relevant>
Package: sowatch
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: <insert up to 60 chars description>
+Description: Bluetooth smartwatch manager
<insert long description, indented with spaces>
-XSBC-Maemo-Display-Name: sowatch
+XSBC-Maemo-Display-Name: Smart Open Watch
diff --git a/sowatch.pro b/sowatch.pro
index 75d1a31..d32b0da 100644
--- a/sowatch.pro
+++ b/sowatch.pro
@@ -1,6 +1,8 @@
TEMPLATE = subdirs
-SUBDIRS = libsowatch sowsim \
- metawatch
+SUBDIRS = libsowatch \
+ metawatch \
+ sowatchd \
+ sowsim
OTHER_FILES += \
qtc_packaging/debian_harmattan/rules \
@@ -14,3 +16,7 @@ OTHER_FILES += \
+
+
+
+
diff --git a/sowatch.pro.user b/sowatch.pro.user
index 123705f..fe14858 100644
--- a/sowatch.pro.user
+++ b/sowatch.pro.user
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by Qt Creator 2.3.0, 2011-09-17T03:57:54. -->
+<!-- Written by Qt Creator 2.3.0, 2011-09-18T04:25:17. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
- <value type="int">0</value>
+ <value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
@@ -87,9 +87,9 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
- <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
- <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
- <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">1</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.gdb</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
@@ -203,7 +203,46 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
- <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Create tarball</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">MaemoTarPackageCreationStep</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy tarball via SFTP upload</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">MaemoUploadAndInstallTarPackageStep</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedFiles">
+ <value type="QString">/mnt/Fuentes/Javier/Maemo/qt/sowatch-build-desktop-debug/sowatch.tar</value>
+ <value type="QString">/mnt/Fuentes/Javier/Maemo/qt/sowatch-build-desktop-release/sowatch.tar</value>
+ </valuelist>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedHosts">
+ <value type="QString">localhost</value>
+ <value type="QString">localhost</value>
+ </valuelist>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedRemotePaths">
+ <value type="QString"></value>
+ <value type="QString"></value>
+ </valuelist>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedTimes">
+ <value type="QDateTime">2011-09-18T04:20:07</value>
+ <value type="QDateTime">2011-09-17T20:53:24</value>
+ </valuelist>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build Tarball and Install to Linux Host</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">DeployToGenericLinux</value>
+ <value type="qulonglong" key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId">3</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
@@ -282,7 +321,85 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
</valuemap>
- <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">sowatchd</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration</value>
+ <value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">sowatchd/sowatchd.pro</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
+ <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
</valuemap>
</data>
<data>
@@ -293,7 +410,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.HarmattanDeviceTarget</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
- <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">Qt4ProjectManager.ToolChain.Maemo:/home/javier/opt/QtSDK/Madde/targets/harmattan-nokia-meego-api/bin/gcc.arm-linux-generic-elf-32bit./home/javier/opt/QtSDK/pythongdb/gdb</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
@@ -425,7 +542,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build Debian Package and Install to Harmattan Device</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">DeployToHarmattan</value>
- <value type="qulonglong" key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId">0</value>
+ <value type="qulonglong" key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId">2</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
@@ -505,7 +622,84 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
</valuemap>
- <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">sowatchd (remote)</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MaemoRunConfiguration</value>
+ <value type="QString" key="Qt4ProjectManager.MaemoRunConfiguration.Arguments"></value>
+ <value type="int" key="Qt4ProjectManager.MaemoRunConfiguration.BaseEnvironmentBase">1</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.ExportedLocalDirs"/>
+ <value type="QString" key="Qt4ProjectManager.MaemoRunConfiguration.ProFile">sowatchd/sowatchd.pro</value>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.RemoteMountPoints"/>
+ <valuelist type="QVariantList" key="Qt4ProjectManager.MaemoRunConfiguration.UserEnvironmentChanges"/>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
</valuemap>
</data>
<data>
diff --git a/sowatchd/daemon.cpp b/sowatchd/daemon.cpp
new file mode 100644
index 0000000..a2d7b5a
--- /dev/null
+++ b/sowatchd/daemon.cpp
@@ -0,0 +1,83 @@
+#include <QtCore/QDebug>
+#include <QtCore/QPluginLoader>
+#include <QtCore/QSettings>
+#include <QtCore/QDir>
+#include <sowatch.h>
+#include "daemon.h"
+
+using namespace sowatch;
+
+Daemon::Daemon(QObject *parent) :
+ QObject(parent)
+{
+ loadDrivers();
+ loadWatches();
+ loadWatchlets();
+}
+
+void Daemon::loadDrivers()
+{
+ QDir dir(SOWATCH_DRIVERS_DIR);
+ foreach (QString file, dir.entryList(QDir::Files)) {
+ QPluginLoader loader(dir.absoluteFilePath(file));
+ QObject *pluginObj = loader.instance();
+ if (pluginObj) {
+ WatchPluginInterface *plugin = qobject_cast<WatchPluginInterface*>(pluginObj);
+ if (plugin) {
+ QStringList drivers = plugin->drivers();
+ foreach (const QString& driver, drivers) {
+ _drivers[driver] = plugin;
+ }
+ }
+ } else {
+ qWarning() << "Invalid plugin" << file;
+ }
+ }
+
+ qDebug() << "loaded drivers" << _drivers.keys();
+}
+
+void Daemon::loadWatches()
+{
+ QSettings settings;
+ int size = settings.beginReadArray("watches");
+
+ for (int i = 0; i < size; i++) {
+ settings.setArrayIndex(i);
+ QString driver = settings.value("driver").toString().toLower();
+ WatchPluginInterface *plugin = _drivers[driver];
+ if (plugin) {
+ Watch *watch = plugin->getWatch(driver, settings, this);
+ if (watch) {
+ _watches.append(watch);
+ } else {
+ qWarning() << "Driver" << driver << "refused to getWatch";
+ }
+ } else {
+ qWarning() << "Invalid driver" << driver;
+ }
+ }
+
+ settings.endArray();
+ qDebug() << "handling" << _watches.size() << "watches";
+}
+
+void Daemon::loadWatchlets()
+{
+#if 0
+ QDir dir(SOWATCH_WATCHLETS_DIR);
+ foreach (QString file, dir.entryList(QDir::Files)) {
+ QPluginLoader loader(dir.absoluteFilePath(file));
+ QObject *pluginObj = loader.instance();
+ if (pluginObj) {
+ WatchPluginInterface *plugin = qobject_cast<WatchPluginInterface*>(pluginObj);
+ if (plugin) {
+ QStringList drivers = plugin->drivers();
+ foreach (const QString& driver, drivers) {
+ _drivers[driver] = plugin;
+ }
+ }
+ }
+ }
+#endif
+}
diff --git a/sowatchd/daemon.h b/sowatchd/daemon.h
new file mode 100644
index 0000000..9346a41
--- /dev/null
+++ b/sowatchd/daemon.h
@@ -0,0 +1,30 @@
+#ifndef WATCHDAEMON_H
+#define WATCHDAEMON_H
+
+#include <QtCore/QObject>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class Daemon : public QObject
+{
+ Q_OBJECT
+public:
+ explicit Daemon(QObject *parent = 0);
+
+protected:
+ QMap<QString, WatchPluginInterface*> _drivers;
+ QList<Watch*> _watches;
+
+ void loadDrivers();
+ void loadWatches();
+ void loadWatchlets();
+};
+
+}
+
+#endif // WATCHDAEMON_H
diff --git a/sowatchd/main.cpp b/sowatchd/main.cpp
new file mode 100644
index 0000000..0d7abb9
--- /dev/null
+++ b/sowatchd/main.cpp
@@ -0,0 +1,20 @@
+#include <QtGui/QApplication>
+
+#include <sowatch.h>
+#include "daemon.h"
+
+using namespace sowatch;
+
+static Daemon* d;
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ QApplication::setOrganizationDomain("com.javispedro.sowatch");
+ QApplication::setOrganizationName("sowatch");
+ QApplication::setApplicationName("sowatchd");
+
+ d = new Daemon();
+
+ return a.exec();
+}
diff --git a/sowatchd/sowatchd.pro b/sowatchd/sowatchd.pro
new file mode 100644
index 0000000..1c09046
--- /dev/null
+++ b/sowatchd/sowatchd.pro
@@ -0,0 +1,38 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2011-09-17T04:55:26
+#
+#-------------------------------------------------
+
+TEMPLATE = app
+
+TARGET = sowatchd
+
+QT += core gui
+CONFIG += console
+CONFIG -= app_bundle
+
+SOURCES += main.cpp \
+ daemon.cpp
+
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -llibsowatch
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -llibsowatch
+else:symbian: LIBS += -llibsowatch
+else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -llibsowatch
+
+INCLUDEPATH += $$PWD/../libsowatch
+DEPENDPATH += $$PWD/../libsowatch
+
+unix {
+ maemo5 {
+ target.path = /opt/sowatch
+ } else {
+ target.path = /usr/bin
+ }
+ INSTALLS += target
+}
+
+HEADERS += \
+ daemon.h
+
+
diff --git a/sowsim/sowsim.pro b/sowsim/sowsim.pro
index bd8065e..576479b 100644
--- a/sowsim/sowsim.pro
+++ b/sowsim/sowsim.pro
@@ -12,11 +12,6 @@ QT += core
SOURCES += main.cpp
-unix:!symbian:!maemo5:isEmpty(MEEGO_VERSION_MAJOR) {
- target.path = /opt/maemo/usr/bin
- INSTALLS += target
-}
-
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -llibsowatch
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -llibsowatch
else:symbian: LIBS += -llibsowatch
@@ -24,3 +19,12 @@ else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -llibsowatch
INCLUDEPATH += $$PWD/../libsowatch
DEPENDPATH += $$PWD/../libsowatch
+
+unix {
+ maemo5 {
+ target.path = /opt/sowatch
+ } else {
+ target.path = /usr/bin
+ }
+ INSTALLS += target
+}