29 lines
711 B
C
29 lines
711 B
C
//
|
|
// Created by xemon on 28.11.22.
|
|
//
|
|
|
|
#include "AtGsmSms_SendText.h"
|
|
#include "AtCmdCommonProtected.h"
|
|
|
|
AtCommandResult AtGsmSms_SendText(tAtCmd *env, char *number, uint8_t numberLen, char *text, uint8_t textLen) {
|
|
AtCmdPrepare(env);
|
|
|
|
AtCmdTxClear(env);
|
|
AtCmdTxAddStatic(env, "AT+CMGS=\"");
|
|
AtCmdTxAdd(env, number, numberLen);
|
|
AtCmdTxAddStatic(env, "\"");
|
|
AtCmdTxSendLn(env);
|
|
|
|
AtCommandResult ready = AtCmdWaitPrefix(env, 10000, ">", 1);
|
|
|
|
if (ready != AT_OK) {
|
|
AtCmdSendStatic(env, AT_ESC_STR);
|
|
return ready;
|
|
}
|
|
|
|
AtCmdSend(env, (uint8_t *) text, textLen);
|
|
AtCmdSendStatic(env, AT_ESC_STR);
|
|
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout * 5);
|
|
}
|