41 lines
926 B
C
41 lines
926 B
C
//
|
|
// Created by zemon on 27.12.22.
|
|
//
|
|
|
|
#include "AtGsmSms_ReedOneNewPdu.h"
|
|
#include "AtGsmSms_Utils.h"
|
|
#include "AsciiStringParsingUtils.h"
|
|
|
|
AtCommandResult AtGsmSms_UtilsReadPduData(
|
|
tAtCmd *env,
|
|
uint8_t *binaryData,
|
|
uint16_t *binaryDataSize,
|
|
uint8_t binaryDataLimit
|
|
) {
|
|
char hexPdu[255];
|
|
uint8_t hexPduSize = 0;
|
|
|
|
char hexPduData[255];
|
|
uint16_t hexPduDataSize = 0;
|
|
|
|
if (AtGsmSms_ReedOneNewPdu(env, hexPdu, &hexPduSize, sizeof(hexPdu)) != AT_OK) {
|
|
return AT_ERROR;
|
|
} else {
|
|
|
|
if ((hexPduSize / 2) > binaryDataLimit) {
|
|
return AT_ERROR;
|
|
}
|
|
|
|
if (AtGsmSms_BildPduData(hexPdu, hexPduSize, hexPduData, &hexPduDataSize) != AT_OK) {
|
|
return AT_ERROR;
|
|
} else {
|
|
*binaryDataSize = (uint16_t) iAsciiStringParseHexBytes(binaryData, hexPduData, hexPduDataSize);
|
|
|
|
return AT_OK;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|