Init
This commit is contained in:
commit
470d1db097
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// Created by zemon on 29.11.22.
|
||||
//
|
||||
|
||||
#ifndef UVEOS_ON_NATION_AUDIORECORDERTELITLE910_H
|
||||
#define UVEOS_ON_NATION_AUDIORECORDERTELITLE910_H
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "stdbool.h"
|
||||
#include "AudioRecorderInterface.h"
|
||||
#include "AtGsmTelitLe910.h"
|
||||
|
||||
tAudioRecorderInterface AudioRecordTelitLe910_GetInterface(tAtCmd *telitAt);
|
||||
|
||||
#endif //UVEOS_ON_NATION_AUDIORECORDERTELITLE910_H
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// Created by zemon on 29.11.22.
|
||||
//
|
||||
|
||||
#include <memory.h>
|
||||
#include "AudioRecorderTelitLe910.h"
|
||||
#include "SystemDelayInterface.h"
|
||||
|
||||
|
||||
static bool AudioRecordTelitLe910_Start(tAtCmd *telitAt, char *name, uint16_t nameLen) {
|
||||
char fileName[nameLen + 4];
|
||||
memcpy(fileName, name, nameLen);
|
||||
stpncpy(fileName + nameLen, ".pcm", 4);
|
||||
|
||||
AtCommandResult result;
|
||||
uint32_t end = SystemGetMs() + 5000;
|
||||
while (end > SystemGetMs()){
|
||||
result = AtGsmTelitLe910_RecorderAudioFileStart(telitAt, fileName, nameLen + 4);
|
||||
if (result == AT_OK) {
|
||||
return true;
|
||||
}
|
||||
SystemDelayMs(100);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool AtGsmTelitLe910_RecordrerAudioFileDel(tAtCmd *telitAt, char *name, uint16_t nameLen) {
|
||||
char fileName[nameLen + 4];
|
||||
memcpy(fileName, name, nameLen);
|
||||
stpncpy(fileName + nameLen, ".pcm", 4);
|
||||
|
||||
|
||||
AtCommandResult result;
|
||||
uint32_t end = SystemGetMs() + 5000;
|
||||
while (end > SystemGetMs()){
|
||||
result = AtGsmTelitLe910_DeleteAudioFile(telitAt, fileName, nameLen + 4);
|
||||
if (result == AT_OK) {
|
||||
return true;
|
||||
}
|
||||
SystemDelayMs(500);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool AudioRecordTelitLe910_Stop(tAtCmd *telitAt) {
|
||||
return AtGsmTelitLe910_RecorderAudioFileStop(telitAt) == AT_OK;
|
||||
}
|
||||
|
||||
static bool AudioPlayerTelitLe910_WaitStop(tAtCmd *telitAt, uint32_t timeout) {
|
||||
bool result= AtGsmTelitLe910_RecAudioWaitEnd(telitAt, timeout) == AT_OK;
|
||||
if(result){
|
||||
SystemDelayMs(timeout);
|
||||
AudioRecordTelitLe910_Stop(telitAt);
|
||||
SystemDelayMs(500);
|
||||
return result;
|
||||
} else {
|
||||
AudioRecordTelitLe910_Stop(telitAt);
|
||||
SystemDelayMs(500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
tAudioRecorderInterface AudioRecordTelitLe910_GetInterface(tAtCmd *telitAt) {
|
||||
tAudioRecorderInterface result = {
|
||||
.env = telitAt,
|
||||
.start = (audioRecordStart) AudioRecordTelitLe910_Start,
|
||||
.stop = (audioRecordStop) AudioRecordTelitLe910_Stop,
|
||||
.del = (audioRecordDel) AtGsmTelitLe910_RecordrerAudioFileDel,
|
||||
.waitStop = (audioRecordWaitStop) AudioPlayerTelitLe910_WaitStop,
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"dep": [
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"Inc"
|
||||
],
|
||||
"srcs": [
|
||||
"Src/**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue