diff options
| -rw-r--r-- | app/app.pro | 2 | ||||
| -rw-r--r-- | app/pebblefirmware.cpp | 3 | ||||
| -rw-r--r-- | app/qml/pages/ManagerPage.qml | 22 | ||||
| -rw-r--r-- | app/qml/pages/WatchInfo.qml | 10 | ||||
| -rw-r--r-- | app/qml/pebble.qml | 2 | ||||
| -rw-r--r-- | app/translations/pebble-es.ts | 2 | ||||
| -rw-r--r-- | app/translations/pebble-pl.ts | 2 | ||||
| -rw-r--r-- | app/translations/pebble-zh_CN.ts | 483 | ||||
| -rw-r--r-- | app/translations/pebble.ts | 2 | ||||
| -rw-r--r-- | daemon/daemon.pro | 2 | ||||
| -rw-r--r-- | daemon/dbusconnector.cpp | 77 | ||||
| -rw-r--r-- | daemon/dbusconnector.h | 31 | ||||
| -rw-r--r-- | daemon/manager.cpp | 25 | ||||
| -rw-r--r-- | daemon/manager.h | 17 | ||||
| -rw-r--r-- | daemon/musicmanager.cpp | 4 | ||||
| -rw-r--r-- | daemon/notificationmanager.cpp | 21 | ||||
| -rw-r--r-- | daemon/settings.h | 19 | ||||
| -rw-r--r-- | daemon/watchconnector.cpp | 152 | ||||
| -rw-r--r-- | daemon/watchconnector.h | 43 | ||||
| -rw-r--r-- | rpm/pebble.changes | 4 | ||||
| -rw-r--r-- | rpm/pebble.spec | 2 | ||||
| -rw-r--r-- | rpm/pebble.yaml | 2 |
22 files changed, 684 insertions, 243 deletions
diff --git a/app/app.pro b/app/app.pro index 2872cf7..5d13720 100644 --- a/app/app.pro +++ b/app/app.pro @@ -39,4 +39,4 @@ OTHER_FILES += \ pebble.png CONFIG += sailfishapp_i18n -TRANSLATIONS += translations/pebble-es.ts translations/pebble-pl.ts +TRANSLATIONS += translations/pebble-es.ts translations/pebble-pl.ts translations/pebble-zh_CN.ts diff --git a/app/pebblefirmware.cpp b/app/pebblefirmware.cpp index f42c29b..33460e5 100644 --- a/app/pebblefirmware.cpp +++ b/app/pebblefirmware.cpp @@ -16,8 +16,9 @@ PebbleFirmware::PebbleFirmware(QObject *parent) : void PebbleFirmware::updateLatest(QString hw) { QNetworkRequest req; - req.setUrl(firmwareURL.arg(hw).arg("release-v2")); + req.setUrl(firmwareURL.arg(hw).arg(hw.startsWith("snowy_") ? "release-v3" : "release-v2")); req.setRawHeader("Cache-Control", "no-cache"); + qDebug() << "Getting latest firmware" << req.url(); nm->get(req); } diff --git a/app/qml/pages/ManagerPage.qml b/app/qml/pages/ManagerPage.qml index b989c64..a69bc89 100644 --- a/app/qml/pages/ManagerPage.qml +++ b/app/qml/pages/ManagerPage.qml @@ -12,17 +12,17 @@ Page { path: "/org/pebbled/settings" property string profileWhenConnected: "" property string profileWhenDisconnected: "" - property bool transliterateMessage: false - property bool useSystemVolume: true - property bool incomingCallNotification: true - property bool notificationsCommhistoryd: true - property bool notificationsMissedCall: true - property bool notificationsEmails: false - property bool notificationsMitakuuluu: true - property bool notificationsTwitter: true - property bool notificationsFacebook: true - property bool notificationsOther: true - property bool notificationsAll: false + property bool transliterateMessage + property bool useSystemVolume + property bool incomingCallNotification + property bool notificationsCommhistoryd + property bool notificationsMissedCall + property bool notificationsEmails + property bool notificationsMitakuuluu + property bool notificationsTwitter + property bool notificationsFacebook + property bool notificationsOther + property bool notificationsAll } DBusInterface { diff --git a/app/qml/pages/WatchInfo.qml b/app/qml/pages/WatchInfo.qml index af4a740..a1c421c 100644 --- a/app/qml/pages/WatchInfo.qml +++ b/app/qml/pages/WatchInfo.qml @@ -28,7 +28,7 @@ Page { text: qsTr("Address") } Label { - text: pebbled.info.address + text: pebbled.info.address || "" } Label { @@ -36,7 +36,7 @@ Page { text: qsTr("Serial Number") } Label { - text: pebbled.info.serial + text: pebbled.info.serial || "" } Label { @@ -69,7 +69,7 @@ Page { text: qsTr("Recovery") } Label { - text: app.recoveryVersion + text: app.recoveryVersion || qsTr("unknown") } Label { @@ -77,7 +77,7 @@ Page { text: qsTr("Running") } Label { - text: app.firmwareVersion + text: app.firmwareVersion || qsTr("unknown") } Label { @@ -89,7 +89,7 @@ Page { } } Button { - visible: app.firmwareLatest && app.firmwareVersion && app.firmwareVersion !== app.firmwareLatest + visible: app.firmwareLatest && app.firmwareVersion !== app.firmwareLatest text: qsTr("Upgrade Firmware") anchors { left: parent.left diff --git a/app/qml/pebble.qml b/app/qml/pebble.qml index 380ff7e..0643f79 100644 --- a/app/qml/pebble.qml +++ b/app/qml/pebble.qml @@ -22,6 +22,8 @@ ApplicationWindow recoveryVersion = firmware.version } else { firmwareVersion = firmware.version + } + if (firmware.hardware) { hardwareVersion = firmware.hardware } }) diff --git a/app/translations/pebble-es.ts b/app/translations/pebble-es.ts index 28ddd18..8ca8b7f 100644 --- a/app/translations/pebble-es.ts +++ b/app/translations/pebble-es.ts @@ -425,6 +425,8 @@ Si esto tarda mucho, comprueba que el reloj esté emparejado correctamente.</tra <translation type="unfinished"></translation> </message> <message> + <location filename="../qml/pages/WatchInfo.qml" line="72"/> + <location filename="../qml/pages/WatchInfo.qml" line="80"/> <location filename="../qml/pages/WatchInfo.qml" line="88"/> <source>unknown</source> <translation type="unfinished"></translation> diff --git a/app/translations/pebble-pl.ts b/app/translations/pebble-pl.ts index 4e11b08..8d431d8 100644 --- a/app/translations/pebble-pl.ts +++ b/app/translations/pebble-pl.ts @@ -453,6 +453,8 @@ Jeśli nie zostaje znaleziony sprawdź czy jest w zasięgu i czy jest sparowany <translation>Najnowszy</translation> </message> <message> + <location filename="../qml/pages/WatchInfo.qml" line="72"/> + <location filename="../qml/pages/WatchInfo.qml" line="80"/> <location filename="../qml/pages/WatchInfo.qml" line="88"/> <source>unknown</source> <translation>nie wiadomo</translation> diff --git a/app/translations/pebble-zh_CN.ts b/app/translations/pebble-zh_CN.ts new file mode 100644 index 0000000..655d162 --- /dev/null +++ b/app/translations/pebble-zh_CN.ts @@ -0,0 +1,483 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="zh_CN"> +<context> + <name>AboutPage</name> + <message> + <location filename="../qml/pages/AboutPage.qml" line="24"/> + <source>Version</source> + <translation>版本</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="36"/> + <source>All Rights Reserved.</source> + <translation>版权所有.</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="60"/> + <source>Support</source> + <translation>支持</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="74"/> + <source>Your donations help justify development time.</source> + <translation>你的捐款帮助证明了开发时间.</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="87"/> + <source>Thank you for your support!!!</source> + <translation>感谢你的支持!!!</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="90"/> + <source>PayPal Donate</source> + <translation>贝宝捐助</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="100"/> + <source>Bugs?</source> + <translation>Bugs?</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="107"/> + <source>Open Bug Tracker</source> + <translation>打开的Bug追踪器</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="116"/> + <source>Forum Thread</source> + <translation>论坛主题</translation> + </message> + <message> + <location filename="../qml/pages/AboutPage.qml" line="125"/> + <source>Send issue e-mail to developer</source> + <translation>给开发者发送问题邮件</translation> + </message> +</context> +<context> + <name>AppConfigDialog</name> + <message> + <location filename="../qml/pages/AppConfigDialog.qml" line="75"/> + <source>No configuration settings available</source> + <translation>没有可用的配置设置</translation> + </message> +</context> +<context> + <name>AppStorePage</name> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="27"/> + <source>Logout</source> + <translation>退出</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="29"/> + <source>Logging out...</source> + <translation>退出中...</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="36"/> + <source>Hide search</source> + <translation>隐藏搜索框</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="36"/> + <source>Show search</source> + <translation>显示搜索框</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="49"/> + <source>Pebble Appstore</source> + <translation>Pebble 应用商店</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="78"/> + <source>Apps</source> + <translation>应用</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="86"/> + <source>Faces</source> + <translation>表情</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="109"/> + <source>Downloading...</source> + <translation>下载中...</translation> + </message> + <message> + <location filename="../qml/pages/AppStorePage.qml" line="141"/> + <source>Downloading %1...</source> + <translation>下载 %1...</translation> + </message> +</context> +<context> + <name>CoverPage</name> + <message> + <location filename="../qml/cover/CoverPage.qml" line="56"/> + <source>connected</source> + <translation>已连接</translation> + </message> + <message> + <location filename="../qml/cover/CoverPage.qml" line="56"/> + <source>disconnected</source> + <translation>已断开</translation> + </message> +</context> +<context> + <name>Disclaimer</name> + <message> + <location filename="../qml/pages/Disclaimer.qml" line="28"/> + <source>Feature unavailable</source> + <translation>功能不可用</translation> + </message> + <message> + <location filename="../qml/pages/Disclaimer.qml" line="38"/> + <source>This feature is available for supporters only.</source> + <translation>此功能适用于仅支持者.</translation> + </message> + <message> + <location filename="../qml/pages/Disclaimer.qml" line="51"/> + <source>Supporter?</source> + <translation>支持者?</translation> + </message> + <message> + <location filename="../qml/pages/Disclaimer.qml" line="58"/> + <source>Send me my code!</source> + <translation>发送给我的代码!</translation> + </message> + <message> + <location filename="../qml/pages/Disclaimer.qml" line="68"/> + <source>Activation code</source> + <translation>激活码</translation> + </message> + <message> + <location filename="../qml/pages/Disclaimer.qml" line="41"/> + <source>PayPal Donate</source> + <translation>Paypal捐助</translation> + </message> +</context> +<context> + <name>FirmwareUpgrade</name> + <message> + <location filename="../qml/pages/FirmwareUpgrade.qml" line="30"/> + <source>Firmware upgrade</source> + <translation>固件升级</translation> + </message> + <message> + <location filename="../qml/pages/FirmwareUpgrade.qml" line="66"/> + <source>Begin upgrade</source> + <translation>开始升级</translation> + </message> +</context> +<context> + <name>InstallAppDialog</name> + <message> + <location filename="../qml/pages/InstallAppDialog.qml" line="18"/> + <source>Select App files</source> + <translation>选择应用文件</translation> + </message> + <message> + <location filename="../qml/pages/InstallAppDialog.qml" line="65"/> + <source>Install App</source> + <translation>安装应用</translation> + </message> + <message> + <location filename="../qml/pages/InstallAppDialog.qml" line="66"/> + <source>Install</source> + <translation>安装</translation> + </message> + <message> + <location filename="../qml/pages/InstallAppDialog.qml" line="73"/> + <source>Add App file</source> + <translation>添加应用文件</translation> + </message> + <message> + <location filename="../qml/pages/InstallAppDialog.qml" line="143"/> + <source>Delete App file</source> + <translation>删除应用文件</translation> + </message> +</context> +<context> + <name>ManagerPage</name> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="56"/> + <source>Pebble Appstore</source> + <translation>Pebble 应用商店</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="60"/> + <source>About</source> + <translation>关于</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="71"/> + <source>Pebble Manager</source> + <translation>Pebble管理</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="78"/> + <source>Waiting for watch... +If it can't be found please check it's available and paired in Bluetooth settings.</source> + <translation>等待观看... + 如果无法找到,请检查它的提供配对的蓝牙设置。</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="99"/> + <source>Service</source> + <translation>服务</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="106"/> + <source>Enabled</source> + <translation>已启用</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="107"/> + <source>Automatic startup</source> + <translation>自动启动</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="107"/> + <source>Manual startup</source> + <translation>手动启动</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="113"/> + <source>Active</source> + <translation>激活</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="114"/> + <source>Running</source> + <translation>运行中</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="114"/> + <source>Dead</source> + <translation>挂了</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="120"/> + <source>Connection</source> + <translation>连接</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="121"/> + <location filename="../qml/pages/ManagerPage.qml" line="259"/> + <source>Connected</source> + <translation>已连接</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="121"/> + <location filename="../qml/pages/ManagerPage.qml" line="280"/> + <source>Disconnected</source> + <translation>已断开</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="134"/> + <source>Settings</source> + <translation>设置</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="141"/> + <source>Forward phone calls</source> + <translation>前置通话</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="251"/> + <source>Profiles</source> + <translation>个性化</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="262"/> + <location filename="../qml/pages/ManagerPage.qml" line="273"/> + <location filename="../qml/pages/ManagerPage.qml" line="283"/> + <location filename="../qml/pages/ManagerPage.qml" line="294"/> + <source>no change</source> + <translation>未改变</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="149"/> + <source>Control main volume</source> + <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> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="159"/> + <source>Messages are transliterated to ASCII before sending to Pebble</source> + <translation>在发送到Pebble之前消息已转换成ASCII码</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="168"/> + <source>Notifications</source> + <translation>通知</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="176"/> + <source>Messaging</source> + <translation>消息</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="177"/> + <source>SMS and IM</source> + <translation>短信和即时消息</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="186"/> + <source>Missed call</source> + <translation>漏接电话</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="195"/> + <source>Emails</source> + <translation>邮件</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="204"/> + <source>Mitakuuluu</source> + <translation>Mitakuuluu</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="213"/> + <source>Twitter</source> + <translation>Twitter</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="223"/> + <source>Facebook</source> + <translation>Facebook</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="232"/> + <source>Other notifications</source> + <translation>其他通知</translation> + </message> + <message> + <location filename="../qml/pages/ManagerPage.qml" line="241"/> + <source>All notifications</source> + <translation>所有通知</translation> + </message> +</context> +<context> + <name>WatchInfo</name> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="28"/> + <source>Address</source> + <translation>地址</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="36"/> + <source>Serial Number</source> + <translation>序列号</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="44"/> + <source>BootLoader</source> + <translation>BootLoader</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="52"/> + <source>Firmware</source> + <translation>固件</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="69"/> + <source>Recovery</source> + <translation>恢复模式</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="77"/> + <source>Running</source> + <translation>运行中</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="85"/> + <source>Latest</source> + <translation>最新</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="72"/> + <location filename="../qml/pages/WatchInfo.qml" line="80"/> + <location filename="../qml/pages/WatchInfo.qml" line="88"/> + <source>unknown</source> + <translation>未知</translation> + </message> + <message> + <location filename="../qml/pages/WatchInfo.qml" line="93"/> + <source>Upgrade Firmware</source> + <translation>升级固件</translation> + </message> +</context> +<context> + <name>WatchPage</name> + <message> + <location filename="../qml/pages/WatchPage.qml" line="34"/> + <source>Info</source> + <translation>信息</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="40"/> + <source>Ping</source> + <translation>Ping</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="46"/> + <source>Sync Time</source> + <translation>同步时间</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="78"/> + <source>Installed applications</source> + <translation>已安装应用</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="188"/> + <source>(slot in use by unknown app)</source> + <translation>(插槽在被不明应用程序使用中)</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="68"/> + <source>Your firmware is too old to support SDKv2 applications</source> + <translation>你的固件太老不支持SDK v2版本的应用</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="116"/> + <source>Uninstalling</source> + <translation>卸载中...</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="188"/> + <source>(empty slot)</source> + <translation>(空槽)</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="197"/> + <source>Install app...</source> + <translation>安装应用...</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="202"/> + <source>Companion app missing</source> + <translation>配套应用缺失</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="215"/> + <source>Configure...</source> + <translation>配置...</translation> + </message> + <message> + <location filename="../qml/pages/WatchPage.qml" line="220"/> + <source>Uninstall</source> + <translation>卸载</translation> + </message> +</context> +</TS> diff --git a/app/translations/pebble.ts b/app/translations/pebble.ts index 843ceef..0479dc1 100644 --- a/app/translations/pebble.ts +++ b/app/translations/pebble.ts @@ -404,6 +404,8 @@ 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/WatchInfo.qml" line="72"/> + <location filename="../qml/pages/WatchInfo.qml" line="80"/> <location filename="../qml/pages/WatchInfo.qml" line="88"/> <source>unknown</source> <translation type="unfinished"></translation> diff --git a/daemon/daemon.pro b/daemon/daemon.pro index 40d3290..4520b57 100644 --- a/daemon/daemon.pro +++ b/daemon/daemon.pro @@ -16,7 +16,6 @@ SOURCES += \ voicecallhandler.cpp \ notificationmanager.cpp \ watchconnector.cpp \ - dbusconnector.cpp \ appmanager.cpp \ musicmanager.cpp \ datalogmanager.cpp \ @@ -36,7 +35,6 @@ HEADERS += \ voicecallhandler.h \ notificationmanager.h \ watchconnector.h \ - dbusconnector.h \ settings.h \ appmanager.h \ musicmanager.h \ diff --git a/daemon/dbusconnector.cpp b/daemon/dbusconnector.cpp deleted file mode 100644 index ccc127d..0000000 --- a/daemon/dbusconnector.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "dbusconnector.h" - -#include <QBluetoothAddress> -#include <QBluetoothLocalDevice> -#include <QDebug> -#include <QDBusConnection> -#include <QDBusMessage> -#include <QDBusReply> -#include <QDBusArgument> -#include <QDBusObjectPath> - -//dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.ListAdapters -//dbus-send --system --dest=org.bluez --print-reply $path org.bluez.Adapter.GetProperties -//dbus-send --system --dest=org.bluez --print-reply $devpath org.bluez.Device.GetProperties -//dbus-send --system --dest=org.bluez --print-reply $devpath org.bluez.Input.Connect - -DBusConnector::DBusConnector(QObject *parent) : - QObject(parent), l(metaObject()->className()) -{} - -bool DBusConnector::findPebble() -{ - QDBusConnection system = QDBusConnection::systemBus(); - - QDBusReply<QList<QDBusObjectPath>> ListAdaptersReply = system.call( - QDBusMessage::createMethodCall("org.bluez", "/", "org.bluez.Manager", - "ListAdapters")); - if (not ListAdaptersReply.isValid()) { - qCCritical(l) << ListAdaptersReply.error().message(); - return false; - } - - QList<QDBusObjectPath> adapters = ListAdaptersReply.value(); - - if (adapters.isEmpty()) { - qCDebug(l) << "No BT adapters found"; - return false; - } - - QDBusReply<QVariantMap> AdapterPropertiesReply = system.call( - QDBusMessage::createMethodCall("org.bluez", adapters[0].path(), "org.bluez.Adapter", - "GetProperties")); - if (not AdapterPropertiesReply.isValid()) { - qCCritical(l) << AdapterPropertiesReply.error().message(); - return false; - } - - QList<QDBusObjectPath> devices; - AdapterPropertiesReply.value()["Devices"].value<QDBusArgument>() >> devices; - - foreach (QDBusObjectPath path, devices) { - QDBusReply<QVariantMap> DevicePropertiesReply = system.call( - QDBusMessage::createMethodCall("org.bluez", path.path(), "org.bluez.Device", - "GetProperties")); - if (not DevicePropertiesReply.isValid()) { - qCCritical(l) << DevicePropertiesReply.error().message(); - continue; - } - - const QVariantMap &dict = DevicePropertiesReply.value(); - - QString tmp = dict["Name"].toString(); - qCDebug(l) << "Found BT device:" << tmp; - if (tmp.startsWith("Pebble")) { - qCDebug(l) << "Found Pebble:" << tmp; - QBluetoothAddress addr(dict["Address"].toString()); - QBluetoothLocalDevice dev; - if (dev.pairingStatus(addr) == QBluetoothLocalDevice::AuthorizedPaired) { - pebbleProps = dict; - emit pebbleChanged(); - return true; - } - } - } - - return false; -} diff --git a/daemon/dbusconnector.h b/daemon/dbusconnector.h deleted file mode 100644 index 6b48f99..0000000 --- a/daemon/dbusconnector.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef DBUSCONNECTOR_H -#define DBUSCONNECTOR_H - -#include <QObject> -#include <QStringList> -#include <QVariantMap> -#include <QLoggingCategory> - -// TODO Remove this. - -class DBusConnector : public QObject -{ - Q_OBJECT - QLoggingCategory l; - - Q_PROPERTY(QVariantMap pebble READ pebble NOTIFY pebbleChanged) - QVariantMap pebbleProps; - -public: - explicit DBusConnector(QObject *parent = 0); - - QVariantMap pebble() const { return pebbleProps; } - -signals: - void pebbleChanged(); - -public slots: - bool findPebble(); -}; - -#endif // DBUSCONNECTOR_H diff --git a/daemon/manager.cpp b/daemon/manager.cpp index e6ebf26..179d05e 100644 --- a/daemon/manager.cpp +++ b/daemon/manager.cpp @@ -10,7 +10,6 @@ Manager::Manager(Settings *settings, QObject *parent) : QObject(parent), l(metaObject()->className()), settings(settings), proxy(new PebbledProxy(this)), watch(new WatchConnector(this)), - dbus(new DBusConnector(this)), upload(new UploadManager(watch, this)), apps(new AppManager(this)), bank(new BankManager(watch, upload, apps, this)), @@ -67,8 +66,8 @@ Manager::Manager(Settings *settings, QObject *parent) : session.registerObject("/org/pebbled/Watch", proxy); session.registerService("org.pebbled"); - connect(dbus, &DBusConnector::pebbleChanged, proxy, &PebbledProxy::NameChanged); - connect(dbus, &DBusConnector::pebbleChanged, proxy, &PebbledProxy::AddressChanged); + connect(watch, &WatchConnector::pebbleChanged, proxy, &PebbledProxy::NameChanged); + connect(watch, &WatchConnector::pebbleChanged, proxy, &PebbledProxy::AddressChanged); connect(watch, &WatchConnector::connectedChanged, proxy, &PebbledProxy::ConnectedChanged); connect(watch, &WatchConnector::versionsChanged, proxy, &PebbledProxy::InfoChanged); connect(bank, &BankManager::slotsChanged, proxy, &PebbledProxy::AppSlotsChanged); @@ -79,11 +78,7 @@ Manager::Manager(Settings *settings, QObject *parent) : // Set BT icon for notification notification.setImage("icon-system-bluetooth-device"); - if (btDevice.isValid()) { - qCDebug(l) << "BT local name:" << btDevice.name(); - connect(dbus, SIGNAL(pebbleChanged()), SLOT(onPebbleChanged())); - dbus->findPebble(); - } + watch->findPebbles(); } Manager::~Manager() @@ -100,17 +95,6 @@ void Manager::onSettingsChanged() qCWarning(l) << __FUNCTION__ << "Not implemented!"; } -void Manager::onPebbleChanged() -{ - const QVariantMap & pebble = dbus->pebble(); - QString name = pebble["Name"].toString(); - if (name.isEmpty()) { - qCDebug(l) << "Pebble gone"; - } else { - watch->deviceConnect(name, pebble["Address"].toString()); - } -} - void Manager::onConnectedChanged() { QString message = QString("%1 %2") @@ -130,8 +114,7 @@ void Manager::onActiveVoiceCallChanged() { qCDebug(l) << "Manager::onActiveVoiceCallChanged()"; - QVariant incomingCallNotification = settings->property("incomingCallNotification"); - if (incomingCallNotification.isValid() && !incomingCallNotification.toBool()) { + if (!settings->property("incomingCallNotification").toBool()) { qCDebug(l) << "Ignoring ActiveVoiceCallChanged because of setting!"; return; } diff --git a/daemon/manager.h b/daemon/manager.h index 2079de0..a605ed1 100644 --- a/daemon/manager.h +++ b/daemon/manager.h @@ -2,7 +2,6 @@ #define MANAGER_H #include "watchconnector.h" -#include "dbusconnector.h" #include "uploadmanager.h" #include "voicecallmanager.h" #include "notificationmanager.h" @@ -15,7 +14,6 @@ #include "settings.h" #include <QObject> -#include <QBluetoothLocalDevice> #include <QDBusContext> #include <QtContacts/QContactManager> #include <QtContacts/QContactDetailFilter> @@ -35,14 +33,11 @@ class Manager : public QObject, protected QDBusContext friend class PebbledProxy; - QBluetoothLocalDevice btDevice; - Settings *settings; PebbledProxy *proxy; WatchConnector *watch; - DBusConnector *dbus; UploadManager *upload; AppManager *apps; BankManager *bank; @@ -79,7 +74,6 @@ public slots: private slots: void onSettingChanged(const QString &key); void onSettingsChanged(); - void onPebbleChanged(); void onConnectedChanged(); void onActiveVoiceCallChanged(); void onVoiceError(const QString &message); @@ -113,16 +107,15 @@ class PebbledProxy : public QObject, protected QDBusContext Q_PROPERTY(QVariantList AllApps READ AllApps NOTIFY AllAppsChanged) inline Manager* manager() const { return static_cast<Manager*>(parent()); } - inline QVariantMap pebble() const { return manager()->dbus->pebble(); } public: inline explicit PebbledProxy(QObject *parent) : QObject(parent), l(metaObject()->className()) {} - inline QString Name() const { return pebble()["Name"].toString(); } - inline QString Address() const { return pebble()["Address"].toString(); } - inline QVariantMap Info() const { return manager()->watch->versions().toMap(); } - inline bool Connected() const { return manager()->watch->isConnected(); } + inline QString Name() const { qCDebug(l) << manager()->watch->name(); return manager()->watch->name(); } + inline QString Address() const { qCDebug(l) << manager()->watch->address().toString(); return manager()->watch->address().toString(); } + inline QVariantMap Info() const { qCDebug(l) << manager()->watch->versions().toMap(); return manager()->watch->versions().toMap(); } + inline bool Connected() const { qCDebug(l) << manager()->watch->isConnected(); return manager()->watch->isConnected(); } inline QString AppUuid() const { return manager()->currentAppUuid.toString(); } QStringList AppSlots() const; @@ -131,7 +124,7 @@ public: public slots: inline void Disconnect() { manager()->watch->disconnect(); } - inline void Reconnect() { manager()->watch->reconnect(); } + inline void Reconnect() { manager()->watch->connect(); } inline void Ping(uint val) { manager()->watch->ping(val); } inline void SyncTime() { manager()->watch->time(); } diff --git a/daemon/musicmanager.cpp b/daemon/musicmanager.cpp index 5ae1786..2a426db 100644 --- a/daemon/musicmanager.cpp +++ b/daemon/musicmanager.cpp @@ -148,11 +148,9 @@ void MusicManager::callMprisMethod(const QString &method) void MusicManager::handleMusicControl(WatchConnector::MusicControl operation) { qCDebug(l) << "operation from watch:" << operation; - QVariant useSystemVolumeVar = settings->property("useSystemVolume"); - bool useSystemVolume = (useSystemVolumeVar.isValid() && useSystemVolumeVar.toBool()); // System volume controls - if (useSystemVolume && _pulseBus != NULL && + if (settings->property("useSystemVolume").toBool() && _pulseBus != NULL && (operation == WatchConnector::musicVOLUME_UP || operation == WatchConnector::musicVOLUME_DOWN)) { // Query current volume QDBusMessage call = QDBusMessage::createMethodCall("com.Meego.MainVolume2", "/com/meego/mainvolume2", diff --git a/daemon/notificationmanager.cpp b/daemon/notificationmanager.cpp index d983539..d357a3c 100644 --- a/daemon/notificationmanager.cpp +++ b/daemon/notificationmanager.cpp @@ -126,8 +126,7 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons setDelayedReply(true); if (app_name == "messageserver5") { - QVariant notificationsEmails = settings->property("notificationsEmails"); - if (!notificationsEmails.isValid() || !notificationsEmails.toBool()) { + if (!settings->property("notificationsEmails").toBool()) { qCDebug(l) << "Ignoring email notification because of setting!"; return 0; } @@ -149,14 +148,12 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons QString category = hints.value("category", "").toString(); if (category == "x-nemo.call.missed") { - QVariant notificationsMissedCall = settings->property("notificationsMissedCall"); - if (notificationsMissedCall.isValid() && !notificationsMissedCall.toBool()) { + if (!settings->property("notificationsMissedCall").toBool()) { qCDebug(l) << "Ignoring MissedCall notification because of setting!"; return 0; } } else { - QVariant notificationsCommhistoryd = settings->property("notificationsCommhistoryd"); - if (notificationsCommhistoryd.isValid() && !notificationsCommhistoryd.toBool()) { + if (!settings->property("notificationsCommhistoryd").toBool()) { qCDebug(l) << "Ignoring commhistoryd notification because of setting!"; return 0; } @@ -166,8 +163,7 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons ); } } else if (app_name == "harbour-mitakuuluu2-server") { - QVariant notificationsMitakuuluu = settings->property("notificationsMitakuuluu"); - if (notificationsMitakuuluu.isValid() && !notificationsMitakuuluu.toBool()) { + if (!settings->property("notificationsMitakuuluu").toBool()) { qCDebug(l) << "Ignoring mitakuuluu notification because of setting!"; return 0; } @@ -176,8 +172,7 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons hints.value("x-nemo-preview-summary", "default").toString() ); } else if (app_name == "twitter-notifications-client") { - QVariant notificationsTwitter = settings->property("notificationsTwitter"); - if (notificationsTwitter.isValid() && !notificationsTwitter.toBool()) { + if (!settings->property("notificationsTwitter").toBool()) { qCDebug(l) << "Ignoring twitter notification because of setting!"; return 0; } @@ -195,14 +190,12 @@ uint NotificationManager::Notify(const QString &app_name, uint replaces_id, cons qCDebug(l) << "MSG Prio:" << prio; - QVariant notificationsAll = settings->property("notificationsAll"); - if ((!notificationsAll.isValid() || !notificationsAll.toBool()) && prio <= 10) { + if (!settings->property("notificationsAll").toBool() && prio <= 10) { qCDebug(l) << "Ignoring notification because of setting! (all)"; return 0; } - QVariant notificationsOther = settings->property("notificationsOther"); - if (notificationsOther.isValid() && !notificationsOther.toBool() && prio < 90) { + if (!settings->property("notificationsOther").toBool() && prio < 90) { qCDebug(l) << "Ignoring notification because of setting! (other)"; return 0; } diff --git a/daemon/settings.h b/daemon/settings.h index 3c38473..a247dc5 100644 --- a/daemon/settings.h +++ b/daemon/settings.h @@ -39,8 +39,23 @@ class Settings : public MDConfGroup public: explicit Settings(QObject *parent = 0) : - MDConfGroup("/org/pebbled/settings", parent, BindProperties) - { resolveMetaObject(); } + MDConfGroup("/org/pebbled/settings", parent, BindProperties), + transliterateMessage(false), + useSystemVolume(true), + incomingCallNotification(true), + notificationsCommhistoryd(true), + notificationsMissedCall(true), + notificationsEmails(false), + notificationsMitakuuluu(true), + notificationsTwitter(true), + notificationsFacebook(true), + notificationsOther(true), + notificationsAll(false) + { + resolveMetaObject(); + QMetaObject::invokeMethod(this, "propertyChanged", Qt::DirectConnection); + sync(); + } signals: void profileWhenConnectedChanged(); diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp index 2c17a0b..09006c0 100644 --- a/daemon/watchconnector.cpp +++ b/daemon/watchconnector.cpp @@ -1,6 +1,12 @@ #include <QDateTime> #include <QMetaEnum> #include <QDebugStateSaver> +#include <QBluetoothLocalDevice> +#include <QDBusConnection> +#include <QDBusMessage> +#include <QDBusReply> +#include <QDBusArgument> +#include <QDBusObjectPath> #include "unpacker.h" #include "watchconnector.h" @@ -64,23 +70,28 @@ bool WatchConnector::WatchVersions::isEmpty() const } WatchConnector::WatchConnector(QObject *parent) : - QObject(parent), l(metaObject()->className()), socket(nullptr), is_connected(false) + QObject(parent), l(metaObject()->className()), + socket(nullptr), is_connected(false), currentPebble(0), _last_address(0) { reconnectTimer.setSingleShot(true); - connect(&reconnectTimer, SIGNAL(timeout()), SLOT(reconnect())); + QObject::connect(&reconnectTimer, SIGNAL(timeout()), SLOT(connect())); timeSyncTimer.setSingleShot(true); - connect(&timeSyncTimer, SIGNAL(timeout()), SLOT(time())); + QObject::connect(&timeSyncTimer, SIGNAL(timeout()), SLOT(time())); timeSyncTimer.setInterval(4 * 60 * 60 * 1000); // sync time every 4 hours firmwareMapping.insert(UNKNOWN, "unknown"); - firmwareMapping.insert(PEBBLE_ONE_EV1, "ev1"); - firmwareMapping.insert(PEBBLE_ONE_EV2, "ev2"); - firmwareMapping.insert(PEBBLE_ONE_EV2_3, "ev2_3"); - firmwareMapping.insert(PEBBLE_ONE_EV2_4, "ev2_4"); - firmwareMapping.insert(PEBBLE_ONE_POINT_FIVE, "v1_5"); - firmwareMapping.insert(PEBBLE_TWO_POINT_ZERO, "v2_0"); - firmwareMapping.insert(PEBBLE_ONE_BIGBOARD_2, "bb2"); - firmwareMapping.insert(PEBBLE_ONE_BIGBOARD, "bigboard"); + 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"); setEndpointHandler(watchVERSION, [this](const QByteArray &data) { Unpacker u(data); @@ -124,28 +135,71 @@ WatchConnector::~WatchConnector() { } -void WatchConnector::deviceDiscovered(const QBluetoothDeviceInfo &device) +//dbus-send --system --dest=org.bluez --print-reply / org.bluez.Manager.ListAdapters +//dbus-send --system --dest=org.bluez --print-reply $path org.bluez.Adapter.GetProperties +//dbus-send --system --dest=org.bluez --print-reply $devpath org.bluez.Device.GetProperties +//dbus-send --system --dest=org.bluez --print-reply $devpath org.bluez.Input.Connect +bool WatchConnector::findPebbles() { - //FIXME TODO: Configurable - if (device.name().startsWith("Pebble")) { - qCDebug(l) << "Found Pebble:" << device.name() << '(' << device.address().toString() << ')'; - handleWatch(device.name(), device.address().toString()); - } else { - qCDebug(l) << "Found other device:" << device.name() << '(' << device.address().toString() << ')'; + pebbles.clear(); + currentPebble = 0; + + QDBusConnection system = QDBusConnection::systemBus(); + + QDBusReply<QList<QDBusObjectPath>> ListAdaptersReply = system.call( + QDBusMessage::createMethodCall("org.bluez", "/", "org.bluez.Manager", + "ListAdapters")); + if (not ListAdaptersReply.isValid()) { + qCCritical(l) << ListAdaptersReply.error().message(); + return false; } -} -void WatchConnector::deviceConnect(const QString &name, const QString &address) -{ - if (name.startsWith("Pebble")) handleWatch(name, address); -} + QList<QDBusObjectPath> adapters = ListAdaptersReply.value(); -void WatchConnector::reconnect() -{ - qCDebug(l) << "reconnect" << _last_name; - if (!_last_name.isEmpty() && !_last_address.isEmpty()) { - deviceConnect(_last_name, _last_address); + if (adapters.isEmpty()) { + qCDebug(l) << "No BT adapters found"; + return false; + } + + QDBusReply<QVariantMap> AdapterPropertiesReply = system.call( + QDBusMessage::createMethodCall("org.bluez", adapters[0].path(), "org.bluez.Adapter", + "GetProperties")); + if (not AdapterPropertiesReply.isValid()) { + qCCritical(l) << AdapterPropertiesReply.error().message(); + return false; + } + + QList<QDBusObjectPath> devices; + AdapterPropertiesReply.value()["Devices"].value<QDBusArgument>() >> devices; + + foreach (QDBusObjectPath path, devices) { + QDBusReply<QVariantMap> DevicePropertiesReply = system.call( + QDBusMessage::createMethodCall("org.bluez", path.path(), "org.bluez.Device", + "GetProperties")); + if (not DevicePropertiesReply.isValid()) { + qCCritical(l) << DevicePropertiesReply.error().message(); + continue; + } + + const QVariantMap &dict = DevicePropertiesReply.value(); + + QString tmp = dict["Name"].toString(); + qCDebug(l) << "Found BT device:" << tmp; + if (tmp.startsWith("Pebble")) { + qCDebug(l) << "Found Pebble:" << tmp; + QBluetoothAddress addr(dict["Address"].toString()); + QBluetoothLocalDevice dev; + if (dev.pairingStatus(addr) == QBluetoothLocalDevice::AuthorizedPaired) { + pebbles.insert(dict["Name"].toString(), addr); + } + } } + + if (pebbles.size()) { + scheduleReconnect(); + } + + return true; } void WatchConnector::disconnect() @@ -158,11 +212,23 @@ void WatchConnector::disconnect() qCDebug(l) << "stopped timers"; } -void WatchConnector::handleWatch(const QString &name, const QString &address) +void WatchConnector::connect() { - qCDebug(l) << "handleWatch" << name << address; + if (currentPebble >= pebbles.count()) { + currentPebble = 0; + } + + QString _name = pebbles.keys().at(currentPebble); + QBluetoothAddress _address = pebbles.value(_name); + + qCDebug(l) << "connect watch" << currentPebble << _name << _address.toString(); reconnectTimer.stop(); + if (_address.isNull()) { + qCWarning(l) << "No known pebble"; + return; + } + // Check if bluetooth is on QBluetoothLocalDevice host; bool btOff = host.hostMode() == QBluetoothLocalDevice::HostPoweredOff; @@ -177,20 +243,18 @@ void WatchConnector::handleWatch(const QString &name, const QString &address) socket->deleteLater(); } - _last_name = name; - _last_address = address; _versions.clear(); qCDebug(l) << "Creating socket"; socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol); - connect(socket, SIGNAL(readyRead()), SLOT(onReadSocket())); - connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(onBytesWritten(qint64))); - connect(socket, SIGNAL(connected()), SLOT(onConnected())); - connect(socket, SIGNAL(disconnected()), SLOT(onDisconnected())); - connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(onError(QBluetoothSocket::SocketError))); + QObject::connect(socket, SIGNAL(readyRead()), SLOT(onReadSocket())); + QObject::connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(onBytesWritten(qint64))); + QObject::connect(socket, SIGNAL(connected()), SLOT(onConnected())); + QObject::connect(socket, SIGNAL(disconnected()), SLOT(onDisconnected())); + QObject::connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(onError(QBluetoothSocket::SocketError))); // FIXME: Assuming port 1 (with Pebble) - socket->connectToService(QBluetoothAddress(address), 1); + socket->connectToService(_address, 1); } QString WatchConnector::decodeEndpoint(uint val) @@ -315,7 +379,9 @@ void WatchConnector::onConnected() } sendMessage(watchVERSION, QByteArray(1, 0)); emit connectedChanged(); - if (name() != _last_name) emit nameChanged(); + quint64 new_address = address().toUInt64(); + if (new_address != _last_address) emit pebbleChanged(); + _last_address = new_address; time(); } } @@ -354,7 +420,11 @@ void WatchConnector::scheduleReconnect() void WatchConnector::onError(QBluetoothSocket::SocketError error) { if (error == QBluetoothSocket::UnknownSocketError) { - qCDebug(l) << error << socket->errorString(); + QString errorString = socket->errorString(); + qCDebug(l) << error << errorString; + if (errorString.endsWith(" down")) { + currentPebble++; + } } else { qCCritical(l) << "error connecting Pebble:" << error << socket->errorString(); } @@ -365,7 +435,7 @@ void WatchConnector::sendData(const QByteArray &data) writeData.append(data); if (socket == nullptr) { qCDebug(l) << "no socket - reconnecting"; - reconnect(); + connect(); } else if (is_connected) { qCDebug(l) << "writing" << data.length() << "bytes to socket"; if (PROTOCOL_DEBUG) qCDebug(l) << data.toHex(); diff --git a/daemon/watchconnector.h b/daemon/watchconnector.h index f9576a3..fa65f6b 100644 --- a/daemon/watchconnector.h +++ b/daemon/watchconnector.h @@ -8,10 +8,8 @@ #include <QStringList> #include <QTimer> #include <QDateTime> -#include <QBluetoothDeviceInfo> -#include <QBluetoothLocalDevice> #include <QBluetoothSocket> -#include <QBluetoothServiceInfo> +#include <QBluetoothAddress> #include <QLoggingCategory> class WatchConnector : public QObject @@ -21,7 +19,7 @@ class WatchConnector : public QObject Q_ENUMS(Endpoint) - Q_PROPERTY(QString name READ name NOTIFY nameChanged) + Q_PROPERTY(QString name READ name NOTIFY pebbleChanged) Q_PROPERTY(QString connected READ isConnected NOTIFY connectedChanged) public: @@ -150,14 +148,19 @@ public: enum HardwareRevision { UNKNOWN = 0, - PEBBLE_ONE_EV1 = 1, - PEBBLE_ONE_EV2 = 2, - PEBBLE_ONE_EV2_3 = 3, - PEBBLE_ONE_EV2_4 = 4, - PEBBLE_ONE_POINT_FIVE = 5, - PEBBLE_TWO_POINT_ZERO = 6, - PEBBLE_ONE_BIGBOARD_2 = 254, - PEBBLE_ONE_BIGBOARD = 255 + TINTIN_EV1 = 1, + TINTIN_EV2 = 2, + TINTIN_EV2_3 = 3, + TINTIN_EV2_4 = 4, + TINTIN_V1_5 = 5, + BIANCA = 6, + SNOWY_EVT2 = 7, + SNOWY_DVT = 8, + + TINTIN_BB = 0xFF, + TINTIN_BB2 = 0xFE, + SNOWY_BB = 0xFD, + SNOWY_BB2 = 0xFC }; QMap<HardwareRevision, QString> firmwareMapping; @@ -200,7 +203,8 @@ public: virtual ~WatchConnector(); inline bool isConnected() const { return is_connected; } - inline QString name() const { return socket != nullptr ? socket->peerName() : ""; } + inline QString name() const { return pebbles.keys(address()).at(0); } + inline QBluetoothAddress address() const { return socket != nullptr ? socket->peerAddress() : QBluetoothAddress(); } inline WatchVersions versions() const { return _versions; } void setEndpointHandler(uint endpoint, const EndpointHandlerFunc &func); @@ -210,15 +214,15 @@ public: static QString decodeEndpoint(uint val); signals: - void nameChanged(); + void pebbleChanged(); void versionsChanged(); void connectedChanged(); public slots: - void deviceConnect(const QString &name, const QString &address); + bool findPebbles(); void scheduleReconnect(); + void connect(); void disconnect(); - void reconnect(); void sendMessage(uint endpoint, const QByteArray &data, const EndpointHandlerFunc &callback = EndpointHandlerFunc()); void ping(uint cookie); @@ -243,8 +247,6 @@ public slots: void endPhoneCall(uint cookie=0); private slots: - void deviceDiscovered(const QBluetoothDeviceInfo&); - void handleWatch(const QString &name, const QString &address); void onReadSocket(); void onBytesWritten(qint64); void onConnected(); @@ -262,8 +264,9 @@ private: QByteArray writeData; QTimer reconnectTimer; QTimer timeSyncTimer; - QString _last_name; - QString _last_address; + QMap<QString,QBluetoothAddress> pebbles; + int currentPebble; + quint64 _last_address; WatchVersions _versions; }; diff --git a/rpm/pebble.changes b/rpm/pebble.changes index 2d60c1d..0a2350c 100644 --- a/rpm/pebble.changes +++ b/rpm/pebble.changes @@ -1,3 +1,7 @@ +* Tue May 19 2015 Tomasz Sterna <tomek@xiaoka.com> 1.2 +- Automatic time synchronization with watch +- Chinese translation + * Mon May 11 2015 Tomasz Sterna <tomek@xiaoka.com> 1.1 - Do not reconnect to the watch if Bluetooth is switched off - AppStore logout remorse timer diff --git a/rpm/pebble.spec b/rpm/pebble.spec index 395b441..bc1612d 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.1 +Version: 1.2 Release: 1 Group: Qt/Qt License: GPL3 diff --git a/rpm/pebble.yaml b/rpm/pebble.yaml index 4b9ebac..7c115c8 100644 --- a/rpm/pebble.yaml +++ b/rpm/pebble.yaml @@ -1,6 +1,6 @@ Name: pebble Summary: Support for Pebble watch in SailfishOS -Version: 1.1 +Version: 1.2 Release: 1 Group: Qt/Qt URL: http://getpebble.com/ |
