diff options
author | Pasi Miettinen <pasi.miettinen@ixonos.com> | 2010-06-04 14:17:32 +0300 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-06-04 14:21:57 -0500 |
commit | 6220c01f4a5482699df5da6550bd9894c3e49a85 (patch) | |
tree | b5f6081e817fa55b738d9848fb3f4dfefcb7bb7e | |
parent | 5dab6f49133f3ba606fb2a6f60f0d8860f2c4e11 (diff) | |
download | ofono-6220c01f4a5482699df5da6550bd9894c3e49a85.tar.bz2 |
Change in at_cds_notify for status report
-rw-r--r-- | drivers/atmodem/sms.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c index 439beeaf..74e80764 100644 --- a/drivers/atmodem/sms.c +++ b/drivers/atmodem/sms.c @@ -283,16 +283,27 @@ static void at_cds_notify(GAtResult *result, gpointer user_data) { struct ofono_sms *sms = user_data; struct sms_data *data = ofono_sms_get_data(sms); - int pdulen; - const char *pdu; + long pdu_len; + int tpdu_len; + const char *hexpdu; + unsigned char pdu[176]; char buf[256]; - if (!at_parse_pdu_common(result, "+CDS:", &pdu, &pdulen)) { + if (!at_parse_pdu_common(result, "+CDS:", &hexpdu, &tpdu_len)) { ofono_error("Unable to parse CDS notification"); return; } - DBG("Got new Status-Report PDU via CDS: %s, %d", pdu, pdulen); + if (strlen(hexpdu) > sizeof(pdu) * 2) { + ofono_error("Bad PDU length in CDS notification"); + return; + } + + DBG("Got new Status-Report PDU via CDS: %s, %d", hexpdu, tpdu_len); + + /*Decode pdu and notify about new SMS status report*/ + decode_hex_own_buf(hexpdu, -1, &pdu_len, 0, pdu); + ofono_sms_status_notify(sms, pdu, pdu_len, tpdu_len); /* We must acknowledge the PDU using CNMA */ if (data->cnma_ack_pdu) |