atmodem: Allow ME & SM for status report store

This commit is contained in:
Denis Kenzior 2010-06-10 22:23:05 -05:00
parent a128cbff8b
commit 6c8d2f0e5b
1 changed files with 13 additions and 5 deletions

View File

@ -70,6 +70,7 @@ struct sms_data {
int store; int store;
int incoming; int incoming;
int retries; int retries;
gboolean expect_sr;
gboolean cnma_enabled; gboolean cnma_enabled;
char *cnma_ack_pdu; char *cnma_ack_pdu;
int cnma_ack_pdu_len; int cnma_ack_pdu_len;
@ -82,6 +83,7 @@ struct cpms_request {
struct ofono_sms *sms; struct ofono_sms *sms;
int store; int store;
int index; int index;
gboolean expect_sr;
}; };
static void at_csca_set_cb(gboolean ok, GAtResult *result, gpointer user_data) static void at_csca_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
@ -378,7 +380,7 @@ static void at_cmgr_notify(GAtResult *result, gpointer user_data)
decode_hex_own_buf(hexpdu, -1, &pdu_len, 0, pdu); decode_hex_own_buf(hexpdu, -1, &pdu_len, 0, pdu);
if (data->store == AT_UTIL_SMS_STORE_SR) if (data->expect_sr)
ofono_sms_status_notify(sms, pdu, pdu_len, tpdu_len); ofono_sms_status_notify(sms, pdu, pdu_len, tpdu_len);
else else
ofono_sms_deliver_notify(sms, pdu, pdu_len, tpdu_len); ofono_sms_deliver_notify(sms, pdu, pdu_len, tpdu_len);
@ -413,6 +415,7 @@ static void at_cmgr_cpms_cb(gboolean ok, GAtResult *result, gpointer user_data)
} }
data->store = req->store; data->store = req->store;
data->expect_sr = req->expect_sr;
snprintf(buf, sizeof(buf), "AT+CMGR=%d", req->index); snprintf(buf, sizeof(buf), "AT+CMGR=%d", req->index);
g_at_chat_send(data->chat, buf, none_prefix, at_cmgr_cb, NULL, NULL); g_at_chat_send(data->chat, buf, none_prefix, at_cmgr_cb, NULL, NULL);
@ -422,7 +425,8 @@ static void at_cmgr_cpms_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_chat_send(data->chat, buf, none_prefix, at_cmgd_cb, NULL, NULL); g_at_chat_send(data->chat, buf, none_prefix, at_cmgd_cb, NULL, NULL);
} }
static void at_send_cmgr_cpms(struct ofono_sms *sms, int store, int index) static void at_send_cmgr_cpms(struct ofono_sms *sms, int store, int index,
gboolean expect_sr)
{ {
struct sms_data *data = ofono_sms_get_data(sms); struct sms_data *data = ofono_sms_get_data(sms);
@ -432,6 +436,7 @@ static void at_send_cmgr_cpms(struct ofono_sms *sms, int store, int index)
req.sms = sms; req.sms = sms;
req.store = store; req.store = store;
req.index = index; req.index = index;
req.expect_sr = expect_sr;
at_cmgr_cpms_cb(TRUE, NULL, &req); at_cmgr_cpms_cb(TRUE, NULL, &req);
} else { } else {
@ -442,6 +447,7 @@ static void at_send_cmgr_cpms(struct ofono_sms *sms, int store, int index)
req->sms = sms; req->sms = sms;
req->store = store; req->store = store;
req->index = index; req->index = index;
req->expect_sr = expect_sr;
snprintf(buf, sizeof(buf), "AT+CPMS=\"%s\",\"%s\",\"%s\"", snprintf(buf, sizeof(buf), "AT+CPMS=\"%s\",\"%s\",\"%s\"",
storages[store], storages[store], incoming); storages[store], storages[store], incoming);
@ -465,7 +471,7 @@ static void at_cmti_notify(GAtResult *result, gpointer user_data)
goto error; goto error;
DBG("Got a CMTI indication at %s, index: %d", storages[store], index); DBG("Got a CMTI indication at %s, index: %d", storages[store], index);
at_send_cmgr_cpms(sms, store, index); at_send_cmgr_cpms(sms, store, index, FALSE);
return; return;
error: error:
@ -482,11 +488,13 @@ static void at_cdsi_notify(GAtResult *result, gpointer user_data)
&store, &index) == FALSE) &store, &index) == FALSE)
goto error; goto error;
if (store != AT_UTIL_SMS_STORE_SR) /* Some modems actually store status reports in SM, and not SR */
if (store != AT_UTIL_SMS_STORE_SR && store != AT_UTIL_SMS_STORE_SM &&
store != AT_UTIL_SMS_STORE_ME)
goto error; goto error;
DBG("Got a CDSI indication at %s, index: %d", storages[store], index); DBG("Got a CDSI indication at %s, index: %d", storages[store], index);
at_send_cmgr_cpms(sms, store, index); at_send_cmgr_cpms(sms, store, index, TRUE);
return; return;
error: error: