80 lines
2.6 KiB
C
80 lines
2.6 KiB
C
//
|
|
// Created by xemon on 14.11.22.
|
|
//
|
|
#include "AtGsmTelitLe910_AudioFileAndStream.h"
|
|
#include <AtCmdCommonProtected.h>
|
|
#include <SystemDelayInterface.h>
|
|
|
|
AtCommandResult AtGsmTelitLe910_DeleteAllAudioFiles(tAtCmd *env) {
|
|
AtCmdPrepare(env);
|
|
AtCmdSendStatic(env, "AT#ADELA\r\n");
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
}
|
|
|
|
AtCommandResult AtGsmTelitLe910_DeleteAudioFile(tAtCmd *env, char *name, size_t nameLen) {
|
|
AtCmdPrepare(env);
|
|
AtCmdTxClear(env);
|
|
AtCmdTxAddStatic(env, "AT#ADELF=");
|
|
AtCmdTxAddStatic(env, "\"");
|
|
AtCmdTxAdd(env, name, nameLen);
|
|
AtCmdTxAddStatic(env, "\"");
|
|
AtCmdTxSendLn(env);
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
}
|
|
|
|
AtCommandResult AtGsmTelitLe910_SendAudioFile(tAtCmd *env, char *name, size_t nameLen, uint8_t *data, size_t dataLen) {
|
|
AtCmdPrepare(env);
|
|
AtCmdTxClear(env);
|
|
AtCmdTxAddStatic(env, "AT#ASEND=\"");
|
|
AtCmdTxAdd(env, name, nameLen);
|
|
AtCmdTxAddStatic(env, "\",");
|
|
AtCmdTxAddDecimalIntWithLimit(env, nameLen, 8);
|
|
AtCmdTxSendLn(env);
|
|
SystemDelayMs(5);
|
|
AtCmdSend(env, data, dataLen);
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
}
|
|
|
|
AtCommandResult AtGsmTelitLe910_RecorderAudioFileStart(tAtCmd *env, char *name, size_t nameLen) {
|
|
AtCmdPrepare(env);
|
|
AtCmdTxClear(env);
|
|
AtCmdTxAddStatic(env, "AT#ARECD=1,");
|
|
AtCmdTxAddStatic(env, "\"");
|
|
AtCmdTxAdd(env, name, nameLen);
|
|
AtCmdTxAddStatic(env, "\"");
|
|
AtCmdTxSendLn(env);
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
}
|
|
|
|
AtCommandResult AtGsmTelitLe910_RecorderAudioFileStop(tAtCmd *env) {
|
|
AtCmdPrepare(env);
|
|
AtCmdSendStatic(env, "AT#ARECD=0\r\n");
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
}
|
|
|
|
AtCommandResult AtGsmTelitLe910_PlayAudioFileTo(tAtCmd *env, eTelitPlayAudioFileDir dir, char *name, size_t nameLen) {
|
|
AtCmdPrepare(env);
|
|
AtCmdTxClear(env);
|
|
AtCmdTxAddStatic(env, "AT#APLAY=1,");
|
|
AtCmdTxAddChar(env, dir);
|
|
AtCmdTxAddStatic(env, ",\"");
|
|
AtCmdTxAdd(env, name, nameLen);
|
|
AtCmdTxAddStatic(env, "\"");
|
|
AtCmdTxSendLn(env);
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
}
|
|
|
|
|
|
AtCommandResult AtGsmTelitLe910_PlayAudioWaitEnd(tAtCmd *env, uint32_t timeout) {
|
|
return AtCmdWaitPrefixStatic(env, timeout, "#APLAYEV: 0");
|
|
}
|
|
|
|
AtCommandResult AtGsmTelitLe910_RecAudioWaitEnd(tAtCmd *env, uint32_t timeout) {
|
|
return AtCmdWaitPrefixStatic(env, timeout, "#ARECDEV: 0");
|
|
}
|
|
|
|
AtCommandResult AtGsmTelitLe910_PlayAudioStop(tAtCmd *env) {
|
|
AtCmdPrepare(env);
|
|
AtCmdSendStatic(env, "AT#APLAY=0\r\n");
|
|
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
|
|
} |