view uptools/atcmd/smsend_pduout.c @ 565:4a199ff4b23f

loadtools/scripts/gta02.config: use WS=4 for consistency with generic configs which also work on GTA02 and GTA01 targets
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 31 Jan 2020 06:18:10 +0000
parents dc2fd8e6f42c
children
line wrap: on
line source

/*
 * This module implements the output part of SMS sending/writing in PDU mode.
 */

#include <stdio.h>

extern void cmgw_callback();

extern int sms_write_mode;

prep_for_pdu_mode()
{
	atinterf_exec_cmd_needok("AT+CMGF=0", (char *) 0, (void *) 0);
}

send_pdu_out(pduhex, pdulen)
	char *pduhex;
	unsigned pdulen;
{
	char *cmdname;
	void (*callback)();
	char send_cmd[32];

	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);
}