185 lines
4.7 KiB
C
185 lines
4.7 KiB
C
//
|
|
// Created by zemon on 20.02.24.
|
|
//
|
|
|
|
#ifndef HEAVY_TERMINAL_GSMWITHGNSS_H
|
|
#define HEAVY_TERMINAL_GSMWITHGNSS_H
|
|
|
|
#include "SerialPortIO.h"
|
|
#include "AtGsmSimcomSim7600.h"
|
|
#include "EraGlonassUveos.h"
|
|
#include "LoggerInterface.h"
|
|
#include "BaseTypes.h"
|
|
#include <AudioPlayerInterface.h>
|
|
#include <AudioRecorderInterface.h>
|
|
#include "ControllableSwitch.h"
|
|
#include "RtcIO.h"
|
|
#include "Nmea0183Parser.h"
|
|
#include "CmsisRtosThreadUtils.h"
|
|
#include "SystemMutexCmsis.h"
|
|
#include "AudioPlayerSimComSim7600E.h"
|
|
#include "AudioRecorderSimComSim7600E.h"
|
|
|
|
//typedef struct {
|
|
// tString32 softValue;
|
|
// tString32 ssidValue;
|
|
// tString32 cgsmValue;
|
|
// bool aufioFileIsValid;
|
|
//} tModemVersionRevision;
|
|
|
|
typedef enum {
|
|
GSM_INITIALIZING=0,
|
|
GSM_IDLE=1,
|
|
GSM_ERROR=2,
|
|
GSM_NOT_USET=2,
|
|
} tGsmState;
|
|
|
|
typedef struct {
|
|
bool *enableGnssUpdate;
|
|
tAtCmd gsmAt;
|
|
tAudioPlayer *audioPlayer;
|
|
tAudioRecorder *audioRecorder;
|
|
tNavDataProvider navDataProvider;
|
|
tEraGlonassEcallProvider ecallProvider;
|
|
tEraGlonassSmsProvider smsProvider;
|
|
tLoggerInterface *logger;
|
|
tString16 *smsCenter;
|
|
tRtcIO *Rtc;
|
|
|
|
tAudioPlayerInterface audioPlayerIO;
|
|
tAudioRecorderInterface audioRecorderIO;
|
|
tAtGsm_NetworkRegistrationState regState;
|
|
tControllableSwitch useInternalAntennaSwitch;
|
|
tControllableSwitch enableNetworkSwitch;
|
|
tGsmState gsmState;
|
|
|
|
struct {
|
|
volatile bool msdSendResult;
|
|
volatile bool msdPull;
|
|
volatile bool ring;
|
|
volatile bool netReg;
|
|
volatile bool inputCall;
|
|
volatile bool ringStatus;
|
|
volatile bool message;
|
|
} urc;
|
|
|
|
struct {
|
|
volatile uint32_t next;
|
|
volatile uint16_t *dataRateHz;
|
|
|
|
tNmeaRmc currentRmc;
|
|
tNmeaRmc prevRmc;
|
|
|
|
SystemMutexCmsis rmcAccess;
|
|
} gnss;
|
|
|
|
|
|
struct {
|
|
uint8_t gsmRx[512];
|
|
uint8_t gsmTx[512];
|
|
} mem;
|
|
|
|
bool busyThread;
|
|
bool flBlockReg;
|
|
bool isRegToGSM;
|
|
|
|
tStaticThreadBlock(512) urcT;
|
|
} tGsmWithGnss;
|
|
|
|
//Common
|
|
void GsmWithGnssInit(
|
|
tGsmWithGnss *env,
|
|
tString16 *smsCenter,
|
|
uint16_t *gnssDataRateHz,
|
|
tRtcIO *Rtc,
|
|
bool *enableGnssUpdate,
|
|
tAudioPlayer *audioPlayer,
|
|
tAudioRecorder *audioRecorder
|
|
);
|
|
|
|
void GsmWithGnss_startUrcThread(tGsmWithGnss *env);
|
|
|
|
AtCommandResult GsmWithGnssConfigureAudioProfile(tGsmWithGnss *env, tString32 *profileData);
|
|
|
|
void GsmWithGnss_ResetPbDone(tGsmWithGnss *env);
|
|
|
|
bool GsmWithGnss_IsPbDone(tGsmWithGnss *env);
|
|
|
|
void Gsm_WaitGetTimeAsBaseStation(tGsmWithGnss *env);
|
|
|
|
bool GsmWaitFirstStartup(tGsmWithGnss *env);
|
|
|
|
bool GsmWithGnss_InvalidateNetworkEnable(tGsmWithGnss *env, uint32_t currentState, uint32_t targetState);
|
|
|
|
void GsmWithGnss_SetNetworkRegistration(tGsmWithGnss *env, bool value);
|
|
|
|
AtCommandResult GsmWithGnss_NetworkReconnect(tAtCmd *env, uint8_t cuontReg);
|
|
|
|
bool GetMuxNavDataAcsess(tGsmWithGnss *env, tNmeaRmc *rmc);
|
|
|
|
bool GsmWithGnss_WaitNetworkRegistration(tGsmWithGnss *env, uint32_t timeReg);
|
|
|
|
void GsmWithGnss_UseInternalAntenna(tGsmWithGnss *env, bool value);
|
|
|
|
bool GsmWithGnss_SetNewMSD(tGsmWithGnss *env,
|
|
uint8_t *msd,
|
|
size_t msdLength,
|
|
eEcallActivationType activationType,
|
|
eEcallTestMode testMode
|
|
);
|
|
|
|
//Gnss ops
|
|
AtCommandResult GsmWithGnssInitGnss(tGsmWithGnss *env);
|
|
|
|
AtCommandResult GsmWithGnssSimProfileSelect(tAtCmd *gsmAt, tStringLink profile);
|
|
|
|
AtCommandResult GsmWithGnss_NetworkSetStateInnaterups(tGsmWithGnss *env, uint8_t cuontReg, uint32_t timeOut);
|
|
|
|
bool GsmWithGnss_IsGnssReady(tGsmWithGnss *env);
|
|
|
|
//Audio ops
|
|
void GsmWithGnss_InitAudio(tGsmWithGnss *env);
|
|
|
|
//Ring ops
|
|
bool GsmWithGnss_IsRing(tGsmWithGnss *env);
|
|
|
|
//Ring reset
|
|
void GsmWithGnss_ResetRing(tGsmWithGnss *env);
|
|
|
|
bool GsmWithGnss_isOutCallActive(tGsmWithGnss *env);
|
|
|
|
bool GsmWithGnss_isInpCallActive(tGsmWithGnss *env);
|
|
|
|
void Gsm_WaitGsmBoot(tGsmWithGnss *env);
|
|
|
|
void Gsm_SetManualModemPower(
|
|
tGsmWithGnss *env,
|
|
bool *mode,
|
|
uint16_t *MODEM_POWER_FOR_LTE_MODE,
|
|
uint16_t *MODEM_POWER_FOR_WCDMA_MODE,
|
|
uint16_t *MODEM_POWER_FOR_GSM_MODE
|
|
);
|
|
|
|
void Gsm_CodecIsConfig(tGsmWithGnss *env);
|
|
|
|
void AtGsm_Gsnss_NavData_Processing(tGsmWithGnss *env, tAtBuffer *buf);
|
|
//void AtGsm_Gsnss_NavData_Processing(tGsmWithGnss *env);
|
|
|
|
void GsmWithGnss_resetMsd(tGsmWithGnss *env);
|
|
|
|
void GsmWithGnss_resetInputCall(tGsmWithGnss *env);
|
|
|
|
void AtGsm_Gsnss_GetLastActualNavData(tGsmWithGnss *env, EraGlonassUveosNavData *location, bool locSourse);
|
|
|
|
void HotStartGNSS(tGsmWithGnss *env);
|
|
|
|
void StopResiver(tGsmWithGnss *env);
|
|
|
|
void StartResiver(tGsmWithGnss *env);
|
|
|
|
AtCommandResult GsmWithGnss_AudioFilesValidation(tGsmWithGnss *env);
|
|
|
|
AtCommandResult Gsm_SturtupCodec(tGsmWithGnss *env);
|
|
|
|
#endif //HEAVY_TERMINAL_GSMWITHGNSS_H
|