comparison uptools/atcmd/smsend_pduout.c @ 379:a38805b5b6d4

uptools/atcmd: smsend_pdugen.c split off from smsend_pduout.c
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 09 Mar 2018 00:27:24 +0000
parents e61525f082bd
children dc2fd8e6f42c
comparison
equal deleted inserted replaced
378:e61525f082bd 379:a38805b5b6d4
1 /* 1 /*
2 * This module implements SMS sending/writing in PDU mode. 2 * This module implements the output part of SMS sending/writing in PDU mode.
3 */ 3 */
4 4
5 #include <sys/types.h>
6 #include <stdio.h> 5 #include <stdio.h>
7 6
8 extern void cmgw_callback(); 7 extern void cmgw_callback();
9 8
10 extern int sms_write_mode; 9 extern int sms_write_mode;
30 callback = 0; 29 callback = 0;
31 } 30 }
32 sprintf(send_cmd, "AT+%s=%u", cmdname, pdulen); 31 sprintf(send_cmd, "AT+%s=%u", cmdname, pdulen);
33 atinterf_exec_cmd_needok(send_cmd, pduhex, callback); 32 atinterf_exec_cmd_needok(send_cmd, pduhex, callback);
34 } 33 }
35
36 send_in_pdu_mode(da, textsrc, textlen, udh, udhl)
37 u_char *da, *textsrc, *udh;
38 unsigned textlen, udhl;
39 {
40 u_char pdu[158];
41 unsigned pdulen;
42 char pduhex[317];
43
44 pdu[0] = 0;
45 pdulen = make_sms_submit_pdu(da, 0, 0, textsrc, textlen, udh, udhl,
46 pdu + 1);
47 make_hex_string(pdu, pdulen + 1, pduhex);
48 send_pdu_out(pduhex, pdulen);
49 }
50
51 send_pdu_ucs2(da, textsrc, textlen, udh, udhl)
52 u_char *da, *udh;
53 u_short *textsrc;
54 unsigned textlen, udhl;
55 {
56 u_char ucs2_be[140], pdu[158];
57 unsigned pdulen;
58 char pduhex[317];
59
60 ucs2_out_bigend(textsrc, ucs2_be, textlen);
61 pdu[0] = 0;
62 pdulen = make_sms_submit_pdu_8bit(da, 0, 0x08, ucs2_be, textlen * 2,
63 udh, udhl, pdu + 1);
64 make_hex_string(pdu, pdulen + 1, pduhex);
65 send_pdu_out(pduhex, pdulen);
66 }