summaryrefslogtreecommitdiff
path: root/metawatch
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-12-09 02:26:31 +0100
committerJavier S. Pedro <maemo@javispedro.com>2011-12-09 02:26:31 +0100
commit140c6bfafe91007c7e24ebf59270c8ad8060e875 (patch)
tree59c23a95edb83736fb914ade8fc287c5490528fd /metawatch
parentcbf8e3ad49917dc71e8c5f6413c55f266c1c4ad3 (diff)
downloadsowatch-140c6bfafe91007c7e24ebf59270c8ad8060e875.tar.gz
sowatch-140c6bfafe91007c7e24ebf59270c8ad8060e875.zip
Removing the entire grabButton/ungrab mechanism
Applications&server no longer have to grab/ungrab buttons. Also, LED button should now work everywhere in digital MetaWatch.
Diffstat (limited to 'metawatch')
-rw-r--r--metawatch/metawatch.cpp23
-rw-r--r--metawatch/metawatch.h7
-rw-r--r--metawatch/metawatchanalog.cpp4
-rw-r--r--metawatch/metawatchdigital.cpp12
4 files changed, 25 insertions, 21 deletions
diff --git a/metawatch/metawatch.cpp b/metawatch/metawatch.cpp
index 3f3b831..a5836ad 100644
--- a/metawatch/metawatch.cpp
+++ b/metawatch/metawatch.cpp
@@ -102,7 +102,7 @@ MetaWatch::MetaWatch(const QBluetoothAddress& address, QSettings* settings, QObj
_idleTimer->setSingleShot(true);
connect(_idleTimer, SIGNAL(timeout()), SIGNAL(idling()));
- _ringTimer->setInterval(2500);
+ _ringTimer->setInterval(DelayBetweenRings);
connect(_ringTimer, SIGNAL(timeout()), SLOT(timedRing()));
_connectTimer->setSingleShot(true);
@@ -110,7 +110,7 @@ MetaWatch::MetaWatch(const QBluetoothAddress& address, QSettings* settings, QObj
connect(_connectTimer, SIGNAL(timeout()), SLOT(retryConnect()));
connect(_connectAlignedTimer, SIGNAL(timeout()), SLOT(retryConnect()));
- _sendTimer->setInterval(10);
+ _sendTimer->setInterval(DelayBetweenMessages);
connect(_sendTimer, SIGNAL(timeout()), SLOT(timedSend()));
retryConnect();
@@ -209,16 +209,6 @@ bool MetaWatch::charging() const
return _watchCharging;
}
-void MetaWatch::grabButton(int button)
-{
- grabButton(_currentMode, (Button) button);
-}
-
-void MetaWatch::ungrabButton(int button)
-{
- ungrabButton(_currentMode, (Button) button);
-}
-
void MetaWatch::updateNotificationCount(Notification::Type type, int count)
{
Q_UNUSED(type);
@@ -251,7 +241,7 @@ void MetaWatch::displayNotification(Notification *notification)
_idleTimer->stop();
} else {
_ringTimer->stop();
- setVibrateMode(true, 500, 500, 2);
+ setVibrateMode(true, RingLength, RingLength, 2);
_idleTimer->start();
}
}
@@ -480,6 +470,8 @@ void MetaWatch::enableButton(Mode mode, Button button, ButtonPress press)
msg.data[1] = btnToWatch[button];
msg.data[2] = press;
msg.data[3] = ButtonEvent;
+ // We create a custom event code that allows us to know what
+ // the pressed button and the event code were.
msg.data[4] = 0x80 | ((press << 4) & 0x30) | (button & 0xF);
send(msg);
@@ -682,11 +674,6 @@ void MetaWatch::socketConnected()
// Sync watch date & time
setDateTime(QDateTime::currentDateTime());
- // Grab a few buttons from Notification mode that we handle
- grabButton(NotificationMode, BtnA);
- grabButton(NotificationMode, BtnB);
- grabButton(NotificationMode, BtnC);
-
// Call the MetaWatch Model-specific setup routines
handleWatchConnected();
diff --git a/metawatch/metawatch.h b/metawatch/metawatch.h
index 7ea835f..5a42b8d 100644
--- a/metawatch/metawatch.h
+++ b/metawatch/metawatch.h
@@ -26,6 +26,10 @@ public:
explicit MetaWatch(const QBluetoothAddress& address, QSettings* settings = 0, QObject *parent = 0);
~MetaWatch();
+ static const int DelayBetweenMessages = 10;
+ static const int DelayBetweenRings = 2500;
+ static const int RingLength = 500;
+
enum MessageType {
NoMessage = 0,
GetDeviceType = 0x01,
@@ -109,9 +113,6 @@ public:
void queryCharging();
bool charging() const;
- void grabButton(int button);
- void ungrabButton(int button);
-
void updateNotificationCount(Notification::Type type, int count);
void updateWeather(WeatherNotification *weather);
diff --git a/metawatch/metawatchanalog.cpp b/metawatch/metawatchanalog.cpp
index 0b867da..60993d4 100644
--- a/metawatch/metawatchanalog.cpp
+++ b/metawatch/metawatchanalog.cpp
@@ -2,6 +2,10 @@
using namespace sowatch;
+// TODO : Figure out what to do with the buttons
+// TODO : Figure out how the OLED screen protocol works, including scrolling
+// TODO : Idle and Notification screens for the Analog Metawatch
+
MetaWatchAnalog::MetaWatchAnalog(const QBluetoothAddress& address, QSettings* settings, QObject *parent) :
MetaWatch(address, settings, parent)
{
diff --git a/metawatch/metawatchdigital.cpp b/metawatch/metawatchdigital.cpp
index b91b370..50ce301 100644
--- a/metawatch/metawatchdigital.cpp
+++ b/metawatch/metawatchdigital.cpp
@@ -333,6 +333,18 @@ QImage MetaWatchDigital::iconForNotification(const Notification *n)
void MetaWatchDigital::handleWatchConnected()
{
+ // Grab all of the buttons that are of interest to us
+ // We do not grab the D button, as it triggers the LED.
+ grabButton(IdleMode, BtnA);
+ grabButton(NotificationMode, BtnA);
+ grabButton(NotificationMode, BtnB);
+ grabButton(NotificationMode, BtnC);
+ grabButton(ApplicationMode, BtnA);
+ grabButton(ApplicationMode, BtnB);
+ grabButton(ApplicationMode, BtnC);
+ grabButton(ApplicationMode, BtnE);
+ grabButton(ApplicationMode, BtnF);
+
// Configure to show watch-rendered clock in idle screen
configureLcdIdleSystemArea(false);