diff options
| -rw-r--r-- | app/pebbledinterface.cpp | 4 | ||||
| -rw-r--r-- | app/pebbledinterface.h | 2 | ||||
| -rw-r--r-- | app/qml/pages/AboutPage.qml | 16 | ||||
| -rw-r--r-- | app/qml/pages/ManagerPage.qml | 2 | ||||
| -rw-r--r-- | app/qml/pages/WatchPage.qml | 41 | ||||
| -rw-r--r-- | app/translations/pebble-es.ts | 54 | ||||
| -rw-r--r-- | app/translations/pebble-pl.ts | 56 | ||||
| -rw-r--r-- | app/translations/pebble-zh_CN.ts | 40 | ||||
| -rw-r--r-- | app/translations/pebble.ts | 40 | ||||
| -rw-r--r-- | daemon/daemon.cpp | 12 | ||||
| -rw-r--r-- | daemon/manager.cpp | 32 | ||||
| -rw-r--r-- | daemon/manager.h | 3 | ||||
| -rw-r--r-- | daemon/settings.h | 6 | ||||
| -rw-r--r-- | daemon/voicecallhandler.cpp | 30 | ||||
| -rw-r--r-- | daemon/voicecallhandler.h | 4 | ||||
| -rw-r--r-- | daemon/watchconnector.cpp | 66 | ||||
| -rw-r--r-- | daemon/watchconnector.h | 18 | ||||
| -rw-r--r-- | rpm/pebble.changes | 6 | ||||
| -rw-r--r-- | rpm/pebble.spec | 2 | ||||
| -rw-r--r-- | rpm/pebble.yaml | 2 |
20 files changed, 300 insertions, 136 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/AboutPage.qml b/app/qml/pages/AboutPage.qml index fec0fb5..a674b65 100644 --- a/app/qml/pages/AboutPage.qml +++ b/app/qml/pages/AboutPage.qml @@ -1,10 +1,17 @@ import QtQuick 2.0 import QtQml 2.1 import Sailfish.Silica 1.0 +import org.nemomobile.configuration 1.0 Page { id: page + ConfigurationGroup { + id: settings + path: "/org/pebbled/settings" + property bool debug + } + SilicaFlickable { id: flickable anchors.fill: parent @@ -130,6 +137,15 @@ Page { } onClicked: Qt.openUrlExternally("mailto:bugs@xiaoka.com?subject=pebbled issue&body=describe your issue here") } + TextSwitch { + text: qsTr("Debug Mode") + description: qsTr("Enable daemon and app debugging") + checked: settings.debug + automaticCheck: true + onClicked: { + settings.debug = !settings.debug; + } + } } } } diff --git a/app/qml/pages/ManagerPage.qml b/app/qml/pages/ManagerPage.qml index a69bc89..8ff0db2 100644 --- a/app/qml/pages/ManagerPage.qml +++ b/app/qml/pages/ManagerPage.qml @@ -147,7 +147,7 @@ Page { } TextSwitch { text: qsTr("Control main volume") - description: qsTr("Pebble music volume buttons change the main phone volume directly instead of through the music player.") + description: qsTr("Pebble music volume buttons change the main phone volume directly instead of through the music player") checked: settings.useSystemVolume automaticCheck: true onClicked: { 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/app/translations/pebble-es.ts b/app/translations/pebble-es.ts index 0775925..6b667e4 100644 --- a/app/translations/pebble-es.ts +++ b/app/translations/pebble-es.ts @@ -4,55 +4,65 @@ <context> <name>AboutPage</name> <message> - <location filename="../qml/pages/AboutPage.qml" line="24"/> + <location filename="../qml/pages/AboutPage.qml" line="31"/> <source>Version</source> <translation>Versión</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="36"/> + <location filename="../qml/pages/AboutPage.qml" line="43"/> <source>All Rights Reserved.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="60"/> + <location filename="../qml/pages/AboutPage.qml" line="67"/> <source>Support</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="74"/> + <location filename="../qml/pages/AboutPage.qml" line="81"/> <source>Your donations help justify development time.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="87"/> + <location filename="../qml/pages/AboutPage.qml" line="94"/> <source>Thank you for your support!!!</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="90"/> + <location filename="../qml/pages/AboutPage.qml" line="97"/> <source>PayPal Donate</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="100"/> + <location filename="../qml/pages/AboutPage.qml" line="107"/> <source>Bugs?</source> <translation>¿Errores?</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="107"/> + <location filename="../qml/pages/AboutPage.qml" line="114"/> <source>Open Bug Tracker</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="116"/> + <location filename="../qml/pages/AboutPage.qml" line="123"/> <source>Forum Thread</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="125"/> + <location filename="../qml/pages/AboutPage.qml" line="132"/> <source>Send issue e-mail to developer</source> <translation type="unfinished"></translation> </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="141"/> + <source>Debug Mode</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="142"/> + <source>Enable daemon and app debugging</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AppConfigDialog</name> @@ -167,10 +177,6 @@ <context> <name>InstallAppDialog</name> <message> - <source>Install app</source> - <translation type="vanished">Instalar app</translation> - </message> - <message> <location filename="../qml/pages/InstallAppDialog.qml" line="18"/> <source>Select App files</source> <translation type="unfinished"></translation> @@ -178,7 +184,7 @@ <message> <location filename="../qml/pages/InstallAppDialog.qml" line="65"/> <source>Install App</source> - <translation type="unfinished"></translation> + <translation>Instalar App</translation> </message> <message> <location filename="../qml/pages/InstallAppDialog.qml" line="66"/> @@ -283,6 +289,11 @@ Si esto tarda mucho, comprueba que el reloj esté emparejado correctamente.</tra <translation>Transferir llamadas</translation> </message> <message> + <location filename="../qml/pages/ManagerPage.qml" line="150"/> + <source>Pebble music volume buttons change the main phone volume directly instead of through the music player</source> + <translation type="unfinished"></translation> + </message> + <message> <location filename="../qml/pages/ManagerPage.qml" line="251"/> <source>Profiles</source> <translation type="unfinished"></translation> @@ -296,24 +307,11 @@ Si esto tarda mucho, comprueba que el reloj esté emparejado correctamente.</tra <translation type="unfinished"></translation> </message> <message> - <source>Silent when connected</source> - <translation type="vanished">Modo silencio automático</translation> - </message> - <message> - <source>Sets phone profile to "silent" when Pebble is connected</source> - <translation type="vanished">Activa el modo silencio cuando se conecte un Pebble</translation> - </message> - <message> <location filename="../qml/pages/ManagerPage.qml" line="149"/> <source>Control main volume</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/ManagerPage.qml" line="150"/> - <source>Pebble music volume buttons change the main phone volume directly instead of through the music player.</source> - <translation type="unfinished"></translation> - </message> - <message> <location filename="../qml/pages/ManagerPage.qml" line="158"/> <source>Transliterate messages</source> <translation>Transliterar mensajes</translation> diff --git a/app/translations/pebble-pl.ts b/app/translations/pebble-pl.ts index 4efc24b..12970b3 100644 --- a/app/translations/pebble-pl.ts +++ b/app/translations/pebble-pl.ts @@ -4,55 +4,65 @@ <context> <name>AboutPage</name> <message> - <location filename="../qml/pages/AboutPage.qml" line="24"/> + <location filename="../qml/pages/AboutPage.qml" line="31"/> <source>Version</source> <translation>Wersja</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="36"/> + <location filename="../qml/pages/AboutPage.qml" line="43"/> <source>All Rights Reserved.</source> <translation>Wszelkie prawa zastrzeżone.</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="60"/> + <location filename="../qml/pages/AboutPage.qml" line="67"/> <source>Support</source> <translation>Wsparcie</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="74"/> + <location filename="../qml/pages/AboutPage.qml" line="81"/> <source>Your donations help justify development time.</source> <translation>Dotacje pomagają uzasadnić czas poświęcony na rozwój aplikacji.</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="87"/> + <location filename="../qml/pages/AboutPage.qml" line="94"/> <source>Thank you for your support!!!</source> <translation>Dziękuję za twoje wsparcie!!!</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="90"/> + <location filename="../qml/pages/AboutPage.qml" line="97"/> <source>PayPal Donate</source> <translation>Dotacja PayPal</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="100"/> + <location filename="../qml/pages/AboutPage.qml" line="107"/> <source>Bugs?</source> <translation>Błędy?</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="107"/> + <location filename="../qml/pages/AboutPage.qml" line="114"/> <source>Open Bug Tracker</source> <translation>Otwórz Bug Tracker</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="116"/> + <location filename="../qml/pages/AboutPage.qml" line="123"/> <source>Forum Thread</source> <translation>Wątek na forum</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="125"/> + <location filename="../qml/pages/AboutPage.qml" line="132"/> <source>Send issue e-mail to developer</source> <translation>Wyślij zgłoszenie e-mail do developera</translation> </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="141"/> + <source>Debug Mode</source> + <translation>Tryb Debug</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="142"/> + <source>Enable daemon and app debugging</source> + <translation>Włącz debugowanie demona i appki</translation> + </message> </context> <context> <name>AppConfigDialog</name> @@ -100,14 +110,6 @@ <translation>Cyferblaty</translation> </message> <message> - <source>WatchApps</source> - <translation type="vanished">Aplikacje</translation> - </message> - <message> - <source>WatchFaces</source> - <translation type="vanished">Cyferblaty</translation> - </message> - <message> <location filename="../qml/pages/AppStorePage.qml" line="109"/> <source>Downloading...</source> <translation>Pobieranie...</translation> @@ -322,6 +324,11 @@ Jeśli nie zostaje znaleziony sprawdź czy jest w zasięgu i czy jest sparowany <translation>Przekazuj telefony</translation> </message> <message> + <location filename="../qml/pages/ManagerPage.qml" line="150"/> + <source>Pebble music volume buttons change the main phone volume directly instead of through the music player</source> + <translation>Guziki zmiany głośności na Pebble będą zmieniać głośność bezpośrednio, a nie za pomocą odtwarzacza muzyki</translation> + </message> + <message> <location filename="../qml/pages/ManagerPage.qml" line="251"/> <source>Profiles</source> <translation>Profile</translation> @@ -335,24 +342,11 @@ Jeśli nie zostaje znaleziony sprawdź czy jest w zasięgu i czy jest sparowany <translation>bez zmiany</translation> </message> <message> - <source>Silent when connected</source> - <translation type="vanished">Cichy gdy połączony</translation> - </message> - <message> - <source>Sets phone profile to "silent" when Pebble is connected</source> - <translation type="vanished">Ustawia "cichy" profil telefonu gdy Pebble jest połączony</translation> - </message> - <message> <location filename="../qml/pages/ManagerPage.qml" line="149"/> <source>Control main volume</source> <translation>Steruj głośnością główną</translation> </message> <message> - <location filename="../qml/pages/ManagerPage.qml" line="150"/> - <source>Pebble music volume buttons change the main phone volume directly instead of through the music player.</source> - <translation>Guziki zmiany głośności na Pebble będą zmieniać głośność bezpośrednio, a nie za pomocą odtwarzacza muzyki.</translation> - </message> - <message> <location filename="../qml/pages/ManagerPage.qml" line="158"/> <source>Transliterate messages</source> <translation>Transliteracja wiadomości</translation> diff --git a/app/translations/pebble-zh_CN.ts b/app/translations/pebble-zh_CN.ts index 5cb6750..43cdcd7 100644 --- a/app/translations/pebble-zh_CN.ts +++ b/app/translations/pebble-zh_CN.ts @@ -4,55 +4,65 @@ <context> <name>AboutPage</name> <message> - <location filename="../qml/pages/AboutPage.qml" line="24"/> + <location filename="../qml/pages/AboutPage.qml" line="31"/> <source>Version</source> <translation>版本</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="36"/> + <location filename="../qml/pages/AboutPage.qml" line="43"/> <source>All Rights Reserved.</source> <translation>版权所有.</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="60"/> + <location filename="../qml/pages/AboutPage.qml" line="67"/> <source>Support</source> <translation>支持</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="74"/> + <location filename="../qml/pages/AboutPage.qml" line="81"/> <source>Your donations help justify development time.</source> <translation>你的捐款帮助合理开发时间.</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="87"/> + <location filename="../qml/pages/AboutPage.qml" line="94"/> <source>Thank you for your support!!!</source> <translation>感谢你的支持!!!</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="90"/> + <location filename="../qml/pages/AboutPage.qml" line="97"/> <source>PayPal Donate</source> <translation>Paypal捐助</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="100"/> + <location filename="../qml/pages/AboutPage.qml" line="107"/> <source>Bugs?</source> <translation>Bugs?</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="107"/> + <location filename="../qml/pages/AboutPage.qml" line="114"/> <source>Open Bug Tracker</source> <translation>打开的Bug追踪器</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="116"/> + <location filename="../qml/pages/AboutPage.qml" line="123"/> <source>Forum Thread</source> <translation>论坛主题</translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="125"/> + <location filename="../qml/pages/AboutPage.qml" line="132"/> <source>Send issue e-mail to developer</source> <translation>给开发者发送问题邮件</translation> </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="141"/> + <source>Debug Mode</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="142"/> + <source>Enable daemon and app debugging</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AppConfigDialog</name> @@ -282,6 +292,11 @@ If it can't be found please check it's available and paired in Bluetoo <translation>前置通话</translation> </message> <message> + <location filename="../qml/pages/ManagerPage.qml" line="150"/> + <source>Pebble music volume buttons change the main phone volume directly instead of through the music player</source> + <translation>Pebble音量键直接改变手机主音量,而不是通过音乐播放器</translation> + </message> + <message> <location filename="../qml/pages/ManagerPage.qml" line="251"/> <source>Profiles</source> <translation>个性化</translation> @@ -300,11 +315,6 @@ If it can't be found please check it's available and paired in Bluetoo <translation>控制主音量</translation> </message> <message> - <location filename="../qml/pages/ManagerPage.qml" line="150"/> - <source>Pebble music volume buttons change the main phone volume directly instead of through the music player.</source> - <translation>Pebble音量键直接改变手机主音量,而不是通过音乐播放器</translation> - </message> - <message> <location filename="../qml/pages/ManagerPage.qml" line="158"/> <source>Transliterate messages</source> <translation>转译消息</translation> diff --git a/app/translations/pebble.ts b/app/translations/pebble.ts index 36dc298..e6ae583 100644 --- a/app/translations/pebble.ts +++ b/app/translations/pebble.ts @@ -4,55 +4,65 @@ <context> <name>AboutPage</name> <message> - <location filename="../qml/pages/AboutPage.qml" line="24"/> + <location filename="../qml/pages/AboutPage.qml" line="31"/> <source>Version</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="36"/> + <location filename="../qml/pages/AboutPage.qml" line="43"/> <source>All Rights Reserved.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="60"/> + <location filename="../qml/pages/AboutPage.qml" line="67"/> <source>Support</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="74"/> + <location filename="../qml/pages/AboutPage.qml" line="81"/> <source>Your donations help justify development time.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="87"/> + <location filename="../qml/pages/AboutPage.qml" line="94"/> <source>Thank you for your support!!!</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="90"/> + <location filename="../qml/pages/AboutPage.qml" line="97"/> <source>PayPal Donate</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="100"/> + <location filename="../qml/pages/AboutPage.qml" line="107"/> <source>Bugs?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="107"/> + <location filename="../qml/pages/AboutPage.qml" line="114"/> <source>Open Bug Tracker</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="116"/> + <location filename="../qml/pages/AboutPage.qml" line="123"/> <source>Forum Thread</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/AboutPage.qml" line="125"/> + <location filename="../qml/pages/AboutPage.qml" line="132"/> <source>Send issue e-mail to developer</source> <translation type="unfinished"></translation> </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="141"/> + <source>Debug Mode</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="142"/> + <source>Enable daemon and app debugging</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>AppConfigDialog</name> @@ -270,6 +280,11 @@ If it can't be found please check it's available and paired in Bluetoo <translation type="unfinished"></translation> </message> <message> + <location filename="../qml/pages/ManagerPage.qml" line="150"/> + <source>Pebble music volume buttons change the main phone volume directly instead of through the music player</source> + <translation type="unfinished"></translation> + </message> + <message> <location filename="../qml/pages/ManagerPage.qml" line="251"/> <source>Profiles</source> <translation type="unfinished"></translation> @@ -288,11 +303,6 @@ If it can't be found please check it's available and paired in Bluetoo <translation type="unfinished"></translation> </message> <message> - <location filename="../qml/pages/ManagerPage.qml" line="150"/> - <source>Pebble music volume buttons change the main phone volume directly instead of through the music player.</source> - <translation type="unfinished"></translation> - </message> - <message> <location filename="../qml/pages/ManagerPage.qml" line="158"/> <source>Transliterate messages</source> <translation type="unfinished"></translation> diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp index 85af751..78050d3 100644 --- a/daemon/daemon.cpp +++ b/daemon/daemon.cpp @@ -50,18 +50,14 @@ int main(int argc, char *argv[]) app.setApplicationName("pebble"); // Use the same appname as the UI. app.setOrganizationName(""); - QStringList filterRules; - - filterRules << (argc > 1 and QString("-d") == argv[0] ? - "*.debug=false" : "*.debug=true"); - - // Init logging should be called after app object creation - QLoggingCategory::setFilterRules(filterRules.join("\n")); - QLoggingCategory l("main"); qCDebug(l) << argv[0] << APP_VERSION; Settings settings; + + QLoggingCategory::setFilterRules(settings.property("debug").toBool() ? + "*.debug=true" : "*.debug=false"); + Manager manager(&settings); Q_UNUSED(manager); diff --git a/daemon/manager.cpp b/daemon/manager.cpp index 179d05e..b02264e 100644 --- a/daemon/manager.cpp +++ b/daemon/manager.cpp @@ -123,7 +123,7 @@ void Manager::onActiveVoiceCallChanged() if (handler) { connect(handler, SIGNAL(statusChanged()), SLOT(onActiveVoiceCallStatusChanged())); connect(handler, SIGNAL(destroyed()), SLOT(onActiveVoiceCallStatusChanged())); - return; + if (handler->status()) onActiveVoiceCallStatusChanged(); } } @@ -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); } diff --git a/daemon/settings.h b/daemon/settings.h index a247dc5..4534a54 100644 --- a/daemon/settings.h +++ b/daemon/settings.h @@ -21,6 +21,7 @@ class Settings : public MDConfGroup Q_PROPERTY(bool notificationsOther MEMBER notificationsOther NOTIFY notificationsOtherChanged) Q_PROPERTY(bool notificationsAll MEMBER notificationsAll NOTIFY notificationsAllChanged) Q_PROPERTY(QString accountToken MEMBER accountToken NOTIFY accountTokenChanged) + Q_PROPERTY(bool debug MEMBER debug NOTIFY debugChanged) QString profileWhenConnected; QString profileWhenDisconnected; @@ -36,6 +37,7 @@ class Settings : public MDConfGroup bool notificationsOther; bool notificationsAll; QString accountToken; + bool debug; public: explicit Settings(QObject *parent = 0) : @@ -50,7 +52,8 @@ public: notificationsTwitter(true), notificationsFacebook(true), notificationsOther(true), - notificationsAll(false) + notificationsAll(false), + debug(false) { resolveMetaObject(); QMetaObject::invokeMethod(this, "propertyChanged", Qt::DirectConnection); @@ -72,6 +75,7 @@ signals: void notificationsOtherChanged(); void notificationsAllChanged(); void accountTokenChanged(); + void debugChanged(); }; #endif // SETTINGS_H diff --git a/daemon/voicecallhandler.cpp b/daemon/voicecallhandler.cpp index cce1792..180fa5b 100644 --- a/daemon/voicecallhandler.cpp +++ b/daemon/voicecallhandler.cpp @@ -19,7 +19,8 @@ class VoiceCallHandlerPrivate public: VoiceCallHandlerPrivate(VoiceCallHandler *q, const QString &pHandlerId) : q_ptr(q), handlerId(pHandlerId), interface(NULL) - , duration(0), status(0), emergency(false), multiparty(false), forwarded(false) + , duration(0), status(0), emergency(false), incoming(false) + , multiparty(false) , forwarded(false), remoteHeld(false) { /* ... */ } VoiceCallHandler *q_ptr; @@ -35,8 +36,10 @@ public: QString providerId; QDateTime startedAt; bool emergency; + bool incoming; bool multiparty; bool forwarded; + bool remoteHeld; }; /*! @@ -83,6 +86,7 @@ void VoiceCallHandler::initialize(bool notifyError) connect(d->interface, SIGNAL(emergencyChanged(bool)), SLOT(onEmergencyChanged(bool))); connect(d->interface, SIGNAL(multipartyChanged(bool)), SLOT(onMultipartyChanged(bool))); connect(d->interface, SIGNAL(forwardedChanged(bool)), SLOT(onForwardedChanged(bool))); + connect(d->interface, SIGNAL(remoteHeldChanged(bool)), SLOT(onRemoteHeldChanged(bool))); } else { if (notifyError) emit this->error("Failed to get VoiceCall properties from VCM D-Bus service."); @@ -113,6 +117,8 @@ bool VoiceCallHandler::getProperties() d->multiparty = props["isMultiparty"].toBool(); d->emergency = props["isEmergency"].toBool(); d->forwarded = props["isForwarded"].toBool(); + d->incoming = props["isIncoming"].toBool(); + d->remoteHeld = props["isIncoming"].toBool(); return true; } else { @@ -135,8 +141,7 @@ void VoiceCallHandler::onStatusChanged(int status, QString statusText) qCDebug(l) <<"onStatusChanged" << status << statusText; d->status = status; d->statusText = statusText; - // we still fetch all properties to be sure all properties are present. - getProperties(); + if (status) getProperties(); // make sure all properties are present emit statusChanged(); } @@ -180,6 +185,14 @@ void VoiceCallHandler::onForwardedChanged(bool isForwarded) emit forwardedChanged(); } +void VoiceCallHandler::onRemoteHeldChanged(bool isRemoteHeld) +{ + Q_D(VoiceCallHandler); + qCDebug(l) << "onRemoteHeldChanged" << isRemoteHeld; + d->forwarded = isRemoteHeld; + emit remoteHeldChanged(); +} + /*! Returns this voice calls' handler id. */ @@ -249,7 +262,7 @@ int VoiceCallHandler::duration() const bool VoiceCallHandler::isIncoming() const { Q_D(const VoiceCallHandler); - return d->interface->property("isIncoming").toBool(); + return d->incoming; } /*! @@ -280,6 +293,15 @@ bool VoiceCallHandler::isEmergency() const } /*! + Returns this voice calls' remoteHeld flag property. + */ +bool VoiceCallHandler::isRemoteHeld() const +{ + Q_D(const VoiceCallHandler); + return d->remoteHeld; +} + +/*! Initiates answering this call, if the call is an incoming call. */ void VoiceCallHandler::answer() diff --git a/daemon/voicecallhandler.h b/daemon/voicecallhandler.h index fb20ac7..6d671ce 100644 --- a/daemon/voicecallhandler.h +++ b/daemon/voicecallhandler.h @@ -24,6 +24,7 @@ class VoiceCallHandler : public QObject Q_PROPERTY(bool isEmergency READ isEmergency NOTIFY emergencyChanged) Q_PROPERTY(bool isMultiparty READ isMultiparty NOTIFY multipartyChanged) Q_PROPERTY(bool isForwarded READ isForwarded NOTIFY forwardedChanged) + Q_PROPERTY(bool isRemoteHeld READ isRemoteHeld NOTIFY remoteHeldChanged) public: enum VoiceCallStatus { @@ -51,6 +52,7 @@ public: bool isMultiparty() const; bool isEmergency() const; bool isForwarded() const; + bool isRemoteHeld() const; Q_SIGNALS: void error(const QString &error); @@ -61,6 +63,7 @@ Q_SIGNALS: void emergencyChanged(); void multipartyChanged(); void forwardedChanged(); + void remoteHeldChanged(); public Q_SLOTS: void answer(); @@ -81,6 +84,7 @@ protected Q_SLOTS: void onEmergencyChanged(bool isEmergency); void onMultipartyChanged(bool isMultiparty); void onForwardedChanged(bool isForwarded); + void onRemoteHeldChanged(bool isRemoteHeld); private: class VoiceCallHandlerPrivate *d_ptr; diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp index 09006c0..9993a38 100644 --- a/daemon/watchconnector.cpp +++ b/daemon/watchconnector.cpp @@ -71,7 +71,8 @@ bool WatchConnector::WatchVersions::isEmpty() const WatchConnector::WatchConnector(QObject *parent) : QObject(parent), l(metaObject()->className()), - socket(nullptr), is_connected(false), currentPebble(0), _last_address(0) + socket(nullptr), is_connected(false), + currentPebble(0), _last_address(0), platform(HP_UNKNOWN) { reconnectTimer.setSingleShot(true); QObject::connect(&reconnectTimer, SIGNAL(timeout()), SLOT(connect())); @@ -79,19 +80,19 @@ WatchConnector::WatchConnector(QObject *parent) : QObject::connect(&timeSyncTimer, SIGNAL(timeout()), SLOT(time())); timeSyncTimer.setInterval(4 * 60 * 60 * 1000); // sync time every 4 hours - firmwareMapping.insert(UNKNOWN, "unknown"); - firmwareMapping.insert(TINTIN_EV1, "ev1"); - firmwareMapping.insert(TINTIN_EV2, "ev2"); - firmwareMapping.insert(TINTIN_EV2_3, "ev2_3"); - firmwareMapping.insert(TINTIN_EV2_4, "ev2_4"); - firmwareMapping.insert(TINTIN_V1_5, "v1_5"); - firmwareMapping.insert(BIANCA, "v2_0"); - firmwareMapping.insert(SNOWY_EVT2, "snowy_evt2"); - firmwareMapping.insert(SNOWY_DVT, "snowy_dvt"); - firmwareMapping.insert(TINTIN_BB, "bigboard"); - firmwareMapping.insert(TINTIN_BB2, "bb2"); - firmwareMapping.insert(SNOWY_BB, "snowy_bb"); - firmwareMapping.insert(SNOWY_BB2, "snowy_bb2"); + hardwareMapping.insert(HR_UNKNOWN, HWMap(HP_UNKNOWN, "unknown")); + hardwareMapping.insert(TINTIN_EV1, HWMap(APLITE, "ev1")); + hardwareMapping.insert(TINTIN_EV2, HWMap(APLITE, "ev2")); + hardwareMapping.insert(TINTIN_EV2_3, HWMap(APLITE, "ev2_3")); + hardwareMapping.insert(TINTIN_EV2_4, HWMap(APLITE, "ev2_4")); + hardwareMapping.insert(TINTIN_V1_5, HWMap(APLITE, "v1_5")); + hardwareMapping.insert(BIANCA, HWMap(APLITE, "v2_0")); + hardwareMapping.insert(SNOWY_EVT2, HWMap(BASALT, "snowy_evt2")); + hardwareMapping.insert(SNOWY_DVT, HWMap(BASALT, "snowy_dvt")); + hardwareMapping.insert(TINTIN_BB, HWMap(APLITE, "bigboard")); + hardwareMapping.insert(TINTIN_BB2, HWMap(APLITE, "bb2")); + hardwareMapping.insert(SNOWY_BB, HWMap(BASALT, "snowy_bb")); + hardwareMapping.insert(SNOWY_BB2, HWMap(BASALT, "snowy_bb2")); setEndpointHandler(watchVERSION, [this](const QByteArray &data) { Unpacker u(data); @@ -103,7 +104,7 @@ WatchConnector::WatchConnector(QObject *parent) : _versions.main.commit = u.readFixedString(8); _versions.main.is_recovery = u.read<quint8>(); _versions.main.hw_revision = HardwareRevision(u.read<quint8>()); - _versions.main.hw_string = firmwareMapping.value(_versions.main.hw_revision); + _versions.main.hw_string = hardwareMapping.value(_versions.main.hw_revision).second; _versions.main.metadata_version = u.read<quint8>(); _versions.safe.build = QDateTime::fromTime_t(u.read<quint32>()); @@ -111,7 +112,7 @@ WatchConnector::WatchConnector(QObject *parent) : _versions.safe.commit = u.readFixedString(8); _versions.safe.is_recovery = u.read<quint8>(); _versions.safe.hw_revision = HardwareRevision(u.read<quint8>()); - _versions.safe.hw_string = firmwareMapping.value(_versions.safe.hw_revision); + _versions.safe.hw_string = hardwareMapping.value(_versions.safe.hw_revision).second; _versions.safe.metadata_version = u.read<quint8>(); _versions.bootLoaderBuild = QDateTime::fromTime_t(u.read<quint32>()); @@ -119,6 +120,8 @@ WatchConnector::WatchConnector(QObject *parent) : _versions.serialNumber = u.readFixedString(12); _versions.address = u.readBytes(6); + platform = hardwareMapping.value(_versions.safe.hw_revision).first; + if (u.bad()) { qCWarning(l) << "short read while reading firmware version"; } else { @@ -428,6 +431,7 @@ void WatchConnector::onError(QBluetoothSocket::SocketError error) } else { qCCritical(l) << "error connecting Pebble:" << error << socket->errorString(); } + scheduleReconnect(); } void WatchConnector::sendData(const QByteArray &data) @@ -576,15 +580,31 @@ QString WatchConnector::timeStamp() void WatchConnector::sendNotification(uint lead, QString sender, QString data, QString subject) { - QStringList tmp; - tmp.append(sender); - tmp.append(data); - tmp.append(timeStamp()); - if (lead == leadEMAIL) tmp.append(subject); + switch (platform) { + case HP_UNKNOWN: + qCWarning(l) << "Tried sending notification to UNKNOWN watch platform" << lead << sender << data << subject; + break; + case APLITE: { + QStringList tmp; + tmp.append(sender); + tmp.append(data); + tmp.append(timeStamp()); + if (lead == leadEMAIL) tmp.append(subject); + + QByteArray res = buildMessageData(lead, tmp); - QByteArray res = buildMessageData(lead, tmp); + sendMessage(watchNOTIFICATION, res); + } + break; + case BASALT: { + qCWarning(l) << "Tried sending notification to unsupported watch platform" << lead << sender << data << subject; + } + break; + default: + qCWarning(l) << "Tried sending notification to unsupported watch platform" << platform << ":" << lead << sender << data << subject; + break; + } - sendMessage(watchNOTIFICATION, res); } void WatchConnector::sendSMSNotification(QString sender, QString data) diff --git a/daemon/watchconnector.h b/daemon/watchconnector.h index fa65f6b..4369d87 100644 --- a/daemon/watchconnector.h +++ b/daemon/watchconnector.h @@ -39,12 +39,17 @@ public: watchAPP = 2004, watchAPP_LOGS = 2006, watchNOTIFICATION = 3000, + watchEXTENSIBLE_NOTIFS = 3010, // Deprecated in 3.x watchRESOURCE = 4000, - watchAPP_MANAGER = 6000, + watchFACTORY_SETTINGS = 5001, + watchAPP_MANAGER = 6000, // Deprecated in 3.x + watchAPP_FETCH = 6001, // New in 3.x watchDATA_LOGGING = 6778, watchSCREENSHOT = 8000, watchFILE_MANAGER = 8181, watchCORE_DUMP = 9000, + watchAUDIO = 10000, // New in 3.x + watchBLOB_DB = 45531, // New in 3.x watchPUTBYTES = 48879 }; enum { @@ -147,7 +152,7 @@ public: }; enum HardwareRevision { - UNKNOWN = 0, + HR_UNKNOWN = 0, TINTIN_EV1 = 1, TINTIN_EV2 = 2, TINTIN_EV2_3 = 3, @@ -162,7 +167,13 @@ public: SNOWY_BB = 0xFD, SNOWY_BB2 = 0xFC }; - QMap<HardwareRevision, QString> firmwareMapping; + enum HardwarePlatform { + HP_UNKNOWN = 0, + APLITE, + BASALT + }; + typedef QPair<HardwarePlatform,QString> HWMap; + QMap<HardwareRevision, HWMap> hardwareMapping; struct SoftwareVersion { QDateTime build; @@ -268,6 +279,7 @@ private: int currentPebble; quint64 _last_address; WatchVersions _versions; + HardwarePlatform platform; }; QDebug operator<< (QDebug d, const WatchConnector::SoftwareVersion &ver); diff --git a/rpm/pebble.changes b/rpm/pebble.changes index 0a2350c..8f65e10 100644 --- a/rpm/pebble.changes +++ b/rpm/pebble.changes @@ -1,3 +1,9 @@ +* Thu Jun 18 2015 Tomasz Sterna <tomek@xiaoka.com> 1.3 +- Preliminary support for Pebble Time +- Handle multiple paired Pebbles +- Fixes for SailfishOS 1.1.6: notifications and calls +- Togglable debug mode + * Tue May 19 2015 Tomasz Sterna <tomek@xiaoka.com> 1.2 - Automatic time synchronization with watch - Chinese translation diff --git a/rpm/pebble.spec b/rpm/pebble.spec index bc1612d..6d5b6c7 100644 --- a/rpm/pebble.spec +++ b/rpm/pebble.spec @@ -13,7 +13,7 @@ Name: pebble %{!?qtc_make:%define qtc_make make} %{?qtc_builddir:%define _builddir %qtc_builddir} Summary: Support for Pebble watch in SailfishOS -Version: 1.2 +Version: 1.3 Release: 1 Group: Qt/Qt License: GPL3 diff --git a/rpm/pebble.yaml b/rpm/pebble.yaml index 7c115c8..e577df4 100644 --- a/rpm/pebble.yaml +++ b/rpm/pebble.yaml @@ -1,6 +1,6 @@ Name: pebble Summary: Support for Pebble watch in SailfishOS -Version: 1.2 +Version: 1.3 Release: 1 Group: Qt/Qt URL: http://getpebble.com/ |
