annotate uptools/atcmd/smsend_pdugen.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 encoding 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 <sys/types.h>
378
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
6
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
7 send_in_pdu_mode(da, textsrc, textlen, udh, udhl)
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
8 u_char *da, *textsrc, *udh;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
9 unsigned textlen, udhl;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
10 {
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
11 u_char pdu[158];
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
12 unsigned pdulen;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
13 char pduhex[317];
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
14
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
15 pdu[0] = 0;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
16 pdulen = make_sms_submit_pdu(da, 0, 0, textsrc, textlen, udh, udhl,
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
17 pdu + 1);
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
18 make_hex_string(pdu, pdulen + 1, pduhex);
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
19 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
20 }
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
21
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
22 send_pdu_ucs2(da, textsrc, textlen, udh, udhl)
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
23 u_char *da, *udh;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
24 u_short *textsrc;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
25 unsigned textlen, udhl;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
26 {
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
27 u_char ucs2_be[140], pdu[158];
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
28 unsigned pdulen;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
29 char pduhex[317];
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
30
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
31 ucs2_out_bigend(textsrc, ucs2_be, textlen);
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
32 pdu[0] = 0;
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
33 pdulen = make_sms_submit_pdu_8bit(da, 0, 0x08, ucs2_be, textlen * 2,
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
34 udh, udhl, pdu + 1);
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
35 make_hex_string(pdu, pdulen + 1, pduhex);
e61525f082bd uptools/atcmd/smsend_pduout.c: added UCS-2 function, some refactoring
Mychaela Falconia <falcon@freecalypso.org>
parents: 374
diff changeset
36 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
37 }