summaryrefslogtreecommitdiff
path: root/metawatch/metawatch.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-10-17 02:00:08 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-10-17 02:00:08 +0200
commit3c33f68f29110efd7b034337947f90f085ef239a (patch)
tree5e58a299458b12e72161b5695ddbc1c3195b9ff6 /metawatch/metawatch.h
parent5302574ee3a3913771dd37bfe88d7600862baff3 (diff)
downloadsowatch-3c33f68f29110efd7b034337947f90f085ef239a.tar.gz
sowatch-3c33f68f29110efd7b034337947f90f085ef239a.zip
initial nval reading support
watch behaves weirdly when used, so don't for now.
Diffstat (limited to 'metawatch/metawatch.h')
-rw-r--r--metawatch/metawatch.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/metawatch/metawatch.h b/metawatch/metawatch.h
index 685b2a7..d468bc1 100644
--- a/metawatch/metawatch.h
+++ b/metawatch/metawatch.h
@@ -61,6 +61,14 @@ public:
ReadLightSensorResponse = 0x59
};
+ enum NvalValue {
+ ReservedNval = 0,
+ LinkKey = 0x1,
+ IdleBufferConfiguration = 0x2,
+ TimeFormat = 0x2009,
+ DateFormat = 0x200a
+ };
+
enum Mode {
IdleMode = 0,
ApplicationMode = 1,
@@ -174,10 +182,14 @@ protected:
{ }
};
+ /** The "packets to be sent" asynchronous queue **/
QQueue<Message> _toSend;
QTimer* _sendTimer;
Message _partialReceived;
+ /** Pending nvals to be written once the read operation is finished. */
+ QMap<NvalValue, int> _nvals;
+
static const quint8 bitRevTable[16];
static const quint16 crcTable[256];
static quint16 calcCrc(const QByteArray& data, int size);
@@ -190,6 +202,9 @@ protected:
*/
void sendIfNotQueued(const Message& msg);
+ static uint nvalSize(NvalValue value);
+ void nvalWrite(NvalValue value, int data);
+
/* Some functions that wrap sending some watch messages. */
void setVibrateMode(bool enable, uint on, uint off, uint cycles);
void updateLcdLine(Mode mode, const QImage& image, int line);
@@ -204,6 +219,7 @@ protected:
void handleMessage(const Message& msg);
void handleDeviceTypeMessage(const Message& msg);
void handleRealTimeClockMessage(const Message& msg);
+ void handleNvalOperationMessage(const Message& msg);
void handleStatusChangeMessage(const Message& msg);
void handleButtonEventMessage(const Message& msg);
void handleBatteryVoltageMessage(const Message& msg);