summaryrefslogtreecommitdiff
path: root/metawatch/metawatch.cpp
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/metawatch.cpp
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/metawatch.cpp')
-rw-r--r--metawatch/metawatch.cpp23
1 files changed, 5 insertions, 18 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();