FreeCalypso > hg > freecalypso-tools
annotate uptools/atcmd/smsend_pduout.c @ 407:19e5a3e2f9c0
fcup-settime: moved time() retrieval a little closer to the output
A fundamental problem with all simple time transfer tools is that there is
always some delay between the time retrieval on the source system and that
transmitted time being set on the destination, and the resulting time
on the destination system is off by that delay amount. This delay cannot
be fully eliminated when working in a simple environment like ours,
but we should make our best effort to minimize it. In the present case,
moving the atinterf_init() call before the time() retrieval should make
a teensy-tiny improvement.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 11 Aug 2018 21:52:17 +0000 |
parents | a38805b5b6d4 |
children | dc2fd8e6f42c |
rev | line source |
---|---|
362
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
379
a38805b5b6d4
uptools/atcmd: smsend_pdugen.c split off from smsend_pduout.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
378
diff
changeset
|
2 * This module implements the output part of SMS sending/writing in PDU mode. |
362
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdio.h> |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 extern void cmgw_callback(); |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 extern int sms_write_mode; |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 prep_for_pdu_mode() |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 { |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 atinterf_exec_cmd_needok("AT+CMGF=0", 0, 0); |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 } |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
378
e61525f082bd
uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents:
374
diff
changeset
|
16 send_pdu_out(pduhex, pdulen) |
e61525f082bd
uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents:
374
diff
changeset
|
17 char *pduhex; |
e61525f082bd
uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents:
374
diff
changeset
|
18 unsigned pdulen; |
362
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 { |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 char *cmdname; |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 void (*callback)(); |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 char send_cmd[32]; |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 if (sms_write_mode) { |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 cmdname = "CMGW"; |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 callback = cmgw_callback; |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 } else { |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 cmdname = "CMGS"; |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 callback = 0; |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 } |
363
46cf847781bd
fcup-smsend: buglet in PDU mode length manipulations
Mychaela Falconia <falcon@freecalypso.org>
parents:
362
diff
changeset
|
31 sprintf(send_cmd, "AT+%s=%u", cmdname, pdulen); |
362
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 atinterf_exec_cmd_needok(send_cmd, pduhex, callback); |
89fe66cb60f6
fcup-smsend program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } |