FreeCalypso > hg > freecalypso-tools
view uptools/atcmd/smsend_pduout.c @ 374:d1fa771abeb8
uptools: make_sms_submit_pdu() in libcoding now takes PID and DCS arguments
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 08 Mar 2018 20:33:03 +0000 |
parents | 1e7c6fcb9abe |
children | e61525f082bd |
line wrap: on
line source
/* * This module implements SMS sending/writing in PDU mode. */ #include <sys/types.h> #include <stdio.h> extern void cmgw_callback(); extern int sms_write_mode; prep_for_pdu_mode() { atinterf_exec_cmd_needok("AT+CMGF=0", 0, 0); } send_in_pdu_mode(da, textsrc, textlen, udh, udhl) u_char *da, *textsrc, *udh; unsigned textlen, udhl; { char *cmdname; void (*callback)(); u_char pdu[158]; unsigned pdulen; char pduhex[317]; char send_cmd[32]; pdu[0] = 0; pdulen = make_sms_submit_pdu(da, 0, 0, textsrc, textlen, udh, udhl, pdu + 1); make_hex_string(pdu, pdulen + 1, pduhex); if (sms_write_mode) { cmdname = "CMGW"; callback = cmgw_callback; } else { cmdname = "CMGS"; callback = 0; } sprintf(send_cmd, "AT+%s=%u", cmdname, pdulen); atinterf_exec_cmd_needok(send_cmd, pduhex, callback); }