diff options
Diffstat (limited to 'liveview')
-rw-r--r-- | liveview/liveview.cpp | 93 | ||||
-rw-r--r-- | liveview/liveview.h | 52 | ||||
-rw-r--r-- | liveview/liveview.pro | 39 | ||||
-rw-r--r-- | liveview/liveviewplugin.cpp | 45 | ||||
-rw-r--r-- | liveview/liveviewplugin.h | 25 | ||||
-rw-r--r-- | liveview/liveviewscanner.cpp | 26 | ||||
-rw-r--r-- | liveview/liveviewscanner.h | 21 |
7 files changed, 301 insertions, 0 deletions
diff --git a/liveview/liveview.cpp b/liveview/liveview.cpp new file mode 100644 index 0000000..b6644d8 --- /dev/null +++ b/liveview/liveview.cpp @@ -0,0 +1,93 @@ +#include "liveview.h" + +using namespace sowatch; +QTM_USE_NAMESPACE + +LiveView::LiveView(ConfigKey* settings, QObject* parent) : + BluetoothWatch(QBluetoothAddress(settings->value("address").toString()), parent), + _settings(settings->getSubkey(QString(), this)) +{ + +} + +QPaintEngine* LiveView::paintEngine() const +{ + return 0; // TODO +} + +int LiveView::metric(PaintDeviceMetric metric) const +{ + return 0; // TODO +} + +QString LiveView::model() const +{ + return "liveview"; +} + +QStringList LiveView::buttons() const +{ + return QStringList(); +} + +bool LiveView::isConnected() const +{ + return false; +} + +bool LiveView::busy() const +{ + return false; // TODO +} + +void LiveView::setDateTime(const QDateTime& dateTime) +{ + +} +void LiveView::queryDateTime() +{ + +} +QDateTime LiveView::dateTime() const +{ + return QDateTime::currentDateTime(); // TODO +} + +void LiveView::queryBatteryLevel() +{ + +} +int LiveView::batteryLevel() const +{ + return 0; // TODO +} + +void LiveView::queryCharging() +{ + +} + +bool LiveView::charging() const +{ + return false; // TODO +} + +void LiveView::displayIdleScreen() +{ + +} + +void LiveView::displayNotification(Notification *notification) +{ + +} + +void LiveView::displayApplication() +{ + +} + +void LiveView::vibrate(int msecs) +{ + +} diff --git a/liveview/liveview.h b/liveview/liveview.h new file mode 100644 index 0000000..39b1b92 --- /dev/null +++ b/liveview/liveview.h @@ -0,0 +1,52 @@ +#ifndef LIVEVIEW_H +#define LIVEVIEW_H + +#include <sowatch.h> +#include <sowatchbt.h> + +namespace sowatch +{ + +class LiveView : public BluetoothWatch +{ + Q_OBJECT + +public: + explicit LiveView(ConfigKey *settings, QObject *parent = 0); + ~LiveView(); + + QPaintEngine* paintEngine() const; + int metric(PaintDeviceMetric metric) const; + + QString model() const; + QStringList buttons() const; + bool isConnected() const; + bool busy() const; + + void setDateTime(const QDateTime& dateTime); + void queryDateTime(); + QDateTime dateTime() const; + + void queryBatteryLevel(); + int batteryLevel() const; + + void queryCharging(); + bool charging() const; + + void displayIdleScreen(); + void displayNotification(Notification *notification); + void displayApplication(); + + void vibrate(int msecs); + +protected: + void setupBluetoothWatch(); + void desetupBluetoothWatch(); + +private: + ConfigKey *_settings; +}; + +} + +#endif // LIVEVIEW_H diff --git a/liveview/liveview.pro b/liveview/liveview.pro new file mode 100644 index 0000000..9b949d7 --- /dev/null +++ b/liveview/liveview.pro @@ -0,0 +1,39 @@ +TARGET = liveviewdriver +TEMPLATE = lib +CONFIG += plugin +QT += gui + +# Qt Mobility 1.2 +maemo5 { + CONFIG += mobility12 +} else { + CONFIG += mobility +} +MOBILITY += connectivity systeminfo + +SOURCES += liveviewplugin.cpp \ + liveviewscanner.cpp \ + liveview.cpp +HEADERS += liveviewplugin.h \ + liveviewscanner.h \ + liveview.h + +LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch +INCLUDEPATH += $$PWD/../libsowatch +DEPENDPATH += $$PWD/../libsowatch + +LIBS += -L$$OUT_PWD/../libsowatchbt/ -lsowatchbt +INCLUDEPATH += $$PWD/../libsowatchbt +DEPENDPATH += $$PWD/../libsowatchbt + +!isEmpty(MEEGO_VERSION_MAJOR)|maemo5 { + QMAKE_RPATHDIR += /opt/sowatch/lib + target.path = /opt/sowatch/lib/drivers + res_files.path = /opt/sowatch/share/metawatch + qml_files.path = /opt/sowatch/qml +} else { + target.path = /usr/lib/sowatch/drivers + res_files.path = /usr/share/sowatch/metawatch + qml_files.path = /usr/share/sowatch/qml +} +INSTALLS += target diff --git a/liveview/liveviewplugin.cpp b/liveview/liveviewplugin.cpp new file mode 100644 index 0000000..6ad6f7f --- /dev/null +++ b/liveview/liveviewplugin.cpp @@ -0,0 +1,45 @@ +#include <QtConnectivity/QBluetoothAddress> + +#include "liveview.h" +#include "liveviewscanner.h" +#include "liveviewplugin.h" + +using namespace sowatch; +QTM_USE_NAMESPACE + +LiveViewPlugin::LiveViewPlugin() +{ +} + +LiveViewPlugin::~LiveViewPlugin() +{ + +} + +QStringList LiveViewPlugin::drivers() +{ + QStringList d; + d << "livewview"; + return d; +} + +WatchScanner* LiveViewPlugin::getScanner(QObject *parent) +{ + return new LiveViewScanner(parent); +} + +QUrl LiveViewPlugin::getConfigQmlUrl(const QString &driver) +{ + return QUrl(); +} + +Watch* LiveViewPlugin::getWatch(const QString& driver, ConfigKey* settings, QObject *parent) +{ + if (driver == "liveview") { + return new LiveView(settings, parent); + } else { + return 0; + } +} + +Q_EXPORT_PLUGIN2(liveview, LiveViewPlugin) diff --git a/liveview/liveviewplugin.h b/liveview/liveviewplugin.h new file mode 100644 index 0000000..eb55249 --- /dev/null +++ b/liveview/liveviewplugin.h @@ -0,0 +1,25 @@ +#ifndef LIVEVIEWPLUGIN_H +#define LIVEVIEWPLUGIN_H + +#include <sowatch.h> + +namespace sowatch +{ + +class LiveViewPlugin : public QObject, public WatchPluginInterface { + Q_OBJECT + Q_INTERFACES(sowatch::WatchPluginInterface) + +public: + LiveViewPlugin(); + ~LiveViewPlugin(); + + QStringList drivers(); + WatchScanner* getScanner(QObject *parent); + QUrl getConfigQmlUrl(const QString &driver); + Watch* getWatch(const QString& driver, ConfigKey *settings, QObject *parent); +}; + +} + +#endif // LIVEVIEWPLUGIN_H diff --git a/liveview/liveviewscanner.cpp b/liveview/liveviewscanner.cpp new file mode 100644 index 0000000..3aee19d --- /dev/null +++ b/liveview/liveviewscanner.cpp @@ -0,0 +1,26 @@ +#include <QtConnectivity/QBluetoothDeviceInfo> +#include <QtConnectivity/QBluetoothAddress> + +#include "liveviewscanner.h" + +QTM_USE_NAMESPACE +using namespace sowatch; + +LiveViewScanner::LiveViewScanner(QObject *parent) : + BluetoothWatchScanner(parent) +{ + setUuidFilter(QBluetoothUuid::SerialPort); +} + +void LiveViewScanner::handleDiscoveredService(const QBluetoothServiceInfo &info) +{ + const QBluetoothDeviceInfo dev = info.device(); + QString deviceName = dev.name(); + if (deviceName == "LiveView") { + QVariantMap foundInfo; + foundInfo["driver"] = QString("liveview"); + foundInfo["address"] = dev.address().toString(); + foundInfo["name"] = deviceName; + emit watchFound(foundInfo); + } +} diff --git a/liveview/liveviewscanner.h b/liveview/liveviewscanner.h new file mode 100644 index 0000000..ecd182c --- /dev/null +++ b/liveview/liveviewscanner.h @@ -0,0 +1,21 @@ +#ifndef LIVEVIEWSCANNER_H +#define LIVEVIEWSCANNER_H + +#include <sowatch.h> +#include <sowatchbt.h> + +namespace sowatch +{ + +class LiveViewScanner : public BluetoothWatchScanner +{ + Q_OBJECT +public: + explicit LiveViewScanner(QObject *parent = 0); + + void handleDiscoveredService(const QBluetoothServiceInfo &info); +}; + +} + +#endif // LIVEVIEWSCANNER_H |