commit 1d06ab85613124724c0cbd9e27e5da01950865d0 Author: cfif Date: Wed Dec 4 13:10:48 2024 +0300 Init diff --git a/Inc/AudioPlayerTelitLe910.h b/Inc/AudioPlayerTelitLe910.h new file mode 100644 index 0000000..f45b4e4 --- /dev/null +++ b/Inc/AudioPlayerTelitLe910.h @@ -0,0 +1,13 @@ +// +// Created by xemon on 17.11.22. +// + +#ifndef UVEOS_ON_NATION_AUDIOPLAYERTELITLE910_H +#define UVEOS_ON_NATION_AUDIOPLAYERTELITLE910_H + +#include "AtGsmTelitLe910.h" +#include "AudioPlayerInterface.h" + +tAudioPlayerInterface AudioPlayerTelitLe910_GetInterface(tAtCmd *telitAt); + +#endif //UVEOS_ON_NATION_AUDIOPLAYERTELITLE910_H diff --git a/Src/AudioPlayerTelitLe910.c b/Src/AudioPlayerTelitLe910.c new file mode 100644 index 0000000..d61e694 --- /dev/null +++ b/Src/AudioPlayerTelitLe910.c @@ -0,0 +1,44 @@ +// +// Created by xemon on 17.11.22. +// + +#include +#include "AudioPlayerTelitLe910.h" +#include "SystemDelayInterface.h" + +static bool AudioPlayerTelitLe910_Start(tAtCmd *telitAt, char *name, uint16_t nameLen, uint32_t timeout) { + char fileName[nameLen + 4]; + + memcpy(fileName, name, nameLen); + stpncpy(fileName + nameLen, ".pcm", 4); + + if(AtGsmTelitLe910_PlayAudioFileTo(telitAt, TELIT_AUDIO_FILE_PLAY_TO_SPEAKER, fileName, nameLen + 4) == AT_OK){ + return AtCmdWaitOk(telitAt, 10, 10); + } +} + +static bool AudioPlayerTelitLe910_Stop(tAtCmd *telitAt, uint32_t timeout) { + return AtGsmTelitLe910_PlayAudioStop(telitAt) == AT_OK; +} + +static bool AudioPlayerTelitLe910_Wait(tAtCmd *atCmd, uint32_t timeout) { + AtCommandResult result= AtGsmTelitLe910_PlayAudioWaitEnd(atCmd, timeout); + if(result == AT_OK){ + return result; + } else { + AudioPlayerTelitLe910_Stop(atCmd, timeout); + return false; + } +} + +tAudioPlayerInterface AudioPlayerTelitLe910_GetInterface(tAtCmd *telitAt) { + tAudioPlayerInterface result = { + .env = telitAt, + .start = (audioPlayerCallStart) AudioPlayerTelitLe910_Start, + .stop = (audioPlayerCall) AudioPlayerTelitLe910_Stop, + .wait = (audioPlayerCall) AudioPlayerTelitLe910_Wait, + }; + + return result; +} + diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..d4d574e --- /dev/null +++ b/modular.json @@ -0,0 +1,12 @@ +{ + "dep": [ + ], + "cmake": { + "inc_dirs": [ + "Inc" + ], + "srcs": [ + "Src/**.c" + ] + } +} \ No newline at end of file