189 lines
5.2 KiB
C
189 lines
5.2 KiB
C
//
|
|
// Created by xemon on 19.09.22.
|
|
//
|
|
|
|
#ifndef SMART_COMPONENTS_MAINMODESARBITER_H
|
|
#define SMART_COMPONENTS_MAINMODESARBITER_H
|
|
|
|
#include <stdbool.h>
|
|
#include "I2cPorts.h"
|
|
#include "Rtcs.h"
|
|
#include "Gpios.h"
|
|
#include "SerialPorts.h"
|
|
#include "Adcs.h"
|
|
#include "StorageOnFlash.h"
|
|
#include "FreeRTOS.h"
|
|
#include "DeviceStorage.h"
|
|
#include "AudioCodec.h"
|
|
#include "GsmWithGnss.h"
|
|
#include "Accel.h"
|
|
#include "LoggerToSerialPort.h"
|
|
#include "CrashDetection.h"
|
|
#include "ComInt.h"
|
|
#include "ComandLineInterface.h"
|
|
#include "DeviceTesting_Env.h"
|
|
#include "SignaturePduSpecific.h"
|
|
#include "Amplifier.h"
|
|
#include <EraGlonassUveos.h>
|
|
#include <PowerManagment.h>
|
|
#include "CanPorts.h"
|
|
#include "ext_telematica.h"
|
|
#include "AudioPlayerSimComSim7600E.h"
|
|
#include "AudioRecorderSimComSim7600E.h"
|
|
#include "ModemDataCollector.h"
|
|
#include "TelematicaConnectStatus.h"
|
|
#include "SubsystemSwitcher.h"
|
|
|
|
typedef struct {
|
|
|
|
// Преферийные интерфесы
|
|
tGpios *gpios;
|
|
tSerialPorts *serialPorts;
|
|
tI2cPorts *i2cPorts;
|
|
tSpiPorts *spiPorts;
|
|
tAdcs *adcs;
|
|
tStorageOnFlash *flash;
|
|
tRtcs *rtc;
|
|
tCanPorts *canPorts;
|
|
|
|
// Преферийные устройства
|
|
tDeviceStorage storage;
|
|
tPowerManagement power;
|
|
tAudioCodec audioCodec;
|
|
tAmplifier amplifier;
|
|
tGsmWithGnss gsmWithGnss;
|
|
tAccel *accel;
|
|
tAudioPlayer audioPlayer;
|
|
tAudioRecorder audioRecorder;
|
|
//Подсистемы
|
|
tLoggerToSerialPort slog;
|
|
tUserInput userInput;
|
|
tUserIndication indication;
|
|
tComInt comInt;
|
|
// tCli cli;
|
|
tCli cliVrt;
|
|
tModemDataColl ModemDataCollector;
|
|
tDeviceTesting testing;
|
|
|
|
tCrashDetection crashDetect;
|
|
tEraGlonassUveos uveos;
|
|
tSystemSelector systemSelector;
|
|
uint32_t lastSmsCheckTime;
|
|
|
|
struct {
|
|
osThreadId_t id;
|
|
uint32_t stack[4048]; //4048 6072
|
|
StaticTask_t controlBlock;
|
|
osThreadAttr_t attr;
|
|
} thread;
|
|
|
|
tSystemStateID_0006 SystemStateID_0006;
|
|
tInputStatesRecord_0001 InputStatesRecord_0001;
|
|
tOutputStatesRecord_0002 OutputStatesRecord_0002;
|
|
|
|
struct {
|
|
uint8_t BoardVoltage;
|
|
uint8_t ReserveBatteryCharge;
|
|
uint8_t ReserveBatteryTemperature;
|
|
tVehicleCoordinates VehicleCoordinates;
|
|
uint8_t VehicleCoordinatesReliability;
|
|
uint8_t MDS_FormatVersion;
|
|
uint8_t TCM_working_mode;
|
|
uint8_t TCM_activation_source;
|
|
uint8_t TCM_time_calculation;
|
|
uint8_t GLONASS_and_GLONASS_GPS_groups;
|
|
uint8_t GsmRegistrationState;
|
|
uint32_t TimeStamp;
|
|
uint8_t GsmInnerError;
|
|
uint8_t VehicleCoordinatesReliabilityMem;
|
|
uint8_t GsmRegistartionStateMem;
|
|
uint8_t GsmRegistrationError;
|
|
uint8_t EcallOn;
|
|
uint8_t CrashSignalExternal;
|
|
uint16_t GnssPowerOffTime;
|
|
uint8_t AutomaticActivationProhibition;
|
|
uint8_t ECALLToTest;
|
|
uint8_t NadRegistrationAtStartup;
|
|
char GSMSoftwareVersionNumber[32]; // 20
|
|
char SmsFallbackTestNumber[20]; // 20
|
|
uint8_t SimProfileAmount;
|
|
uint8_t SimProfile;
|
|
uint8_t AudioProfile;
|
|
uint8_t EcallNoAutomaticTriggering;
|
|
uint8_t MiddletState;
|
|
char Vehicle_SW_Version[3]; // 3
|
|
char Midlet_SW_Version[3]; // 3
|
|
char Boot_SW_Version[27]; // 27
|
|
uint8_t SertState;
|
|
uint16_t ApplicationCheckSum;
|
|
uint8_t Audio_HW_Settings;
|
|
tEmergencyCallCounter ECALL_EmergencyCallCounter;
|
|
char Avaialble_Networks_List[128]; //128
|
|
uint8_t SavedMSDAmount;
|
|
uint8_t SentMSDAmount;
|
|
char VehicleManufacturerSparePartNumber[10]; //10
|
|
char ConfigurationFileReferenceLink[10]; //10
|
|
char SystemSupplierIdentifier[3]; //3
|
|
char ECUSerialNumber[20]; //20
|
|
char VehicleManufacturerECUHardwareNumber[10]; //10
|
|
char SystemSupplierECUSoftwareNumber[2]; //2
|
|
char SystemSupplierECUSoftwareVersionNumber[2]; //2
|
|
uint8_t VDIAG;
|
|
} state;
|
|
|
|
bool flIgn;
|
|
bool playMode;
|
|
bool fl_iniSysIsDone;
|
|
|
|
tStaticThreadBlock(128) threadSubstartChekButton;
|
|
tStaticThreadBlock(512) threadAccompanMode;
|
|
tStaticThreadBlock(512) threadToUDS_Info;
|
|
|
|
tSignPack signature;
|
|
uint8_t userInputSubstart;
|
|
eQueryUDSState queryUDSState;
|
|
osMutexId_t mux_factoryMode;
|
|
uint32_t tmt;
|
|
uint32_t tmpTm;
|
|
uint32_t tm_FactoryMessage;
|
|
bool checNetDeGeg;
|
|
|
|
/**
|
|
* Флаг очистки переменных EOL
|
|
*/
|
|
bool eolAcsess;
|
|
|
|
/**
|
|
* Флаг проверки нахождения в режиме производственного теста
|
|
*/
|
|
bool fl_isFacrotyMode;
|
|
|
|
|
|
eTelematicaIsConnect telematicaIsConnect;
|
|
tGNSS_General GNSS_General;
|
|
eLastEventDevice lastEventDevice;
|
|
eCarType carType;
|
|
uint32_t tmStart;
|
|
tSystemSwitcher systemSwitcher;
|
|
} tMma;
|
|
|
|
void Mma_Init(
|
|
tMma *env,
|
|
tGpios *gpios,
|
|
tSerialPorts *serialPorts,
|
|
tI2cPorts *i2cPorts,
|
|
tSpiPorts *spiPorts,
|
|
tAdcs *adcs,
|
|
tStorageOnFlash *flash,
|
|
tRtcs *rtc,
|
|
tCanPorts *canPorts
|
|
);
|
|
|
|
void Mma_StartThread(tMma *env);
|
|
|
|
void AccompanModeStopThread(tMma *env);
|
|
|
|
#define Mma_SetMode(ENV, VALUE) UserIndication_SetMode(&((ENV)->indication),(VALUE))
|
|
|
|
#endif //SMART_COMPONENTS_MAINMODESARBITER_H
|