Also ensure that setting the operator worked
This commit is contained in:
parent
e3c993c66e
commit
317954ec36
@ -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,
|
||||
|
15
src/modem.c
15
src/modem.c
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user