summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2015-06-19 13:23:55 +0200
committerTomasz Sterna <tomek@xiaoka.com>2015-06-19 13:23:55 +0200
commit98aaa3a2292989f05f5c3e683e2dd4f20bb145e3 (patch)
tree505524dca0466930ec0a839e75476dc8c8de1ee9
parent231462ccfe9fbc25fcc44a4ef128a174329b1901 (diff)
Notifications debugging via magic cookies
-rw-r--r--app/pebbledinterface.cpp4
-rw-r--r--app/pebbledinterface.h2
-rw-r--r--app/qml/pages/WatchPage.qml41
-rw-r--r--daemon/manager.cpp30
-rw-r--r--daemon/manager.h3
5 files changed, 76 insertions, 4 deletions
diff --git a/app/pebbledinterface.cpp b/app/pebbledinterface.cpp
index 84a4ae2..1fb0cd1 100644
--- a/app/pebbledinterface.cpp
+++ b/app/pebbledinterface.cpp
@@ -175,10 +175,10 @@ QString PebbledInterface::appUuid() const
return watch->appUuid();
}
-void PebbledInterface::ping()
+void PebbledInterface::ping(uint cookie)
{
qDebug() << Q_FUNC_INFO;
- watch->Ping(66);
+ watch->Ping(cookie);
}
void PebbledInterface::time()
diff --git a/app/pebbledinterface.h b/app/pebbledinterface.h
index 281ada7..f0b3619 100644
--- a/app/pebbledinterface.h
+++ b/app/pebbledinterface.h
@@ -63,7 +63,7 @@ signals:
public slots:
void setEnabled(bool);
void setActive(bool);
- void ping();
+ void ping(uint cookie = 66);
void time();
void disconnect();
void reconnect();
diff --git a/app/qml/pages/WatchPage.qml b/app/qml/pages/WatchPage.qml
index 730f850..3f5a5d6 100644
--- a/app/qml/pages/WatchPage.qml
+++ b/app/qml/pages/WatchPage.qml
@@ -1,12 +1,19 @@
import QtQuick 2.0
import QtQml 2.1
import Sailfish.Silica 1.0
+import org.nemomobile.configuration 1.0
Page {
id: watchPage
property bool firmwareVersionOK: app.firmwareVersion && app.firmwareVersion.indexOf("v1.") !== 0
+ ConfigurationGroup {
+ id: settings
+ path: "/org/pebbled/settings"
+ property bool debug
+ }
+
SilicaFlickable {
id: flickable
anchors.fill: parent
@@ -48,6 +55,40 @@ Page {
onClicked: pebbled.time()
}
}
+ Row {
+ anchors {
+ left: parent.left
+ right: parent.right
+ margins: Theme.paddingLarge
+ }
+
+ visible: settings.debug
+ Button {
+ text: qsTr("SMS")
+ width: parent.width / 5
+ onClicked: pebbled.ping(128)
+ }
+ Button {
+ text: qsTr("E-Mail")
+ width: parent.width / 5
+ onClicked: pebbled.ping(129)
+ }
+ Button {
+ text: qsTr("FB")
+ width: parent.width / 5
+ onClicked: pebbled.ping(130)
+ }
+ Button {
+ text: qsTr("Twt")
+ width: parent.width / 5
+ onClicked: pebbled.ping(131)
+ }
+ Button {
+ text: qsTr("Music")
+ width: parent.width / 5
+ onClicked: pebbled.ping(132)
+ }
+ }
Item {
width: parent.width
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index f9bd7be..b02264e 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -259,6 +259,36 @@ void Manager::applyProfile()
}
}
+void Manager::ping(uint val)
+{
+ qCDebug(l) << "ping" << val;
+
+ if (settings->property("debug").toBool()) {
+ // magic here!
+ // I do not want to add specific debugging methods to pebbled
+ // so just provide some magic Ping() method handling here :-)
+ switch (val) {
+ case 128:
+ watch->sendSMSNotification("SMS", "lorem ipsum");
+ return;
+ case 129:
+ watch->sendEmailNotification("e-mail", "lorem ipsum", "subject");
+ return;
+ case 130:
+ watch->sendFacebookNotification("Facebook", "lorem ipsum");
+ return;
+ case 131:
+ watch->sendTwitterNotification("Twitter", "lorem ipsum");
+ return;
+ case 132:
+ watch->sendMusicNowPlaying("artist", "album", "track name");
+ return;
+ }
+ }
+
+ watch->ping(val);
+}
+
void Manager::transliterateMessage(const QString &text)
{
if (transliterator.isNull()) {
diff --git a/daemon/manager.h b/daemon/manager.h
index a605ed1..e3143b1 100644
--- a/daemon/manager.h
+++ b/daemon/manager.h
@@ -70,6 +70,7 @@ protected:
public slots:
void applyProfile();
+ void ping(uint val);
private slots:
void onSettingChanged(const QString &key);
@@ -125,7 +126,7 @@ public:
public slots:
inline void Disconnect() { manager()->watch->disconnect(); }
inline void Reconnect() { manager()->watch->connect(); }
- inline void Ping(uint val) { manager()->watch->ping(val); }
+ inline void Ping(uint val) { manager()->ping(val); }
inline void SyncTime() { manager()->watch->time(); }
inline void LaunchApp(const QString &uuid) { manager()->appmsg->launchApp(uuid); }