// // Created by xemon on 28.11.22. // #include "AtGsmSms_WriteNewPduSms.h" #include "AtCmdCommonProtected.h" AtCommandResult AtGsmSms_WriteNewPduSms(tAtCmd *env, char *pduBody, uint8_t fullLen, uint8_t pduDataLen) { AtCmdPrepare(env); AtCmdTxClear(env); AtCmdTxAddStatic(env, "AT+CMGW="); AtCmdTxAddDecimalIntWithLimit(env, pduDataLen, 3); AtCmdTxSendLn(env); AtCommandResult ready = AtCmdWaitChar(env, 10000, '>'); if (ready != AT_OK) { AtCmdSendStatic(env, AT_ESC_STR); return ready; } AtCmdSend(env, (uint8_t *) pduBody, fullLen); AtCmdSendStatic(env, AT_ESC_STR); return AtCmdOkErrAnswer(env, env->stdRxTimeout * 5); }