Изменения на новый
This commit is contained in:
parent
1801afeb4f
commit
e946919a37
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
// IMEI
|
// IMEI
|
||||||
AtCommandResult AtGsm_Simcom_A76xx_GET_CGSN(tAtCmd *env, char *acpString, size_t *acpStringLen);
|
AtCommandResult AtGsm_Simcom_A76xx_GET_CGSN(tAtCmd *env, char *acpString, size_t *acpStringLen);
|
||||||
AtCommandResult AtGsm_Simcom_A76xx_CCID(tAtCmd *env, char *acpString, size_t *acpStringLen);
|
AtCommandResult AtGsm_Simcom_A76xx_CCID(tAtCmd *env, char *ssidStr, size_t *ssidStrLen);
|
||||||
|
|
||||||
|
|
||||||
// конец-------------------------- Служебные ----------------------------------------------------------------------
|
// конец-------------------------- Служебные ----------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -46,38 +46,31 @@ AtCommandResult AtGsm_Simcom_A76xx_GET_CGSN(tAtCmd *env, char *acpString, size_t
|
||||||
return AT_TIMEOUT;
|
return AT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
AtCommandResult AtGsm_Simcom_A76xx_CCID(tAtCmd *env, char *acpString, size_t *acpStringLen) {
|
AtCommandResult AtGsm_Simcom_A76xx_CCID(tAtCmd *env, char *ssidStr, size_t *ssidStrLen) {
|
||||||
AtCmdPrepare(env);
|
AtCmdPrepare(env);
|
||||||
|
|
||||||
AtCmdTxClear(env);
|
AtCmdTxClear(env);
|
||||||
AtCmdTxAddStatic(env, "AT+CICCID");
|
AtCmdSendStatic(env, "AT+CICCID\r\n");
|
||||||
AtCmdTxSendLn(env);
|
|
||||||
|
|
||||||
|
uint32_t endMs = SystemGetMs() + 5000;
|
||||||
uint32_t timeout = env->stdRxTimeout;
|
while (endMs > SystemGetMs()) {
|
||||||
uint32_t endMs = SystemGetMs() + timeout;
|
if (AtCmdReceiveNextLine(env, 1000) == AT_OK) {
|
||||||
uint32_t leftMs = timeout;
|
if (AtCmdRxBeginWithStatic(env, "+ICCID: ")) {
|
||||||
|
static const uint16_t prefixSize = sizeof("+ICCID: ") - 1;
|
||||||
while ((AtCmdReceiveNextLine(env, leftMs) == AT_OK) && (SystemGetMs() < endMs)) {
|
*ssidStrLen = env->rxBuffer.len - (prefixSize + 2);
|
||||||
leftMs = endMs - SystemGetMs();
|
memcpy(ssidStr, env->rxBuffer.data + prefixSize, *ssidStrLen);
|
||||||
|
return AT_OK;
|
||||||
if (AtCmdRxBeginWithStatic(env, "ERROR")) {
|
}
|
||||||
AtCmdRxClear(env);
|
|
||||||
return AT_ERROR;
|
if (AtCmdRxBeginWithStatic(env, "ERROR")) {
|
||||||
|
return AT_ERROR;
|
||||||
} else if (AtCmdRxBeginWithStatic(env, "+CCID: ")) {
|
}
|
||||||
while (AtCmdReceiveNextLine(env, 1000) == AT_OK) {
|
if (AtCmdRxBeginWithStatic(env, "+CME ERROR: SIM busy")) {
|
||||||
char *start = env->rxBuffer.data + sizeof("+CCID:");
|
AtCmdPrepare(env);
|
||||||
*acpStringLen = env->rxBuffer.len - sizeof("+CCID:") - 2;
|
AtCmdRxClear(env);
|
||||||
memcpy(acpString, start, *acpStringLen);
|
continue;
|
||||||
AtCmdRxClear(env);
|
|
||||||
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
AtCmdProcessUnresolvedLine(env);
|
AtCmdProcessUnresolvedLine(env);
|
||||||
AtCmdRxClear(env);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue