Skip to content

Commit 8c5e2e2

Browse files
committed
app: sms: Add timezone into concatenated msg and doc
Normal single SMS reception gives timezone information in the format "UTC+02:00". This was not present for concatenated SMS messages and the format "UTC+02:00" is not mentioned in the documentation. Fixing these. Jira: SM-278 Signed-off-by: Tommi Rantanen <tommi.rantanen@nordicsemi.no>
1 parent b222616 commit 8c5e2e2

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

app/src/sm_at_sms.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@ static void sms_callback(struct sms_data *const data, void *context)
8989
goto done;
9090
}
9191
if (header->concatenated.seq_number == 1) {
92-
sprintf(rsp_buf, "\r\n#XSMS: \"%02d-%02d-%02d %02d:%02d:%02d\",\"",
92+
sprintf(rsp_buf,
93+
"\r\n#XSMS: \"%02d-%02d-%02d %02d:%02d:%02d "
94+
"UTC%+03d:%02d\",\"",
9395
header->time.year, header->time.month, header->time.day,
94-
header->time.hour, header->time.minute,
95-
header->time.second);
96+
header->time.hour, header->time.minute, header->time.second,
97+
header->time.timezone * 15 / 60,
98+
abs(header->time.timezone) * 15 % 60);
9699
strcat(rsp_buf, header->originating_address.address_str);
97100
strcat(rsp_buf, "\",\"");
98101
strcat(rsp_buf, data->payload);

doc/app/at_sms.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ This is the notification syntax when an SMS message is received:
4949

5050
* The ``<datetime>`` parameter is a string.
5151
It represents the time when the SMS is received.
52-
It has a format of ``YY-MM-DD HH:MM:SS``.
52+
It has a format of ``YY-MM-DD HH:MM:SS UTC[+|-]HH:MM``.
5353
* The ``<number>`` parameter is a string.
5454
It represents the SMS sender's phone number.
5555
* The ``<text>`` parameter is a string.
@@ -69,13 +69,13 @@ Example
6969

7070
OK
7171

72-
#XSMS: "21-05-24 11:58:22","090xxxxxxxx","Tested OK"
72+
#XSMS: "21-05-24 11:58:22 UTC+09:30","090xxxxxxxx","Tested OK"
7373

7474
at#xsms=2,"+8190xxxxxxxx","0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
7575

7676
OK
7777

78-
#XSMS: "21-05-24 13:29:47","090xxxxxxxx","0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
78+
#XSMS: "21-05-24 13:29:47 UTC-09:00","090xxxxxxxx","0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
7979

8080
Read command
8181
------------

0 commit comments

Comments
 (0)