[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-55
From: |
Daniele Forsi |
Subject: |
[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-553-gc06c985 |
Date: |
Wed, 08 Jan 2014 22:01:40 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".
The branch, master has been updated
via c06c985dab74469734e92e176f61a59d2444d5fa (commit)
from 1de251a0fe70d885d26a47c257a3d7112a64f0ec (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=c06c985dab74469734e92e176f61a59d2444d5fa
commit c06c985dab74469734e92e176f61a59d2444d5fa
Author: Daniele Forsi <address@hidden>
Date: Wed Jan 8 12:11:04 2014 +0100
Add a bunch of unsolicited clock frames
Most of those frames aren't seen during normal usage because
channel 0x19 isn't subcribed.
Tested on Nokia 5300 (Series 40 3rd) with this code:
static int foogle(int argc, char *argv[])
{
gn_error error;
unsigned char req[] = {FBUS_FRAME_HEADER, NK6510_MSG_SUBSCRIBE, 01,
NK6510_MSG_CLOCK};
gn_raw_buffer write_buffer = {NK6510_MSG_SUBSCRIBE, sizeof(req), req};
if (businit() != 0)
return GN_ERR_FAILED;
data->write_buffer = &write_buffer;
data->read_buffer = NULL; /* if read_buffer is NULL we don't expect a
response */
error = gn_sm_functions(GN_OP_Passthrough, data, state);
if (error == GN_ERR_NONE) {
/* Now execute any operation to get a chance to receive
unsolicited messages */
while (1) {
gn_sm_functions(GN_OP_GetRFLevel, data, state);
sleep(1);
}
} else {
fprintf(stderr, _("Error: %s\n"), gn_error_print(error));
}
return error;
}
diff --git a/common/phones/nk6510.c b/common/phones/nk6510.c
index e8366fa..853de98 100644
--- a/common/phones/nk6510.c
+++ b/common/phones/nk6510.c
@@ -3244,8 +3244,9 @@ reply: 0x19 / 0x0012
01 56
*/
- dprintf("Incoming clock!\n");
if (!data) return GN_ERR_INTERNALERROR;
+
+ /* FIXME: code below should handle subblocks but it works because
frames seem to contain only 1 subblock */
switch (message[3]) {
case NK6510_SUBCLO_SET_DATE_RCVD:
dprintf("Date/Time successfully set!\n");
@@ -3253,23 +3254,47 @@ reply: 0x19 / 0x0012
case NK6510_SUBCLO_SET_ALARM_RCVD:
dprintf("Alarm successfully set!\n");
break;
+ case NK6510_SUBCLO_GMT_UPD_RCVD:
+ case NK6510_SUBCLO_DATE_UPD_RCVD:
+ case NK6510_SUBCLO_DATE_SEC_UPD_RCVD:
+ case NK6510_SUBCLO_DATE_MIN_UPD_RCVD:
case NK6510_SUBCLO_DATE_RCVD:
+ dprintf("Date/Time received! subtype 0x%02x date %04d/%02d/%02d
time %02d:%02d:%02d\n",
+ message[3], (message[10] << 8) + message[11],
message[12], message[13], message[14], message[15], message[16]);
+ switch (message[3]) {
+ case NK6510_SUBCLO_GMT_UPD_RCVD:
+ /* This is a signed value that shows the nominal
adjustment, eg. if current time is 16:31:25, the phone UI allows
+ you to advance the GMT 1 hour to 17:31, the number
of seconds is 3600) */
+ /* Same length as subtype 0x05 but date is zeroed and
number of seconds has a different endianess!!! */
+ dprintf("Date/Time adjusted by %d seconds\n",
(((((message[25] << 8) + message[24]) << 8) + message[23]) << 8) + message[22]);
+ break;
+ case NK6510_SUBCLO_DATE_UPD_RCVD:
+ /* This is a signed value that shows the actual
adjustment, eg. if current time is 16:31:25, the phone UI allows
+ you to advance 1 hour to 17:31, the number of
seconds is 3600 - 25 = 3575) */
+ dprintf("Date/Time adjusted by %d seconds\n",
(((((message[22] << 8) + message[23]) << 8) + message[24]) << 8) + message[25]);
+ break;
+ }
if (!data->datetime) return GN_ERR_INTERNALERROR;
- dprintf("Date/Time received!\n");
data->datetime->year = (((unsigned int)message[10]) << 8) +
message[11];
data->datetime->month = message[12];
data->datetime->day = message[13];
data->datetime->hour = message[14];
data->datetime->minute = message[15];
data->datetime->second = message[16];
-
break;
+ case NK6510_SUBCLO_ALARM_DEL_RCVD:
+ case NK6510_SUBCLO_ALARM_ADD_RCVD:
+ case NK6510_SUBCLO_ALARM_OLD_RCVD:
+ case NK6510_SUBCLO_ALARM_NOW_RCVD:
case NK6510_SUBCLO_ALARM_TIME_RCVD:
+ dprintf("Alarm received! subtype 0x%02x date %04d/%02d/%02d
time %02d:%02d:%02d\n",
+ message[3], (message[10] << 8) + message[11],
message[12], message[13], message[14], message[15], message[16]);
if (!data->alarm) return GN_ERR_INTERNALERROR;
data->alarm->timestamp.hour = message[14];
data->alarm->timestamp.minute = message[15];
break;
case NK6510_SUBCLO_ALARM_STATE_RCVD:
+ dprintf("Alarm state received! state 0x%02x\n", message[8]);
if (!data->alarm) return GN_ERR_INTERNALERROR;
switch(message[37]) {
case NK6510_ALARM_ENABLED:
@@ -3285,6 +3310,19 @@ reply: 0x19 / 0x0012
break;
}
break;
+ case NK6510_SUBCLO_GMT_OFFSET_RCVD:
+ switch (message[8]) {
+ case 0x0a: /* 01 30 01 09 00 01 05 08 0a 00 00 8e 00 08 */
+ /* Offset is the sign-magnitude representation of the
number of quarters of hour (ie. GMT-3:30 is 0x8e) */
+ dprintf("GMT offset change received!");
+ dprintf(" old GMT%c%02d:%02d", message[11] & 0x80 ? '-'
: '+', (message[11] & 0x7f) / 4, (message[11] & 0x03) * 15);
+ dprintf(" new GMT%c%02d:%02d", message[13] & 0x80 ? '-'
: '+', (message[13] & 0x7f) / 4, (message[13] & 0x03) * 15);
+ dprintf("\n");
+ break;
+ case 0x04: /* Sent just before an alarm is played 01 30 01 09
00 01 05 08 04 00 00 02 00 01 */
+ default:
+ error = GN_ERR_UNHANDLEDFRAME;
+ }
case 0xf0:
error = GN_ERR_NOTSUPPORTED;
break;
diff --git a/include/phones/nk6510.h b/include/phones/nk6510.h
index 2bdab7c..15e73d1 100644
--- a/include/phones/nk6510.h
+++ b/include/phones/nk6510.h
@@ -77,10 +77,19 @@ typedef enum {
#define NK6510_SUBCLO_GET_DATE 0x0a /* Get date & time */
#define NK6510_SUBCLO_GET_ALARM 0x02 /* Get alarm */
/* Clock handling message subtypes (recv) */
+/* Unsolicited (UNS) frames are received when channel NK6510_MSG_CLOCK (0x19)
is subscribed */
#define NK6510_SUBCLO_DATE_RCVD 0x0b /* Received date & time
*/
#define NK6510_SUBCLO_SET_DATE_RCVD 0x02 /* Received date & time set OK
*/
+#define NK6510_SUBCLO_GMT_UPD_RCVD 0x04 /* (UNS) received if GMT offset
is (manually) adjusted */
+#define NK6510_SUBCLO_DATE_UPD_RCVD 0x05 /* (UNS) received if time is
(manually) adjusted */
+#define NK6510_SUBCLO_ALARM_ADD_RCVD 0x06 /* (UNS) alarm to add, received
if alarm is enabled when date/time is (manually) adjusted */
+#define NK6510_SUBCLO_ALARM_OLD_RCVD 0x08 /* (UNS) alarm that didn't play
because date/time was (manually) advanced skipping it */
+#define NK6510_SUBCLO_GMT_OFFSET_RCVD 0x09 /* (UNS) received when GMT
offset is (manually) adjusted */
+#define NK6510_SUBCLO_DATE_SEC_UPD_RCVD 0x0e /* (UNS) received every
second only if the Time menu is open */
+#define NK6510_SUBCLO_DATE_MIN_UPD_RCVD 0x0f /* (UNS) received every
minute at 00 seconds, regardless of which menu is open */
#define NK6510_SUBCLO_SET_ALARM_RCVD 0x12 /* Received alarm set OK */
-#define NK6510_SUBCLO_DATE_UPD_RCVD 0x0e /* Received update on date &
time */
+#define NK6510_SUBCLO_ALARM_DEL_RCVD 0x13 /* (UNS) alarm to delete,
received if alarm is enabled when date/time is (manually) adjusted */
+#define NK6510_SUBCLO_ALARM_NOW_RCVD 0x16 /* (UNS) alarm is ringing now */
#define NK6510_SUBCLO_ALARM_TIME_RCVD 0x1a /* Received alarm time */
#define NK6510_SUBCLO_ALARM_STATE_RCVD 0x20 /* Received alarm state
(on/off) */
/* Alarm on/off */
-----------------------------------------------------------------------
Summary of changes:
common/phones/nk6510.c | 44 +++++++++++++++++++++++++++++++++++++++++---
include/phones/nk6510.h | 11 ++++++++++-
2 files changed, 51 insertions(+), 4 deletions(-)
hooks/post-receive
--
libgnokii and core programs
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-553-gc06c985,
Daniele Forsi <=