mirror of git://git.sysmocom.de/ofono
atmodem: Use atutil based functions
This commit is contained in:
parent
1b36d1cd43
commit
39391cf32b
|
@ -62,12 +62,10 @@ static const char *storages[] = {
|
||||||
"SM",
|
"SM",
|
||||||
"ME",
|
"ME",
|
||||||
"MT",
|
"MT",
|
||||||
|
"SR",
|
||||||
|
"BM",
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SM_STORE 0
|
|
||||||
#define ME_STORE 1
|
|
||||||
#define MT_STORE 2
|
|
||||||
|
|
||||||
struct sms_data {
|
struct sms_data {
|
||||||
int store;
|
int store;
|
||||||
int incoming;
|
int incoming;
|
||||||
|
@ -451,35 +449,21 @@ static void at_send_cmgr_cpms(struct ofono_sms *sms, int store, int index)
|
||||||
static void at_cmti_notify(GAtResult *result, gpointer user_data)
|
static void at_cmti_notify(GAtResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_sms *sms = user_data;
|
struct ofono_sms *sms = user_data;
|
||||||
const char *strstore;
|
enum at_util_sms_store store;
|
||||||
int store;
|
|
||||||
GAtResultIter iter;
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
g_at_result_iter_init(&iter, result);
|
if (at_util_parse_sms_index_delivery(result, "+CMTI:",
|
||||||
|
&store, &index) == FALSE)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (!g_at_result_iter_next(&iter, "+CMTI:"))
|
if (store != AT_UTIL_SMS_STORE_SM && store != AT_UTIL_SMS_STORE_ME)
|
||||||
goto err;
|
goto error;
|
||||||
|
|
||||||
if (!g_at_result_iter_next_string(&iter, &strstore))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
if (!strcmp(strstore, "ME"))
|
|
||||||
store = ME_STORE;
|
|
||||||
else if (!strcmp(strstore, "SM"))
|
|
||||||
store = SM_STORE;
|
|
||||||
else
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
if (!g_at_result_iter_next_number(&iter, &index))
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
DBG("Got a CMTI indication at %s, index: %d", strstore, 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);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err:
|
error:
|
||||||
ofono_error("Unable to parse CMTI notification");
|
ofono_error("Unable to parse CMTI notification");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,8 +471,9 @@ static void at_cmgl_done(struct ofono_sms *sms)
|
||||||
{
|
{
|
||||||
struct sms_data *data = ofono_sms_get_data(sms);
|
struct sms_data *data = ofono_sms_get_data(sms);
|
||||||
|
|
||||||
if (data->incoming == MT_STORE && data->store == ME_STORE) {
|
if (data->incoming == AT_UTIL_SMS_STORE_MT &&
|
||||||
at_cmgl_set_cpms(sms, SM_STORE);
|
data->store == AT_UTIL_SMS_STORE_ME) {
|
||||||
|
at_cmgl_set_cpms(sms, AT_UTIL_SMS_STORE_SM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,8 +604,8 @@ static void at_sms_initialized(struct ofono_sms *sms)
|
||||||
struct sms_data *data = ofono_sms_get_data(sms);
|
struct sms_data *data = ofono_sms_get_data(sms);
|
||||||
|
|
||||||
/* Inspect and free the incoming SMS storage */
|
/* Inspect and free the incoming SMS storage */
|
||||||
if (data->incoming == MT_STORE)
|
if (data->incoming == AT_UTIL_SMS_STORE_MT)
|
||||||
at_cmgl_set_cpms(sms, ME_STORE);
|
at_cmgl_set_cpms(sms, AT_UTIL_SMS_STORE_ME);
|
||||||
else
|
else
|
||||||
at_cmgl_set_cpms(sms, data->incoming);
|
at_cmgl_set_cpms(sms, data->incoming);
|
||||||
|
|
||||||
|
@ -928,12 +913,12 @@ static void at_cpms_query_cb(gboolean ok, GAtResult *result,
|
||||||
|
|
||||||
if (sm_supported[0] && sm_supported[1]) {
|
if (sm_supported[0] && sm_supported[1]) {
|
||||||
supported = TRUE;
|
supported = TRUE;
|
||||||
data->store = SM_STORE;
|
data->store = AT_UTIL_SMS_STORE_SM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me_supported[0] && me_supported[1]) {
|
if (me_supported[0] && me_supported[1]) {
|
||||||
supported = TRUE;
|
supported = TRUE;
|
||||||
data->store = ME_STORE;
|
data->store = AT_UTIL_SMS_STORE_ME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This seems to be a special case, where the modem will
|
/* This seems to be a special case, where the modem will
|
||||||
|
@ -941,13 +926,13 @@ static void at_cpms_query_cb(gboolean ok, GAtResult *result,
|
||||||
* mem1
|
* mem1
|
||||||
*/
|
*/
|
||||||
if (mt_supported[2] && (sm_supported[0] || me_supported[0]))
|
if (mt_supported[2] && (sm_supported[0] || me_supported[0]))
|
||||||
data->incoming = MT_STORE;
|
data->incoming = AT_UTIL_SMS_STORE_MT;
|
||||||
|
|
||||||
if (sm_supported[2])
|
if (sm_supported[2])
|
||||||
data->incoming = SM_STORE;
|
data->incoming = AT_UTIL_SMS_STORE_SM;
|
||||||
|
|
||||||
if (me_supported[2])
|
if (me_supported[2])
|
||||||
data->incoming = ME_STORE;
|
data->incoming = AT_UTIL_SMS_STORE_ME;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
if (!supported)
|
if (!supported)
|
||||||
|
|
Loading…
Reference in New Issue