Also ensure that setting the operator worked

This commit is contained in:
Pierre Pronchery 2010-05-08 13:31:32 +00:00
parent e3c993c66e
commit 317954ec36
2 changed files with 12 additions and 4 deletions

View File

@ -63,6 +63,7 @@ typedef enum _GSMError
GSM_ERROR_MESSAGE_FETCH_FAILED,
GSM_ERROR_MESSAGE_LIST_FAILED,
GSM_ERROR_MESSAGE_SEND_FAILED,
GSM_ERROR_OPERATOR_MODE_FAILED,
GSM_ERROR_SIGNAL_LEVEL_FAILED,
GSM_ERROR_RESET_FAILED,
GSM_ERROR_SIM_PIN_REQUIRED,

View File

@ -565,10 +565,11 @@ int gsm_modem_set_operator_format(GSMModem * gsmm, GSMOperatorFormat format)
/* gsm_modem_set_operator_mode */
static void _modem_set_operator_mode_callback(GSM * gsm);
int gsm_modem_set_operator_mode(GSMModem * gsmm, GSMOperatorMode mode)
{
char cmd[] = "AT+COPS=X";
GSMCommand * gsmc;
switch(mode)
{
@ -582,9 +583,15 @@ int gsm_modem_set_operator_mode(GSMModem * gsmm, GSMOperatorMode mode)
return 1;
}
cmd[8] = mode + '0';
if((gsmc = gsm_queue(gsmm->gsm, cmd)) == NULL)
return 1;
return 0;
return gsm_queue_full(gsmm->gsm, GSM_PRIORITY_NORMAL, cmd,
GSM_ERROR_OPERATOR_MODE_FAILED,
_modem_set_operator_mode_callback);
}
static void _modem_set_operator_mode_callback(GSM * gsm)
{
/* did it really work? */
gsm_fetch_operator(gsm);
}