при переключении сим профилей добавлена проверка удалось включить профиль или нет, проверка проходит методом запроса id профиля, причина внесения изменений - на линейки модемов telit c1 команда включения провиля иногда проходит не с первого раза, теперь в случае если профиль не включился производится повторная попытка
This commit is contained in:
parent
0a3c8470dc
commit
aef4a5ad65
|
|
@ -42,18 +42,96 @@ AtCommandResult AtGsmTelitLe910_EcallSetModeBattle(tAtCmd *env) {
|
|||
|
||||
AtCommandResult AtGsmTelitLe910_SIMCardDetect(tAtCmd *env) {
|
||||
AtCmdPrepare(env);
|
||||
|
||||
AtCmdRxClear(env);
|
||||
AtCmdSendStatic(env, "AT#SIMDET=1\r\n");
|
||||
uint32_t timeout = SystemGetMs() + 4000;
|
||||
|
||||
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
||||
while ( (AtCmdReceiveNextLine(env, 500) == AT_OK) && (timeout > SystemGetMs()) ) {
|
||||
if(AtCmdRxBeginWithStatic(env, "OK") == AT_OK){
|
||||
AtCmdPrepare(env);
|
||||
AtCmdRxClear(env);
|
||||
SystemDelayMs(500);
|
||||
AtCmdSendStatic(env, "AT#CIMI\r\n");
|
||||
timeout = SystemGetMs() + 4000;
|
||||
while ( (AtCmdReceiveNextLine(env, 500) == AT_OK) || (timeout > SystemGetMs()) ) {
|
||||
if(AtCmdRxBeginWithStatic(env, "OK") == AT_OK){
|
||||
SystemDelayMs(1000);
|
||||
return AT_OK;
|
||||
} else if(AtCmdRxBeginWithStatic(env, "+CME ERROR: SIM not inserted") == AT_OK){
|
||||
AtCmdPrepare(env);
|
||||
AtCmdRxClear(env);
|
||||
SystemDelayMs(500);
|
||||
AtCmdSendStatic(env, "AT#SIMDET=1\r\n");
|
||||
AtCmdPrepare(env);
|
||||
AtCmdRxClear(env);
|
||||
SystemDelayMs(500);
|
||||
AtCmdSendStatic(env, "AT#CIMI\r\n");
|
||||
continue;
|
||||
}
|
||||
if(timeout < SystemGetMs()){
|
||||
return AT_TIMEOUT;
|
||||
}
|
||||
}
|
||||
if(timeout < SystemGetMs()){
|
||||
return AT_TIMEOUT;
|
||||
} else {
|
||||
return AT_ERROR;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return AT_ERROR;
|
||||
|
||||
///===================================================
|
||||
//
|
||||
// AtCmdPrepare(env);
|
||||
// AtCmdRxClear(env);
|
||||
// AtCmdSendStatic(env, "AT#SIMDET=1\r\n");
|
||||
//
|
||||
// uint32_t timeout = SystemGetMs() + 4000;
|
||||
//
|
||||
// while ( (AtCmdReceiveNextLine(env, 500) == AT_OK) && (timeout > SystemGetMs()) ) {
|
||||
// if (AtCmdRxBeginWithStatic(env, "")) {
|
||||
// if (AtCmdRxBeginWithStatic(env, "OK")) {
|
||||
// AtCmdPrepare(env);
|
||||
// AtCmdRxClear(env);
|
||||
// SystemDelayMs(500);
|
||||
// AtCmdSendStatic(env, "AT#CIMI\r\n");
|
||||
// timeout = SystemGetMs() + 4000;
|
||||
//
|
||||
// while ((AtCmdReceiveNextLine(env, 500) == AT_OK) && (timeout > SystemGetMs())) {
|
||||
// if (AtCmdRxBeginWithStatic(env, "#CIMI: ")) {
|
||||
// SystemDelayMs(1000);
|
||||
// return AT_OK;
|
||||
// } else if (AtCmdRxBeginWithStatic(env, "+CME ERROR: SIM not inserted")) {
|
||||
// AtCmdPrepare(env);
|
||||
// AtCmdRxClear(env);
|
||||
// SystemDelayMs(500);
|
||||
// AtCmdSendStatic(env, "AT#CIMI\r\n");
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// AtCmdPrepare(env);
|
||||
// AtCmdRxClear(env);
|
||||
// SystemDelayMs(500);
|
||||
// AtCmdSendStatic(env, "AT#SIMDET=1\r\n");
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return AT_ERROR;
|
||||
}
|
||||
|
||||
AtCommandResult AtGsmTelitLe910_SIMCardNoDetect(tAtCmd *env) {
|
||||
AtCmdPrepare(env);
|
||||
|
||||
AtCmdRxClear(env);
|
||||
AtCmdSendStatic(env, "AT#SIMDET=0\r\n");
|
||||
|
||||
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
||||
AtCommandResult res = AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
||||
SystemDelayMs(500);
|
||||
return res;
|
||||
}
|
||||
|
||||
AtCommandResult AtGsmTelitLe910_EcallWriteMsdToModem(tAtCmd *env, uint8_t *msd, size_t msdLength) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue