diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-03-29 17:49:12 +0100 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-03-29 17:49:12 +0100 |
commit | 4683efe227cd1cf81ff7d7ad845e2a6f53bcd6e1 (patch) | |
tree | 03448543acdaeddf378f130e9e6847494fcdb5cf | |
parent | 1fac65b02e813a446d9ae01c90b67c700f18de32 (diff) | |
download | sowatch-4683efe227cd1cf81ff7d7ad845e2a6f53bcd6e1.tar.gz sowatch-4683efe227cd1cf81ff7d7ad845e2a6f53bcd6e1.zip |
recognize every mw as digital, workaround btns issuesowatch_0_4_4
-rw-r--r-- | metawatch/metawatch.cpp | 6 | ||||
-rw-r--r-- | metawatch/metawatchdigital.cpp | 11 | ||||
-rw-r--r-- | metawatch/metawatchscanner.cpp | 21 |
3 files changed, 17 insertions, 21 deletions
diff --git a/metawatch/metawatch.cpp b/metawatch/metawatch.cpp index 510db2c..a8eab4d 100644 --- a/metawatch/metawatch.cpp +++ b/metawatch/metawatch.cpp @@ -514,8 +514,7 @@ void MetaWatch::updateLcdLines(Mode mode, const QImage& image, const QVector<boo void MetaWatch::configureLcdIdleSystemArea(bool entireScreen) { - Message msg(ConfigureLcdIdleBufferSize, QByteArray(26, 0)); - msg.data[0] = entireScreen ? 1 : 0; + Message msg(ConfigureLcdIdleBufferSize, QByteArray(1, entireScreen ? 1 : 0)); send(msg); } @@ -555,6 +554,9 @@ void MetaWatch::enableButton(Mode mode, Button button, ButtonPress press) // the pressed button and the event code were. msg.data[4] = 0x80 | ((press << 4) & 0x30) | (button & 0xF); + qDebug() << "enable button" << button << "(" << press << ")" << + "in mode" << mode << "to" << static_cast<unsigned char>(msg.data[4]); + send(msg); } diff --git a/metawatch/metawatchdigital.cpp b/metawatch/metawatchdigital.cpp index 31f3276..147fd79 100644 --- a/metawatch/metawatchdigital.cpp +++ b/metawatch/metawatchdigital.cpp @@ -339,16 +339,17 @@ void MetaWatchDigital::handleWatchConnected() // Grab all of the buttons that are of interest to us // We do not grab the F button, as it triggers the LED. grabButton(IdleMode, BtnA); // Required for app-switch - grabButton(IdleMode, BtnB); // What does this do? - grabButton(IdleMode, BtnD); // Currently not supported - grabButton(NotificationMode, BtnA); - grabButton(NotificationMode, BtnB); - grabButton(NotificationMode, BtnC); + // TODO: Grabbing these buttons seems to break everything + //grabButton(IdleMode, BtnB); // What does this do? + //grabButton(IdleMode, BtnE); // Music mode is currently not supported grabButton(ApplicationMode, BtnA); grabButton(ApplicationMode, BtnB); grabButton(ApplicationMode, BtnC); grabButton(ApplicationMode, BtnD); grabButton(ApplicationMode, BtnE); + grabButton(NotificationMode, BtnA); + grabButton(NotificationMode, BtnB); + grabButton(NotificationMode, BtnC); // Configure to show watch-rendered clock in idle screen configureLcdIdleSystemArea(false); diff --git a/metawatch/metawatchscanner.cpp b/metawatch/metawatchscanner.cpp index 1e43115..6abe4a6 100644 --- a/metawatch/metawatchscanner.cpp +++ b/metawatch/metawatchscanner.cpp @@ -30,28 +30,21 @@ void MetaWatchScanner::handleDiscoveredService(const QBluetoothServiceInfo &info { const QBluetoothDeviceInfo dev = info.device(); QString deviceName = dev.name(); - if (deviceName.startsWith("MetaWatch", Qt::CaseInsensitive)) { + if (deviceName.startsWith("MetaWatch")) { QVariantMap foundInfo; foundInfo["address"] = dev.address().toString(); foundInfo["name"] = deviceName; qDebug() << "metawatch bluetooth scan found:" << deviceName; - // "MetaWatch Digital" was AU2000 with preSTRATA firmware - // "MetaWatch SW12" seems to be STRATA - // "MetaWatch 99" seems to be AU2000 with STRATA firmware - if (deviceName.contains("Digital", Qt::CaseInsensitive) || - deviceName.contains("SW12") || deviceName.contains("99")) { - foundInfo["driver"] = QString("metawatch-digital"); - foundInfo["next-watchlet-button"] = QString("A"); - emit watchFound(foundInfo); - // "MetaWatch Analog" is the only analog watch released so far, preSTRATA fw - // "MetaWatch WDS111" (seems) analog watch with STRATA fw - } else if (deviceName.contains("Analog", Qt::CaseInsensitive) || - deviceName.contains("WDS111", Qt::CaseInsensitive)) { + if (deviceName.contains("Analog")) { + // This is Analog metawatch. foundInfo["driver"] = QString("metawatch-analog"); foundInfo["next-watchlet-button"] = QString("A"); emit watchFound(foundInfo); } else { - qWarning() << "Unknown MetaWatch device found:" << deviceName; + // For now, assume Digital metawatch. + foundInfo["driver"] = QString("metawatch-digital"); + foundInfo["next-watchlet-button"] = QString("A"); + emit watchFound(foundInfo); } } } |