Re: [FYI] Post-XML
Alex Judd <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Works fine for me here and is definitely needed for phones that don't
support CMT:. The main bit of code (for those interested is below). Works
out which slot to read, requests the message, decodes it, then deletes it.
if (-1 != octstr_search(line, octstr_imm("+CMTI:"), 0))
{
buf = gw_malloc(5);
buf2 = gw_malloc(20);
octstr_get_many_chars(buf, line, octstr_len(line) - 3, 3); /* work out which message to read */
buf[3] = '\0';
sprintf(buf2, "%s%s", "AT+CMGR=", buf);
at2_write_line(privdata, buf2); /* display message contents */
line = at2_wait_line(privdata,1,0); /* read header */
line2 = at2_wait_line(privdata,1,0); /* read PDU */
if(line2 == NULL)
{
error(0,"AT2[%s]: got +CMTI but waiting for next line timed out", octstr_get_cstr(privdata->name));
}
else
{
octstr_append_cstr(line,"\n");
octstr_append(line,line2);
at2_pdu_extract(privdata, &pdu, line);
if(pdu == NULL)
{
error(0,"AT2[%s]: got +CMTI but pdu_extract failed", octstr_get_cstr(privdata->name));
}
else
{
msg = at2_pdu_decode(pdu, privdata);
if(msg != NULL)
{
msg->sms.smsc_id = octstr_duplicate(privdata->conn->id);
bb_smscconn_receive(privdata->conn, msg);
}
sprintf(buf2, "%s%s", "AT+CMGD=", buf); /* delete SMS */
at2_write_line(privdata, buf2);
line = at2_wait_line(privdata,1,0); /* read response */
}
}
}
Alex
On Tue, 30 Apr 2002, Andrea Viscovich wrote:
>
> >1. Addition of CMTI: reading of SIM stored messages from AT devices in
> >AT2. Needed to add support for the Motorola P7389i. Had to modify the
> >at2_pdu_extract to cope with the two.
>
> Hi Alex,
> This has really to be done. I already did it for myself,
> but didn't send any patch as Oded said there could be no +CMTI: if
> ta-te link is reserved.
> The other thing to do is dlr for at2 :-)
> Cheers
> Andrea
>
>
--
Alex Judd
http://www.skywire.co.uk