summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem/sms.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-06-12 21:32:39 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-06-12 21:43:26 -0500
commit3a2821307228f688656b4ddce32d13b02725b5ad (patch)
treecdc76cbd1ac9828f3d27630e63c4dab074a35a73 /drivers/atmodem/sms.c
parentb4613217f6ca9f1c5b9c33efba0ce0c13a0d887b (diff)
downloadofono-3a2821307228f688656b4ddce32d13b02725b5ad.tar.bz2
Add Basic SMS reception capabilities
- Can receive 7Bit, 8Bit and UCS2 encoded messages - 8Bit is assumed to be a datagram to a certain port - Messages with Invalid format are ignored - Concatenation not yet supported
Diffstat (limited to 'drivers/atmodem/sms.c')
-rw-r--r--drivers/atmodem/sms.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index 9fb8a760..b84f4d18 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -270,18 +270,23 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct at_data *at = ofono_modem_userdata(modem);
- int pdulen;
- const char *pdu;
+ const char *hexpdu;
+ long pdu_len;
+ int tpdu_len;
+ unsigned char pdu[164];
char buf[256];
dump_response("at_cmt_notify", TRUE, result);
- if (!at_parse_pdu_common(result, "+CMT:", &pdu, &pdulen)) {
+ if (!at_parse_pdu_common(result, "+CMT:", &hexpdu, &tpdu_len)) {
ofono_error("Unable to parse CMT notification");
return;
}
- ofono_debug("Got new SMS Deliver PDU via CMT: %s, %d", pdu, pdulen);
+ ofono_debug("Got new SMS Deliver PDU via CMT: %s, %d", pdu, tpdu_len);
+
+ decode_hex_own_buf(hexpdu, -1, &pdu_len, 0, pdu);
+ ofono_sms_deliver_notify(modem, pdu, pdu_len, tpdu_len);
/* We must acknowledge the PDU using CNMA */
if (at->sms->cnma_ack_pdu)
@@ -295,10 +300,12 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)
static void at_cmgr_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
- //struct ofono_modem *modem = user_data;
+ struct ofono_modem *modem = user_data;
GAtResultIter iter;
- int pdulen;
- const char *pdu;
+ const char *hexpdu;
+ unsigned char pdu[164];
+ long pdu_len;
+ int tpdu_len;
dump_response("at_cmgr_cb", ok, result);
@@ -318,15 +325,18 @@ static void at_cmgr_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (!g_at_result_iter_skip_next(&iter))
goto err;
- if (!g_at_result_iter_next_number(&iter, &pdulen))
+ if (!g_at_result_iter_next_number(&iter, &tpdu_len))
goto err;
if (!g_at_result_iter_next(&iter, NULL))
goto err;
- pdu = g_at_result_iter_raw_line(&iter);
+ hexpdu = g_at_result_iter_raw_line(&iter);
+
+ ofono_debug("Got PDU: %s, with len: %d", hexpdu, tpdu_len);
- ofono_debug("Got PDU: %s, with len: %d", pdu, pdulen);
+ decode_hex_own_buf(hexpdu, -1, &pdu_len, 0, pdu);
+ ofono_sms_deliver_notify(modem, pdu, pdu_len, tpdu_len);
return;
err: