// // Created by zemon on 27.12.22. // #include #include "AtCmdCommonProtected.h" #include "SystemDelayInterface.h" #include "LoggerInterface.h" AtCommandResult AtGsmSms_ReedOneNewPdu( tAtCmd *env, char *pduHex, uint8_t *pduHexSize, uint8_t pduHexLimit ) { // /// запрос на переотправку МНД // char hexData[] = "04814523F1040A8180515634120004329052815002402B0100000B001E000600014A1700060040040433140050060000000000000000000000130100000000028155"; // char hexData[] = "04814523F1040A8180515634120004326090419405402B0100000B001E00010001A91700010040040433140050010000000000000000000000130100000000027290"; // char hexData[] = "0100010B003300010001EA2800010094E07404110A0A282500010222140601430145554B3C25C00000810037F08B8835FC1179A7A7B0FE0F1C1FE000001AA3D2"; // char hexData[] = "04804523F1040A8080515634120004324041318175402A0100000B001D000A00017516000A00400404331300500A0000000000000000000002230235353535852C"; // char hexData[] = "07919714180010F3040B919714111190F7000432302231033221350100000B0028000A00013D1D000A00010A0000000404331A00500A000000A9010000000100420D0237393431383130303032357D82"; // char hexData[] = "07919714180010F3040B919714111190F70004323022310332213501A001C00012F13001C00400404331000501C0000000000000000000000120100A87010101010"; // char hexData[] = "0100000B001E00040001C6170004004004043314005004000000000000000000000013010000000002B6B0"; /// установка номера // char hexData[] = "04804523F1040A8080515634120004324041318175402A0100000B001D000A00017516000A00400404331300500A0000000000000000000002230235353535852C"; // uint16_t pos = 0; // while ((pos < pduHexLimit) && (hexData[pos] != 0)) { // pduHex[pos] = hexData[pos]; // ++pos; // } // *pduHexSize = pos; // return AT_OK; ///============================================================================================================== uint32_t endMs = SystemGetMs() + 2000; AtCmdPrepare(env); AtCmdSendStatic(env, "AT+CMGL\r\n"); *pduHexSize = 0; while (endMs > SystemGetMs()) { if (AtCmdReceiveNextLine(env, 500) == AT_OK) { uint16_t pos = 0; if (AtCmdRxBeginWithStatic(env, "+CMGL:")) { if (AtCmdReceiveNextLine(env, 1000) == AT_OK) { while ((pos < pduHexLimit) && (env->rxBuffer.data[pos] != '\r')) { pduHex[pos] = env->rxBuffer.data[pos]; ++pos; } } *pduHexSize = pos; return AT_OK; } if (AtCmdRxBeginWithStatic(env, "+CMS ERROR: ")) { return AT_ERROR; } AtCmdProcessUnresolvedLine(env); } } return AT_TIMEOUT; }