AtGsmSim7600/Src/AtGsmSim7600e_DigitalVoiceb...

74 lines
2.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Created by xemon on 20.10.22.
//
#include "AtGsmSim7600e_DigitalVoicebandInterface.h"
#include <AtCmdCommonProtected.h>
// level: 0-5
AtCommandResult AtGsmSim7600e_LoudspeakerVolumeLevel(tAtCmd *env, uint8_t level) {
AtCmdPrepare(env);
AtCmdTxClear(env);
AtCmdTxAddStatic(env, "AT+CLVL=");
AtCmdTxAddDecimalIntWithLimit(env, level, 5);
AtCmdTxSendLn(env);
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
}
// value: 0-16
// time: Duration, the default value is 50ms. Support 1-1000.
// gain: The default value is 4000. Support 1-9999.
AtCommandResult AtGsmSim7600e_Play_Tone(tAtCmd *env, uint8_t value, uint16_t time, uint16_t gain) {
AtCmdPrepare(env);
AtCmdTxClear(env);
AtCmdTxAddStatic(env, "AT+CPTONE=16,50,4000");
// AtCmdTxAddDecimalInt(env, value, 16);
// AtCmdTxAddDecimalInt(env, time, 1000);
// AtCmdTxAddDecimalInt(env, gain, 9999);
AtCmdTxSendLn(env);
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
}
// mode:
// 0 Module control codec when play sound.
// 1 Host device control codec. Host device can open codec by
// AT+CSDVC=1 or AT+CSDVC=3, close codec by AT+CSDVC=0.
AtCommandResult AtGsmSim7600e_ControlCodecByHostDeviceOrModule(tAtCmd *env, uint8_t mode) {
AtCmdPrepare(env);
AtCmdTxClear(env);
AtCmdTxAddStatic(env, "AT+CODECCTL=");
AtCmdTxAddDecimalIntWithLimit(env, mode, 1);
AtCmdTxSendLn(env);
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
}
// mode:
// 0 Close voice channel device. Only used after AT+CODECCTL=1
// 1 Handset.
// 3 Speaker phone.
AtCommandResult AtGsmSim7600e_Switch_Voice_Channel_Device(tAtCmd *env, uint8_t mode) {
AtCmdPrepare(env);
AtCmdTxClear(env);
AtCmdTxAddStatic(env, "AT+CSDVC=");
AtCmdTxAddDecimalIntWithLimit(env, mode, 1);
AtCmdTxSendLn(env);
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
}
// volte_sample:
// 0 Sampling rate is 16K.
// 1 Sampling rate is 8K.
// novolte_sample:
// 0 Sampling rate is 16K.
// 1 Sampling rate is 8K.
AtCommandResult AtGsmSim7600e_Modify_The_Sampling_Rate_Of_The_PCM(tAtCmd *env, uint8_t volte_sample, uint8_t novolte_sample) {
AtCmdPrepare(env);
AtCmdTxClear(env);
AtCmdTxAddStatic(env, "AT+CPCMBANDWIDTH=");
AtCmdTxAddDecimalIntWithLimit(env, volte_sample, 1);
AtCmdTxAddStatic(env, ",");
AtCmdTxAddDecimalIntWithLimit(env, novolte_sample, 1);
AtCmdTxSendLn(env);
return AtCmdOkErrAnswer(env, env->stdRxTimeout);
}