Init
This commit is contained in:
commit
d65fcedaa6
|
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// Created by zemon on 12.04.24.
|
||||
//
|
||||
|
||||
#ifndef SMART_COMPONENTS_ANTTEST_H
|
||||
#define SMART_COMPONENTS_ANTTEST_H
|
||||
|
||||
#include "stdbool.h"
|
||||
#include "AdcIO.h"
|
||||
#include "AtCmdBase.h"
|
||||
|
||||
typedef struct {
|
||||
bool *mode;
|
||||
tAdcIO *externalAdc;
|
||||
tAtCmd *gsmAt;
|
||||
}tAntTest;
|
||||
|
||||
#endif //SMART_COMPONENTS_ANTTEST_H
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// Created by zemon on 12.04.24.
|
||||
//
|
||||
|
||||
#ifndef SMART_COMPONENTS_DEVICETESTING_H
|
||||
#define SMART_COMPONENTS_DEVICETESTING_H
|
||||
|
||||
#include "DeviceTesting_Env.h"
|
||||
|
||||
//#define AURUS_CAR_UI 1
|
||||
|
||||
bool DeviceTesting_OnIgnitionWithoutGsm(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_Periodical(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_OnIgnitionAfterGsm(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_Always(tDeviceTesting *env);
|
||||
|
||||
void DeviceTesting_MainTestingMode(tDeviceTesting *env);
|
||||
|
||||
void DeviceTesting_ManualTestMode(tDeviceTesting *env);
|
||||
|
||||
void DeviceTesting_ChekExit(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_ExitTestMode(tDeviceTesting *env);
|
||||
|
||||
#endif //SMART_COMPONENTS_DEVICETESTING_H
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
//
|
||||
// Created by xemon on 18.11.22.
|
||||
//
|
||||
|
||||
#ifndef UVEOS_ON_NATION_DEVICETESTING_ENV_H
|
||||
#define UVEOS_ON_NATION_DEVICETESTING_ENV_H
|
||||
|
||||
#include "DeviceTestsTable.h"
|
||||
#include "GpioPinInterface.h"
|
||||
#include "AtCmdCommon.h"
|
||||
#include "AudioCodec.h"
|
||||
#include "LoggerInterface.h"
|
||||
#include "AudioPlayerInterface.h"
|
||||
#include "AudioRecorderInterface.h"
|
||||
#include "UserButtonsInterface.h"
|
||||
#include "UserIndication.h"
|
||||
#include "EraGlonassMsd.h"
|
||||
#include "EraGlonassUveos.h"
|
||||
#include "Adc.h"
|
||||
#include "SpiPortIO.h"
|
||||
#include "AccelDataFlowInterface.h"
|
||||
#include "Accel.h"
|
||||
#include "SpiPortArtery.h"
|
||||
#include "CmsisRtosThreadUtils.h"
|
||||
#include "GsmWithGnss.h"
|
||||
#include "AntTest.h"
|
||||
#include "UserInputButtonWatcher.h"
|
||||
#include "PowerManagment.h"
|
||||
#include "Gpios.h"
|
||||
#include "RoutineControl_31.h"
|
||||
#include "Amplifier.h"
|
||||
#include "AtGsmSimComA7600_SSL_LOAD_CA.h"
|
||||
#include "ModemDataCollector.h"
|
||||
|
||||
|
||||
#define DEVICE_TESTS_LIMIT (24)
|
||||
|
||||
typedef enum {
|
||||
FULL_TESTS = 0,
|
||||
SPEAK_MICR_TEST = 1,
|
||||
GSM_TEST = 2,
|
||||
ECALL_TEST = 3,
|
||||
ECALL_NOT_REG_TEST = 4,
|
||||
ECALL_TEST_AUTO = 5,
|
||||
REG_TO_NETWORK = 6,
|
||||
REG_BOARD_VOLTAGE_CALIBRATION = 7,
|
||||
LEDS_TEST = 8,
|
||||
INTERNAL_ONE_TEST = 9,
|
||||
}eControlTransferSource;
|
||||
|
||||
typedef enum {
|
||||
QUERY_INIT = 0,
|
||||
QUERY_RUN = 1,
|
||||
QUERY_STOP= 2,
|
||||
QUERY_ERROR = 3,
|
||||
QUERY_BUSY= 4,
|
||||
QUERY_DONE= 5
|
||||
} eState;
|
||||
|
||||
typedef enum {
|
||||
COM_INIT= 0,
|
||||
COM_RUN = 1,
|
||||
COM_STOP= 2,
|
||||
} eCommands;
|
||||
|
||||
typedef enum {
|
||||
HINTS_MINIMAL = 0,
|
||||
HINTS_NORMAL = 1,
|
||||
HINTS_FULL = 2,
|
||||
HINTS_NOT_ERA_EXIT = 3,
|
||||
HINTS_NONE = 3
|
||||
} eAudioHintsMode;
|
||||
|
||||
typedef enum {
|
||||
SYSTEM_IS_BUSY = 0,
|
||||
SYSTEM_IS_FREE = 1,
|
||||
SYSTEM_IS_DONE = 2,
|
||||
} eSystemExitStatus;
|
||||
|
||||
typedef struct {
|
||||
eState state;
|
||||
eCommands commands;
|
||||
eControlTransferSource source;
|
||||
} eQueryUDSState;
|
||||
|
||||
typedef struct {
|
||||
eDeviceTestingCode *deviceTestingCodeCan;
|
||||
tDeviceStorage *deviceStorage;
|
||||
bool *fl_IsLoad;
|
||||
} tCanTest;
|
||||
|
||||
typedef struct {
|
||||
tDeviceModes *deviceModes;
|
||||
tDeviceStorage *deviceStorage;
|
||||
tIsFind checkCert;
|
||||
tGsmWithGnss *gsmWithGnss;
|
||||
tModemDataColl *modemDataCollector;
|
||||
bool *telematicaIsActive;
|
||||
bool *testTelematicaIsActive;
|
||||
bool *fl_telematicaServerIsActive;
|
||||
|
||||
} tModemVersionRevisionTest;
|
||||
|
||||
typedef struct {
|
||||
tMSD_DiagnosticResult tmsdDiagRes;
|
||||
tTestDescriptor testsTableAlloc[DEVICE_TESTS_LIMIT];
|
||||
tDeviceTestsTable testsTable;
|
||||
tEraGlonassUveos *ErGlUv;
|
||||
tLoggerInterface *logger;
|
||||
tAudioPlayerInterface *audioPlayer;
|
||||
tAudioRecorderInterface *audioRecorder;
|
||||
tUserButtonsInterface *input;
|
||||
tUserIndication *indication;
|
||||
tGpioPin *pinIgnition;
|
||||
tGpioPin *ringPin;
|
||||
tAccelDataFlowInterface *accelDFI;
|
||||
tUserInputButtonWatcher *UserInputButtonWatcher;
|
||||
uint8_t indicationStatusRes;
|
||||
uint8_t ignitionAddStatusRes;
|
||||
uint8_t buttonAddStatusRes;
|
||||
uint8_t ecallAddStatusRes;
|
||||
tGsmWithGnss *gsmWithGnss;
|
||||
tSpekTestPower *spekTestPower;
|
||||
tBipPins *bipDiagnost;
|
||||
tPowerManagement *powerManagement;
|
||||
tDeviceStorage *deviceStorage;
|
||||
tModemVersionRevisionTest modemVersionRevisionTest;
|
||||
|
||||
struct {
|
||||
tTestDescriptor *can;
|
||||
tTestDescriptor *ignition;
|
||||
tTestDescriptor *gnssAnt;
|
||||
tTestDescriptor *speakConnect;
|
||||
tTestDescriptor *batteryConn;
|
||||
tTestDescriptor *batteryCharge;
|
||||
tTestDescriptor *firmware;
|
||||
tTestDescriptor *gsm;
|
||||
tTestDescriptor *audioCodec;
|
||||
tTestDescriptor *accel;
|
||||
tTestDescriptor *bipConnect;
|
||||
|
||||
tTestDescriptor *modemSoftRevision;
|
||||
tTestDescriptor *modemSertRevision;
|
||||
tTestDescriptor *modemAudiotRevision;
|
||||
tTestDescriptor *modemAmplifare;
|
||||
tTestDescriptor *modemSimEra;
|
||||
tTestDescriptor *modemSimComers;
|
||||
tTestDescriptor *vin;
|
||||
tTestDescriptor *accel_calib;
|
||||
tTestDescriptor *eol;
|
||||
tTestDescriptor *tele;
|
||||
|
||||
} namedTests;
|
||||
|
||||
tStaticThreadBlock(2048) threadUserTest;
|
||||
tCanTest canTest;
|
||||
bool flagAutoTestSucsess;
|
||||
uint8_t flagAcsessExitThread;
|
||||
tAntTest antDiscript;
|
||||
eControlTransferSource controlTransferSource;
|
||||
bool fl_oneTestResult;
|
||||
bool telematicaIsActive;
|
||||
tAmplifier *amplifier;
|
||||
tModemDataColl *modemDataColl;
|
||||
tString32 *ccidEra;
|
||||
tString32 *ccidComers;
|
||||
eQueryUDSState *queryUDSState;
|
||||
eAudioHintsMode audioHintsMode;
|
||||
tVersionRevision *modemVersionRevision;
|
||||
eSubSystems *subSystemsTmp;
|
||||
osMutexId_t mux_testingMode;
|
||||
tUserInputButtonEvent buttonEvent;
|
||||
float *boardVoltCalbCof;
|
||||
eSystemExitStatus systemExitStatus;
|
||||
|
||||
} tDeviceTesting;
|
||||
|
||||
bool DeviceTesting_Init(
|
||||
tDeviceTesting *env,
|
||||
|
||||
tUserInputButtonWatcher *UserInputButtonWatcher,
|
||||
tGpioPin *ignPin,
|
||||
tAdcIO *gnssAntAdc,
|
||||
tSpekTestPower *spekTestPower,
|
||||
tBipPins *bipDiagnost,
|
||||
tBatteryPower *batteryPower,
|
||||
tAccel *accel,
|
||||
|
||||
tGsmWithGnss *gsmWithGnss,
|
||||
tAudioCodec *audioCodec,
|
||||
tLoggerInterface *logger,
|
||||
tAtCmd *gsmAt,
|
||||
|
||||
tAudioPlayerInterface *audioPlayer,
|
||||
tAudioRecorderInterface *audioRecorder,
|
||||
|
||||
tUserButtonsInterface *input,
|
||||
tUserIndication *indication,
|
||||
|
||||
tEraGlonassUveos *ErGlUv,
|
||||
bool *antMode,
|
||||
tGpioPin *ring,
|
||||
tPowerManagement *powerManagement,
|
||||
|
||||
tDeviceStorage *deviceStorage,
|
||||
tDeviceModes *deviceModes,
|
||||
tAmplifier *amplifier,
|
||||
tModemDataColl *modemDataColl,
|
||||
eQueryUDSState *queryUDSState,
|
||||
float *boardVoltCalbCof,
|
||||
bool *telematicaIsActive,
|
||||
bool *fl_telematicaServerIsActive,
|
||||
eDeviceTestingCode *deviceTestingCodeCan
|
||||
);
|
||||
|
||||
//ограничение воспроизведения одного семпла в 60с, можно увеличить до длительности большего семпла
|
||||
#define DEVTST_PLAY_SAMPLE(SAMPLE) \
|
||||
AudioPlayer_PlayToWait(env->audioPlayer, SAMPLE, 6*1000);
|
||||
|
||||
///AudioPlayer_PlayStaticTone(env->audioPlayer,5);
|
||||
|
||||
//ограничение записи одного семпла в 60с, можно увеличить до длительности большего семпла
|
||||
#define DEVTST_REC_SAMPLE(SAMPLE) \
|
||||
SystemDelayMs(40);\
|
||||
AudioRecord_RecStatic(env->audioRecorder, SAMPLE, 6*1000);
|
||||
|
||||
#define DEVTST_REC_TO_WAIT_SAMPLE(SAMPLE) \
|
||||
AudioRecord_RecStaticToWaitEnd(env->audioRecorder, SAMPLE, 6*1000);
|
||||
|
||||
//#define DEVTST_GET_MAIN(NAME) DeviceTestsTable_GetModeTestStatic(&env->testsTable, DEVICE_TESTING_MODE_MAIN, NAME);
|
||||
|
||||
//Return IF Error (RIFE) - Выйти в случае ошибки
|
||||
#define DEVICE_TESTING_RIFE(FUNC) {bool result = FUNC; if(!result){ return result;}}
|
||||
|
||||
//Битовые флаги режимов тестирования (константы с локальной видимостью)
|
||||
static const uint16_t DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM = 0b1 << 0;
|
||||
static const uint16_t DEVICE_TESTING_MODE_IGNITION_AFTER_GSM = 0b1 << 1;
|
||||
static const uint16_t DEVICE_TESTING_MODE_ALWAYS = 0b1 << 2;
|
||||
static const uint16_t DEVICE_TESTING_MODE_PERIODICAL = 0b1 << 3;
|
||||
static const uint16_t DEVICE_TESTING_MODE_MAIN = 0b1 << 4;
|
||||
static const uint16_t DEVICE_TESTING_MODE_ALL = 0xFFFF;
|
||||
|
||||
static const uint16_t DEVICE_TESTING_MODE_NOT_ALWAYS =
|
||||
DEVICE_TESTING_MODE_ALL
|
||||
& ~DEVICE_TESTING_MODE_ALWAYS
|
||||
& ~DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||
& ~DEVICE_TESTING_MODE_IGNITION_AFTER_GSM;
|
||||
|
||||
|
||||
|
||||
bool DeviceTests_InitTestsTable(
|
||||
tDeviceTesting *env,
|
||||
tGpioPin *ignitionPin,
|
||||
tSpekTestPower *spekTestPower,
|
||||
tBipPins *bipTestDiagnost,
|
||||
tBatteryPower *batteryPower,
|
||||
tAtCmd *gsm,
|
||||
tAudioCodec *audioCodec,
|
||||
tAccel *accel,
|
||||
tAntTest *antCheck,
|
||||
tDeviceStorage *deviceStorage,
|
||||
tModemVersionRevisionTest *modemVersionRevisionTest,
|
||||
tAmplifier *amplifier,
|
||||
tCanTest *canTest
|
||||
);
|
||||
|
||||
|
||||
|
||||
#endif //UVEOS_ON_NATION_DEVICETESTING_ENV_H
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// Created by zemon on 12.04.24.
|
||||
//
|
||||
|
||||
#ifndef SMART_COMPONENTS_DEVICETESTING_TESTINGMETHODS_H
|
||||
#define SMART_COMPONENTS_DEVICETESTING_TESTINGMETHODS_H
|
||||
|
||||
|
||||
#include "DeviceTesting_Env.h"
|
||||
#include "AntTest.h"
|
||||
#include "PowerManagment.h"
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AntTest(tAntTest *antTest);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_BipConnectTest(tBipPins *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_ModemSoftwareValidation(tModemVersionRevisionTest *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_ModemAudioFileValidation(tModemVersionRevisionTest *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_ModemCertValidation(tModemVersionRevisionTest *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcSpeakerTest(tSpekTestPower *spekTestPower);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcBatteryConnectionTest(tBatteryPower *batteryPower);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcBatteryChargeTest(tBatteryPower *batteryPower);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcBatteryVoltageTest(tBatteryPower *batteryPower);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_IgnitionTest(tGpioPin *gpioPin);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_CanTest(const tCanTest *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_TestAt(tModemVersionRevisionTest *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_TestAudioCodec(tAudioCodec *audioCodec);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_TestAccel(tAccel *accel);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_JustOk(void *nil);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_VIN(tDeviceStorage *deviceStorage);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_CALIB_ACCEL(tDeviceStorage *deviceStorage);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_EOL(tDeviceTestsTable *testsTable);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_Telematica(tModemVersionRevisionTest *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_GetThisSubSystem(eSubSystems *subSystemsTmp);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_Aamplifier(tAmplifier *amplifier);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_SimEra(tModemVersionRevisionTest *env);
|
||||
|
||||
eDeviceTestingCode DeviceTesting_SimComers(tModemVersionRevisionTest *env);
|
||||
|
||||
#endif //SMART_COMPONENTS_DEVICETESTING_TESTINGMETHODS_H
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// Created by zemon on 12.04.24.
|
||||
//
|
||||
|
||||
#ifndef SMART_COMPONENTS_DEVICETESTING_TESTSWITHUSER_H
|
||||
#define SMART_COMPONENTS_DEVICETESTING_TESTSWITHUSER_H
|
||||
|
||||
|
||||
#include "DeviceTesting_Env.h"
|
||||
|
||||
uint16_t *getResultFix(tDeviceTestsTable *testsTable, char *testName, uint8_t testNameLength);
|
||||
|
||||
bool DeviceTesting_TestAudioSpeaker(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_Ignition(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_TestingECool(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_Indication(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_Buttons(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_TestMic(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_TestSpeakMic(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_WaitTestResult(tTestDescriptor *test, uint16_t value, uint32_t timeout);
|
||||
|
||||
bool DeviceTesting_UserGetResult(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_RunUserTests(tDeviceTesting *env);
|
||||
|
||||
bool DeviceTesting_Ecall(tDeviceTesting *env);
|
||||
|
||||
void DeviceTesting_GetEcalRes(tDeviceTesting *env);
|
||||
|
||||
void DeviceTesting_ExitTestPlay(tDeviceTesting *env);
|
||||
|
||||
void DeviceTesting_StartUserTestThread(tDeviceTesting *env);
|
||||
|
||||
void DeviceTesting_SetTelematicaTestMode(tDeviceTesting *env, bool mode);
|
||||
|
||||
#endif //SMART_COMPONENTS_DEVICETESTING_TESTSWITHUSER_H
|
||||
|
|
@ -0,0 +1,795 @@
|
|||
//
|
||||
// Created by xemon on 30.10.22.
|
||||
//
|
||||
|
||||
|
||||
#include <AudioPlayerInterface.h>
|
||||
#include <SystemDelayInterface.h>
|
||||
#include "DeviceTesting.h"
|
||||
#include "UserInput.h"
|
||||
#include "DeviceTesting_TestsWithUser.h"
|
||||
#include "Adc.h"
|
||||
#include "EraGlonassMsd.h"
|
||||
#include "EraGlonassUveos.h"
|
||||
#include "Accel.h"
|
||||
#include "GsmWithGnss.h"
|
||||
#include "AsciiStringAssmeblingUtils.h"
|
||||
#include "semphr.h"
|
||||
#include "MainModesArbiter_Private.h"
|
||||
|
||||
#define LOGGER env->logger
|
||||
#define LOG_SIGN "Тест."
|
||||
|
||||
bool DeviceTesting_Init(
|
||||
tDeviceTesting *env,
|
||||
|
||||
tUserInputButtonWatcher *UserInputButtonWatcher,
|
||||
tGpioPin *ignPin,
|
||||
tAdcIO *gnssAntAdc,
|
||||
tSpekTestPower *spekTestPower,
|
||||
tBipPins *bipDiagnost,
|
||||
tBatteryPower *batteryPower,
|
||||
tAccel *accel,
|
||||
|
||||
tGsmWithGnss *gsmWithGnss,
|
||||
tAudioCodec *audioCodec,
|
||||
tLoggerInterface *logger,
|
||||
tAtCmd *gsmAt,
|
||||
|
||||
tAudioPlayerInterface *audioPlayer,
|
||||
tAudioRecorderInterface *audioRecorder,
|
||||
|
||||
tUserButtonsInterface *input,
|
||||
tUserIndication *indication,
|
||||
|
||||
tEraGlonassUveos *ErGlUv,
|
||||
bool *antMode,
|
||||
tGpioPin *ring,
|
||||
tPowerManagement *powerManagement,
|
||||
|
||||
tDeviceStorage *deviceStorage,
|
||||
tDeviceModes *deviceModes,
|
||||
tAmplifier *amplifier,
|
||||
tModemDataColl *modemDataColl,
|
||||
eQueryUDSState *queryUDSState,
|
||||
float *boardVoltCalbCof,
|
||||
bool *telematicaIsActive,
|
||||
bool *fl_telematicaServerIsActive,
|
||||
eDeviceTestingCode *deviceTestingCodeCan
|
||||
) {
|
||||
env->boardVoltCalbCof = boardVoltCalbCof;
|
||||
env->audioHintsMode = HINTS_FULL;
|
||||
env->queryUDSState = queryUDSState;
|
||||
env->amplifier = amplifier;
|
||||
env->modemDataColl = modemDataColl;
|
||||
env->UserInputButtonWatcher = UserInputButtonWatcher;
|
||||
env->logger = logger;
|
||||
env->audioPlayer = audioPlayer;
|
||||
env->audioRecorder = audioRecorder;
|
||||
env->input = input;
|
||||
env->indication = indication;
|
||||
env->ErGlUv = ErGlUv;
|
||||
env->accelDFI = &accel->accelDataFlow;
|
||||
env->pinIgnition = ignPin;
|
||||
env->ringPin = ring;
|
||||
env->antDiscript.externalAdc = gnssAntAdc;
|
||||
env->antDiscript.gsmAt = gsmAt;
|
||||
env->antDiscript.mode = antMode;
|
||||
env->gsmWithGnss = gsmWithGnss;
|
||||
env->spekTestPower = spekTestPower;
|
||||
env->powerManagement = powerManagement;
|
||||
env->bipDiagnost = bipDiagnost;
|
||||
env->deviceStorage = deviceStorage;
|
||||
env->fl_oneTestResult = false;
|
||||
env->telematicaIsActive = false;
|
||||
env->systemExitStatus = SYSTEM_IS_FREE;
|
||||
|
||||
env->modemVersionRevisionTest.deviceModes = deviceModes;
|
||||
env->modemVersionRevisionTest.modemDataCollector = modemDataColl;
|
||||
env->modemVersionRevisionTest.deviceStorage = deviceStorage;
|
||||
env->modemVersionRevisionTest.checkCert.isFind1 = false;
|
||||
env->modemVersionRevisionTest.checkCert.isFind2 = false;
|
||||
env->modemVersionRevisionTest.checkCert.isFind3 = false;
|
||||
env->modemVersionRevisionTest.gsmWithGnss = gsmWithGnss;
|
||||
env->modemVersionRevisionTest.telematicaIsActive = telematicaIsActive;
|
||||
env->modemVersionRevisionTest.fl_telematicaServerIsActive = fl_telematicaServerIsActive;
|
||||
env->modemVersionRevisionTest.testTelematicaIsActive = &env->telematicaIsActive;
|
||||
|
||||
env->canTest.deviceTestingCodeCan = deviceTestingCodeCan;
|
||||
env->canTest.deviceStorage = deviceStorage;
|
||||
env->canTest.fl_IsLoad = &env->modemVersionRevisionTest.modemDataCollector->fl_IsLoad;
|
||||
|
||||
env->mux_testingMode = osMutexNew(NULL);
|
||||
|
||||
DeviceTests_InitTestsTable(
|
||||
env,
|
||||
ignPin,
|
||||
env->spekTestPower,
|
||||
env->bipDiagnost,
|
||||
batteryPower,
|
||||
gsmAt,
|
||||
audioCodec,
|
||||
accel,
|
||||
&env->antDiscript,
|
||||
deviceStorage,
|
||||
&env->modemVersionRevisionTest,
|
||||
env->amplifier,
|
||||
&env->canTest
|
||||
);
|
||||
|
||||
InitThreadAtrStatic(&env->threadUserTest.attr, "Thread_UserTest", env->threadUserTest.controlBlock,
|
||||
env->threadUserTest.stack, osPriorityNormal);
|
||||
|
||||
env->flagAutoTestSucsess = false;
|
||||
env->flagAcsessExitThread = SYSTEM_IS_FREE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DeviceTesting_SetTelematicaTestMode(tDeviceTesting *env, bool mode) {
|
||||
env->telematicaIsActive = mode;
|
||||
}
|
||||
|
||||
void DeviceTesting_StartUserTestThread(tDeviceTesting *env) {
|
||||
if (!env->threadUserTest.id) {
|
||||
env->threadUserTest.id = osThreadNew(
|
||||
(osThreadFunc_t) (DeviceTesting_ManualTestMode),
|
||||
(void *) (env),
|
||||
&env->threadUserTest.attr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceTesting_ExitTestMode(tDeviceTesting *env) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Освобождение потока подсистемы тестирования")
|
||||
uint32_t tm = SystemGetMs() + 8000;
|
||||
while (tm > SystemGetMs()) {
|
||||
if (osMutexAcquire(env->gsmWithGnss->gsmAt.access, 100) == osOK) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Блокировка АТ интерфейса снята")
|
||||
if (osThreadTerminate(env->threadUserTest.id) == osOK) {
|
||||
SystemDelayMs(10);
|
||||
|
||||
|
||||
env->threadUserTest.id = NULL;
|
||||
env->flagAcsessExitThread = SYSTEM_IS_FREE;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Поток подсистемы тестирования освобождён")
|
||||
osMutexRelease(env->gsmWithGnss->gsmAt.access);
|
||||
AudioRecord_StopToEndRec(env->audioRecorder, 1000);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
osMutexRelease(env->gsmWithGnss->gsmAt.access);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
SystemDelayMs(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DeviceTesting_ChekExit(tDeviceTesting *env) {
|
||||
SystemDelayMs(50);
|
||||
EraGlonassUveos_DoNothingModeDistance(env->ErGlUv, false);
|
||||
}
|
||||
|
||||
bool DeviceTesting_RunUserTests(tDeviceTesting *env) {
|
||||
if (osMutexAcquire(env->mux_testingMode, 3000) == osOK) {
|
||||
|
||||
DeviceTesting_StartUserTestThread(env);
|
||||
|
||||
for (;;) {
|
||||
|
||||
if (env->flagAcsessExitThread == SYSTEM_IS_BUSY) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
// "!!!!SYSTEM_IS_BUSY!!!!!")
|
||||
SystemDelayMs(400);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (env->queryUDSState->commands == COM_STOP) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Попытка выхода из режима пользовательского тестирования, код 4")
|
||||
if (DeviceTesting_ExitTestMode(env)) {
|
||||
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматический выход из режима пользовательского тестирования, код 4")
|
||||
env->queryUDSState->commands = COM_INIT;
|
||||
osMutexRelease(env->mux_testingMode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GpioPinGet(env->pinIgnition) /*&& (env->flagAcsessExitThread == SYSTEM_IS_FREE)*/) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Попытка выхода из режима пользовательского тестирования, код 3")
|
||||
if (DeviceTesting_ExitTestMode(env)) {
|
||||
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматический выход из режима пользовательского тестирования, код 3")
|
||||
osMutexRelease(env->mux_testingMode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (env->flagAcsessExitThread == SYSTEM_IS_DONE) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Попытка выхода из режима пользовательского тестирования, код 2")
|
||||
if (DeviceTesting_ExitTestMode(env)) {
|
||||
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматический выход из режима пользовательского тестирования, код 2")
|
||||
osMutexRelease(env->mux_testingMode);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (env->ErGlUv->doNothing.mode == UVEOS_DO_NOTHING_DISABLED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Попытка выхода из режима пользовательского тестирования, код 1")
|
||||
if (DeviceTesting_ExitTestMode(env)) {
|
||||
EraGlonassUveos_DoNotingReset(env->ErGlUv);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматический выход из режима пользовательского тестирования, код 1")
|
||||
|
||||
osMutexRelease(env->mux_testingMode);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SystemDelayMs(400);
|
||||
}
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка захвата управления ( DeviceTesting_RunUserTests )");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceTesting_ManualTestMode(tDeviceTesting *env) {
|
||||
//запускаем режим тестирования с пользователем
|
||||
DeviceTesting_MainTestingMode(env);
|
||||
}
|
||||
|
||||
//возвращает true в случае ошибки
|
||||
bool DeviceTesting_OnIgnitionWithoutGsm(tDeviceTesting *env) {
|
||||
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM, 0);
|
||||
return DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||
}
|
||||
|
||||
//возвращает true в случае ошибки
|
||||
bool DeviceTesting_OnIgnitionAfterGsm(tDeviceTesting *env) {
|
||||
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_IGNITION_AFTER_GSM, 0);
|
||||
return DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||
}
|
||||
|
||||
//возвращает true в случае ошибки
|
||||
bool DeviceTesting_Always(tDeviceTesting *env) {
|
||||
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_ALWAYS, 100);
|
||||
|
||||
if ((DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR)) ||
|
||||
(DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_NOT_CONNECTED)) ||
|
||||
(DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_SHORT_CIRCUIT))
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//возвращает true в случае ошибки
|
||||
bool DeviceTesting_Main(tDeviceTesting *env) {
|
||||
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_MAIN, 0);
|
||||
return DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
//возвращает true в случае ошибки
|
||||
bool DeviceTesting_Periodical(tDeviceTesting *env) {
|
||||
if (!env->testsTable.currentProcessIterationsLeft) {
|
||||
return false;
|
||||
}
|
||||
--env->testsTable.currentProcessIterationsLeft;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Режим самотестирования")
|
||||
SystemDelayMs(5000);
|
||||
DeviceTestsTable_TestInMode(&env->testsTable, DEVICE_TESTING_MODE_PERIODICAL, 1000);
|
||||
bool errors = DeviceTestsTable_AnyTestHasCode(&env->testsTable, DEVICE_TESTING_CODE_ERROR);
|
||||
|
||||
if (errors) {
|
||||
for (uint16_t testIdx = 0; testIdx < env->testsTable.count; ++testIdx) {
|
||||
tTestDescriptor *test = env->testsTable.items + testIdx;
|
||||
|
||||
if (test->result == DEVICE_TESTING_CODE_ERROR) {
|
||||
LoggerCnErrorStatic(LOGGER, LOG_SIGN, "Тест ")
|
||||
LoggerCnError(LOGGER, LOG_SIGN, test->name.str, test->name.length)
|
||||
LoggerErrorStatic(LOGGER, LOG_SIGN, " не пройден")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Все тесты пройдены")
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
bool DeviceTesting_UserTests(tDeviceTesting *env) {
|
||||
DeviceTesting_ChekExit(env);
|
||||
EraGlonassMsd_ClearDiagnostic(&env->tmsdDiagRes);
|
||||
//задаем режим и обновляем индикторы
|
||||
UserIndication_SetMode(env->indication, DEVICE_MODE_TESTING);
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.uimFailure, DeviceTesting_Buttons(env));
|
||||
DeviceTesting_ChekExit(env);
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.speakersFailure, DeviceTesting_TestAudioSpeaker(env));
|
||||
DeviceTesting_ChekExit(env);
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.ignitionLineFailure, DeviceTesting_Ignition(env));
|
||||
DeviceTesting_ChekExit(env);
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.micFailure, DeviceTesting_TestMic(env));
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
//выключаем индикацию
|
||||
UserIndication_StopThread(env->indication);
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.statusIndicatorFailure, DeviceTesting_Indication(env));
|
||||
DeviceTesting_ChekExit(env);
|
||||
//включаем индикацию
|
||||
UserIndication_StartThread(env->indication);
|
||||
return DeviceTesting_UserGetResult(env);
|
||||
}
|
||||
|
||||
void DeviceTesting_GetSystemTest(tDeviceTesting *env) {
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
if (DeviceTestsTable_MakeTest(env->namedTests.firmware) == DEVICE_TESTING_CODE_PASSED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматическое тестирование целостности ПО, вызванн ое пользователем прошло успешно")
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.firmwareImageCorruption, false);
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("po_ok")
|
||||
}
|
||||
|
||||
if (!env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = true;
|
||||
}
|
||||
} else {
|
||||
if (!env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = false;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
if (DeviceTestsTable_MakeTest(env->namedTests.gsm) != DEVICE_TESTING_CODE_PASSED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка модема при автоматическом тестировании пользователем")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("modem_error.mp3.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.commModuleFailure, true);
|
||||
if (env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = false;
|
||||
}
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование модема, вызванное пользователем прошло успешно")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("modem_ok.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.commModuleFailure, false);
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
if (DeviceTestsTable_MakeTest(env->namedTests.accel) == DEVICE_TESTING_CODE_PASSED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматическое тестирование акселеромерта, вызванное пользователем прошло успешно")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("acsel_ok.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.crashSensorFailure, false);
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка акселеромерта при автоматическом тестировании пользователем")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("acsel_error.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.crashSensorFailure, true);
|
||||
if (env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = false;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
if (DeviceTestsTable_MakeTest(env->namedTests.batteryCharge) != DEVICE_TESTING_CODE_ERROR) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Автоматическое тестирование АКБ, вызванное пользователем прошло успешно")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("akb_ok.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.batteryFailure, false);
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка АКБ при автоматическом тестировании пользователем")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("akb_error.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.batteryFailure, true);
|
||||
if (env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
(DeviceTestsTable_MakeTest(env->namedTests.gnssAnt) == DEVICE_TESTING_CODE_CONNECTED) ||
|
||||
(DeviceTestsTable_MakeTest(env->namedTests.gnssAnt) == DEVICE_TESTING_CODE_INPUT_ANTENA_OK)
|
||||
) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматическое тестирование антенны, вызванное пользователем прошло успешно")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("ant_ok.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.gnssAntennaFailure, false);
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка антенны при автоматическом тестировании пользователем")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("ant_error.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.gnssAntennaFailure, true);
|
||||
if (env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = false;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
env->powerManagement->powerSusystem->SpekTestPower.speakTestAcsess = true;
|
||||
if (DeviceTestsTable_MakeTest(env->namedTests.audioCodec) == DEVICE_TESTING_CODE_PASSED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматическое тестирование аудио тракта, вызванное пользователем прошло успешно")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("audioSub_ok.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.speakersFailure, false);
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка аудио тракта при автоматическом тестировании пользователем")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("audioSub_error.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.speakersFailure, true);
|
||||
if (env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = false;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
if (DeviceTestsTable_MakeTest(env->namedTests.bipConnect) == DEVICE_TESTING_CODE_CONNECTED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN,
|
||||
"Автоматическое тестирование подключения блока интерфейса пользователя выполнено успешно")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("bip_is_connect.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.uimFailure, false);
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка подключения блока интерфейса пользователя выполнено успешно")
|
||||
if (env->audioHintsMode == HINTS_FULL) {
|
||||
DEVTST_PLAY_SAMPLE("bip_is_not_connect.mp3")
|
||||
}
|
||||
|
||||
EraGlonassMsd_OptionalFlagSet(env->tmsdDiagRes.uimFailure, true);
|
||||
if (env->flagAutoTestSucsess) {
|
||||
env->flagAutoTestSucsess = false;
|
||||
}
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
if (env->audioHintsMode == HINTS_NORMAL) {
|
||||
DEVTST_PLAY_SAMPLE("dataStateDevIsCollections.mp3")
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceTesting_MainTestingStopMode(tDeviceTesting *env) {
|
||||
env->flagAcsessExitThread = SYSTEM_IS_DONE;
|
||||
uint32_t timer = SystemGetMs() + 20000;
|
||||
while (1) {
|
||||
if (timer < SystemGetMs()) {
|
||||
// return;
|
||||
}
|
||||
SystemDelayMs(5000);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceTesting_RunInternalTests(tDeviceTesting *env) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Выполняются внутренние тесты")
|
||||
DeviceTesting_GetSystemTest(env);
|
||||
}
|
||||
|
||||
void DeviceTesting_AudioReportAsInternalTests(tDeviceTesting *env, bool userTestsOk) {
|
||||
#if (AURUS_CAR_UI == 1)
|
||||
if (env->flagAutoTestSucsess) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Внутренние тесты завершены успешно")
|
||||
DEVTST_PLAY_SAMPLE("notError.mp3")
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка внутреннего теста")
|
||||
DEVTST_PLAY_SAMPLE("isError.mp3")
|
||||
}
|
||||
|
||||
#endif
|
||||
#if (AURUS_CAR_UI == 0)
|
||||
if (env->flagAutoTestSucsess) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Внутренние тесты завершены успешно")
|
||||
}
|
||||
DeviceTesting_ChekExit(env);
|
||||
if (userTestsOk && !env->flagAutoTestSucsess) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка внутреннего теста")
|
||||
DEVTST_PLAY_SAMPLE("test_full_error.mp3")
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
bool DeviceTesting_RunTestCall(tDeviceTesting *env) {
|
||||
|
||||
bool result = false;
|
||||
UserInputButtonWatcher_Clear(env->UserInputButtonWatcher);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Начало тестирования вызова с передачей данных с результатами проверки")
|
||||
|
||||
#if (AURUS_CAR_UI == 1)
|
||||
DEVTST_PLAY_SAMPLE("testCoolUp.mp3")
|
||||
#endif
|
||||
#if (AURUS_CAR_UI == 0)
|
||||
DEVTST_PLAY_SAMPLE("ecall_test.mp3")
|
||||
#endif
|
||||
|
||||
env->flagAcsessExitThread = SYSTEM_IS_BUSY;
|
||||
result = DeviceTesting_Ecall(env);
|
||||
env->flagAcsessExitThread = SYSTEM_IS_FREE;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тестовый вызов пройден")
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
|
||||
#if (AURUS_CAR_UI == 0)
|
||||
DeviceTesting_GetEcalRes(env);
|
||||
#endif
|
||||
|
||||
|
||||
if (env->ecallAddStatusRes == 1) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Выполняются вызов оператору 112")
|
||||
env->ErGlUv->currentMsd->msd.MSD_Data.msgId = 1;
|
||||
env->flagAcsessExitThread = SYSTEM_IS_BUSY;
|
||||
if (EraGlonassUveos_ManualEmergencyCall(env->ErGlUv) == ERA_GLONASS_UVEOS_CALL_SUCCESS) {
|
||||
result = true;
|
||||
}
|
||||
env->flagAcsessExitThread = SYSTEM_IS_FREE;
|
||||
}
|
||||
|
||||
#if (AURUS_CAR_UI == 1)
|
||||
if(result == true){
|
||||
DEVTST_PLAY_SAMPLE("testCoolDoneTestingDone.mp3")
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void DeviceTesting_MainTestingModeExitIsTimeOut(tDeviceTesting *env) {
|
||||
if (
|
||||
env->ErGlUv->timings.lastTestCall &&
|
||||
(env->ErGlUv->timings.lastTestCall > SystemGetMs())
|
||||
) {
|
||||
env->queryUDSState->state = QUERY_ERROR;
|
||||
DEVTST_PLAY_SAMPLE("tets_call_timeuot.mp3");
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceTesting_GetNetworkReg(tGsmWithGnss *env) {
|
||||
if (!GsmWithGnss_WaitNetworkRegistration(env, 1500)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Сеть или сим-чип отсутствует, попытка регистрации код 6");
|
||||
if (GsmWithGnss_NetworkSetStateInnaterups(env, 4, 20000) == AT_OK) {
|
||||
return true;
|
||||
LoggerTraceStatic(LOGGER, LOG_SIGN, "Сеть присутствует")
|
||||
} else {
|
||||
LoggerErrorStatic(LOGGER, LOG_SIGN, "нет сети");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
LoggerErrorStatic(LOGGER, LOG_SIGN, "Регистрация в сети присутствует");
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestingECool(tDeviceTesting *env) {
|
||||
UserIndication_SetMode(env->indication, DEVICE_MODE_TESTING);
|
||||
DeviceTesting_RunInternalTests(env);
|
||||
DeviceTesting_ChekExit(env);
|
||||
DeviceTesting_AudioReportAsInternalTests(env, true);
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
bool res = DeviceTesting_RunTestCall(env);
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Голосовой отчёт по тестовому вызову выполнен")
|
||||
return res;
|
||||
}
|
||||
|
||||
void DeviceTesting_MainTestingMode(tDeviceTesting *env) {
|
||||
// UserIndication_Uiu(env->indication, UIU_OFF);
|
||||
|
||||
UserButtons_Clear(env->input);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Начало пользовательского тестирования")
|
||||
|
||||
|
||||
if (env->queryUDSState->source == REG_TO_NETWORK) {
|
||||
UserIndication_SetMode(env->indication, DEVICE_MODE_TESTING);
|
||||
// AtGsm_OperatorSelectionDeregister(&env->gsmWithGnss->gsmAt);
|
||||
// SystemDelayMs(500);
|
||||
// AtGsm_OperatorSelectionAutomatic(&env->gsmWithGnss->gsmAt);
|
||||
// bool regRes = false;
|
||||
// uint32_t tmt = SystemGetMs()+180000;
|
||||
// while ( (regRes == false) || (tmt > SystemGetMs()) ) {
|
||||
// regRes = true;//GsmWithGnss_WaitNetworkRegistration(env->gsmWithGnss, 1500);
|
||||
// SystemDelayMs(1000);
|
||||
// }
|
||||
|
||||
bool regRes = true;
|
||||
if (regRes) {
|
||||
env->queryUDSState->state = QUERY_DONE;
|
||||
} else {
|
||||
env->queryUDSState->state = QUERY_ERROR;
|
||||
}
|
||||
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
return;
|
||||
}
|
||||
|
||||
if (env->queryUDSState->source == REG_BOARD_VOLTAGE_CALIBRATION) {
|
||||
UserIndication_SetMode(env->indication, DEVICE_MODE_TESTING);
|
||||
bool calibRes = Adcs_SetCalibBoardVoltage(
|
||||
env->powerManagement->powerSusystem->boardPower.boardVoltage,
|
||||
env->boardVoltCalbCof
|
||||
);
|
||||
|
||||
if (calibRes) {
|
||||
EraGlonassUveosDumper_ForceDump(env->ErGlUv->dumper);
|
||||
env->queryUDSState->state = QUERY_DONE;
|
||||
} else {
|
||||
env->queryUDSState->state = QUERY_ERROR;
|
||||
}
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
return;
|
||||
}
|
||||
|
||||
if (env->queryUDSState->source == LEDS_TEST) {
|
||||
eAudioHintsMode audioHintsModeTmp = env->audioHintsMode;
|
||||
env->audioHintsMode = HINTS_MINIMAL;
|
||||
|
||||
UserIndication_StopThread(env->indication);
|
||||
env->fl_oneTestResult = DeviceTesting_Indication(env);
|
||||
UserIndication_StartThread(env->indication);
|
||||
|
||||
if (env->fl_oneTestResult == false) {
|
||||
env->queryUDSState->state = QUERY_DONE;
|
||||
} else {
|
||||
env->queryUDSState->state = QUERY_ERROR;
|
||||
}
|
||||
|
||||
env->audioHintsMode = audioHintsModeTmp;
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (env->queryUDSState->source == SPEAK_MICR_TEST) {
|
||||
DEVTST_PLAY_SAMPLE("test_dinam_one.mp3")
|
||||
//задаем режим и обновляем индикторы
|
||||
UserIndication_SetMode(env->indication, DEVICE_MODE_TESTING);
|
||||
env->fl_oneTestResult = DeviceTesting_TestMic(env);
|
||||
|
||||
if (env->fl_oneTestResult == false) {
|
||||
env->queryUDSState->state = QUERY_DONE;
|
||||
} else {
|
||||
env->queryUDSState->state = QUERY_ERROR;
|
||||
}
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (env->queryUDSState->source == ECALL_TEST) {
|
||||
|
||||
DeviceTesting_MainTestingModeExitIsTimeOut(env);
|
||||
env->audioHintsMode = HINTS_NORMAL;
|
||||
|
||||
bool res = DeviceTesting_TestingECool(env);
|
||||
env->audioHintsMode = HINTS_FULL;
|
||||
if (res == true) {
|
||||
env->queryUDSState->state = QUERY_DONE;
|
||||
} else {
|
||||
env->queryUDSState->state = QUERY_ERROR;
|
||||
}
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
return;
|
||||
}
|
||||
|
||||
if (env->queryUDSState->source == ECALL_NOT_REG_TEST) {
|
||||
DeviceTesting_MainTestingModeExitIsTimeOut(env);
|
||||
env->audioHintsMode = HINTS_NORMAL;
|
||||
UserIndication_SetMode(env->indication, DEVICE_MODE_TESTING);
|
||||
DeviceTesting_RunInternalTests(env);
|
||||
DeviceTesting_ChekExit(env);
|
||||
DeviceTesting_AudioReportAsInternalTests(env, true);
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
DEVTST_PLAY_SAMPLE("not_reg_to_net.mp3")
|
||||
bool res = DeviceTesting_RunTestCall(env);
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Голосовой отчёт по тестовому вызову выполнен")
|
||||
env->audioHintsMode = HINTS_FULL;
|
||||
if (res == true) {
|
||||
env->queryUDSState->state = QUERY_DONE;
|
||||
} else {
|
||||
env->queryUDSState->state = QUERY_ERROR;
|
||||
}
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
return;
|
||||
}
|
||||
|
||||
if (env->queryUDSState->source == FULL_TESTS) {
|
||||
bool userTestsOk = DeviceTesting_UserTests(env);
|
||||
DeviceTesting_RunInternalTests(env);
|
||||
DeviceTesting_ChekExit(env);
|
||||
DeviceTesting_AudioReportAsInternalTests(env, userTestsOk);
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
if (userTestsOk && env->flagAutoTestSucsess) {
|
||||
if (!DeviceTesting_Main(env)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Все тесты пройдены успешно")
|
||||
DEVTST_PLAY_SAMPLE("test_full_ok.mp3")
|
||||
}
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
DeviceTesting_RunTestCall(env);
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Голосовой отчёт по тестовому вызову выполнен")
|
||||
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
}
|
||||
|
||||
if (env->queryUDSState->source == INTERNAL_ONE_TEST) {
|
||||
|
||||
eAudioHintsMode audioHintsMode = env->audioHintsMode;
|
||||
env->audioHintsMode = HINTS_NONE;
|
||||
DeviceTesting_RunInternalTests(env);
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
DeviceTesting_AudioReportAsInternalTests(env, NULL);
|
||||
DeviceTesting_ChekExit(env);
|
||||
|
||||
env->fl_oneTestResult = DeviceTesting_TestSpeakMic(env);
|
||||
|
||||
if ((env->flagAutoTestSucsess)&&(!env->fl_oneTestResult)) {
|
||||
if (!DeviceTesting_Main(env)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Все тесты пройдены успешно")
|
||||
}
|
||||
}
|
||||
|
||||
if(env->gsmWithGnss->gnss.currentRmc.status != 'A') {
|
||||
DEVTST_PLAY_SAMPLE("satelitNone.mp3")
|
||||
}
|
||||
|
||||
DeviceTesting_RunTestCall(env);
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Голосовой отчёт по тестовому вызову выполнен")
|
||||
|
||||
env->audioHintsMode = audioHintsMode;
|
||||
DeviceTesting_MainTestingStopMode(env);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
//
|
||||
// Created by xemon on 18.11.22.
|
||||
//
|
||||
|
||||
#include "DeviceTesting_Env.h"
|
||||
#include "DeviceTesting_TestingMethods.h"
|
||||
#include "SpiPortIO.h"
|
||||
#include "Accel.h"
|
||||
#include "SpiPortArtery.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
#define DEVICE_TESTING_ADD_TEST(NAME, TEST_ENV, TEST_METHOD, MODES) \
|
||||
DeviceTestsTableAdd( \
|
||||
&env->testsTable, \
|
||||
DEVICE_TEST_NAME(NAME), \
|
||||
TEST_ENV, \
|
||||
(TestMethod) (TEST_METHOD), \
|
||||
MODES \
|
||||
) \
|
||||
|
||||
|
||||
uint16_t *getResultFix(tDeviceTestsTable *testsTable, char *testName, uint8_t testNameLength) {
|
||||
|
||||
uint16_t *testResultFix = NULL;
|
||||
|
||||
for (uint16_t i = 0; i < testsTable->count; ++i) {
|
||||
if ((memcmp(testsTable->items[i].name.str, testName, testNameLength) == 0) &&
|
||||
(testNameLength == testsTable->items[i].name.length)) {
|
||||
testResultFix = &testsTable->items[i].resultFix;
|
||||
return testResultFix;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return testResultFix;
|
||||
}
|
||||
|
||||
|
||||
bool DeviceTests_InitTestsTable(
|
||||
tDeviceTesting *env,
|
||||
tGpioPin *ignitionPin,
|
||||
tSpekTestPower *spekTestPower,
|
||||
tBipPins *bipTestDiagnost,
|
||||
tBatteryPower *batteryPower,
|
||||
tAtCmd *gsm,
|
||||
tAudioCodec *audioCodec,
|
||||
tAccel *accel,
|
||||
tAntTest *antCheck,
|
||||
tDeviceStorage *deviceStorage,
|
||||
tModemVersionRevisionTest *modemVersionRevisionTest,
|
||||
tAmplifier *amplifier,
|
||||
tCanTest *canTest
|
||||
) {
|
||||
|
||||
DeviceTestsTableInitStatic(
|
||||
&env->testsTable,
|
||||
env->testsTableAlloc
|
||||
);
|
||||
|
||||
env->namedTests.can = DEVICE_TESTING_ADD_TEST(
|
||||
"CAN",
|
||||
canTest,
|
||||
DeviceTesting_CanTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.firmware = DEVICE_TESTING_ADD_TEST(
|
||||
"FIRMWARE", NULL, DeviceTesting_JustOk,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.ignition = DEVICE_TESTING_ADD_TEST(
|
||||
"IGNITION",
|
||||
ignitionPin,
|
||||
DeviceTesting_IgnitionTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.batteryConn = DEVICE_TESTING_ADD_TEST(
|
||||
"BAT_CONNECT",
|
||||
batteryPower,
|
||||
DeviceTesting_AdcBatteryConnectionTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.batteryCharge = DEVICE_TESTING_ADD_TEST(
|
||||
"BAT_CHARGE",
|
||||
batteryPower,
|
||||
DeviceTesting_AdcBatteryChargeTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.batteryCharge = DEVICE_TESTING_ADD_TEST(
|
||||
"BAT_VOLTAGE",
|
||||
batteryPower,
|
||||
DeviceTesting_AdcBatteryVoltageTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
if (*antCheck->mode == false) {
|
||||
env->namedTests.gnssAnt = DEVICE_TESTING_ADD_TEST(
|
||||
"GNSS_ANT",
|
||||
antCheck,
|
||||
DeviceTesting_AntTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
} else {
|
||||
env->namedTests.gnssAnt = DEVICE_TESTING_ADD_TEST(
|
||||
"GNSS_ANT",
|
||||
antCheck,
|
||||
DeviceTesting_AntTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
}
|
||||
|
||||
env->namedTests.speakConnect = DEVICE_TESTING_ADD_TEST(
|
||||
"SPEAKER_CONNECT",
|
||||
spekTestPower,
|
||||
DeviceTesting_AdcSpeakerTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.bipConnect = DEVICE_TESTING_ADD_TEST(
|
||||
"BIP_CONNECT",
|
||||
bipTestDiagnost,
|
||||
DeviceTesting_BipConnectTest,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.accel = DEVICE_TESTING_ADD_TEST(
|
||||
"ACCEL",
|
||||
accel,
|
||||
DeviceTesting_TestAccel,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.gsm = DEVICE_TESTING_ADD_TEST(
|
||||
"GSM",
|
||||
modemVersionRevisionTest,
|
||||
DeviceTesting_TestAt,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.audioCodec = DEVICE_TESTING_ADD_TEST(
|
||||
"AUDIO_CODEC", audioCodec,
|
||||
DeviceTesting_TestAudioCodec,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.vin = DEVICE_TESTING_ADD_TEST(
|
||||
"VIN",
|
||||
deviceStorage,
|
||||
DeviceTesting_VIN,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.accel_calib = DEVICE_TESTING_ADD_TEST(
|
||||
"ACCEL_CALIB",
|
||||
deviceStorage,
|
||||
DeviceTesting_CALIB_ACCEL,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.eol = DEVICE_TESTING_ADD_TEST(
|
||||
"EOL",
|
||||
&env->testsTable,
|
||||
DeviceTesting_EOL,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.tele = DEVICE_TESTING_ADD_TEST(
|
||||
"TELE",
|
||||
modemVersionRevisionTest,
|
||||
DeviceTesting_Telematica,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.modemSoftRevision = DEVICE_TESTING_ADD_TEST(
|
||||
"MODEM_SOFT_REV",
|
||||
modemVersionRevisionTest,
|
||||
DeviceTesting_ModemSoftwareValidation,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.modemSertRevision = DEVICE_TESTING_ADD_TEST(
|
||||
"MODEM_CERT_REV",
|
||||
modemVersionRevisionTest,
|
||||
DeviceTesting_ModemCertValidation,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.modemAudiotRevision = DEVICE_TESTING_ADD_TEST(
|
||||
"MODEM_AUDIO_FILE",
|
||||
modemVersionRevisionTest,
|
||||
DeviceTesting_ModemAudioFileValidation,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.modemAmplifare = DEVICE_TESTING_ADD_TEST(
|
||||
"AMPLIFIER",
|
||||
amplifier,
|
||||
DeviceTesting_Aamplifier,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM |
|
||||
DEVICE_TESTING_MODE_IGNITION_AFTER_GSM
|
||||
);
|
||||
|
||||
env->namedTests.modemSimEra = DEVICE_TESTING_ADD_TEST(
|
||||
"SIM_ERA",
|
||||
modemVersionRevisionTest,
|
||||
DeviceTesting_SimEra,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||
);
|
||||
|
||||
env->namedTests.modemSimComers = DEVICE_TESTING_ADD_TEST(
|
||||
"SIM_COMERS",
|
||||
modemVersionRevisionTest,
|
||||
DeviceTesting_SimComers,
|
||||
DEVICE_TESTING_MODE_ALWAYS |
|
||||
DEVICE_TESTING_MODE_PERIODICAL |
|
||||
DEVICE_TESTING_MODE_IGNITION_WITHOUT_GSM
|
||||
);
|
||||
|
||||
// modemVersionRevisionTest->modemDataCollector->modemVersionRevision.deviceTestFix_ModemCertValidation = getResultFix(&env->testsTable, "MODEM_CERT_REV",
|
||||
//// sizeof("MODEM_CERT_REV") - 1);
|
||||
//
|
||||
// modemVersionRevisionTest->modemDataCollector->modemVersionRevision.deviceTestFix_ModemAudioFileValidation = getResultFix(&env->testsTable, "MODEM_AUDIO_FILE",
|
||||
// sizeof("MODEM_AUDIO_FILE") - 1);
|
||||
//
|
||||
// modemVersionRevisionTest->modemDataCollector->modemVersionRevision.deviceTestFix_ModemValidation = getResultFix(&env->testsTable, "GSM",
|
||||
// sizeof("GSM") - 1);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,372 @@
|
|||
//
|
||||
// Created by xemon on 18.11.22.
|
||||
//
|
||||
|
||||
|
||||
#include "DeviceTesting_TestingMethods.h"
|
||||
#include "SystemDelayInterface.h"
|
||||
#include "string.h"
|
||||
#include "ext_telematica.h"
|
||||
#include "AtGsmSimComA7600_SSL_LOAD_CA.h"
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AntTest(tAntTest *antTest) {
|
||||
if (*antTest->mode == false) {
|
||||
static uint8_t tries = 10;
|
||||
|
||||
uint64_t antVoltage = 0;
|
||||
for (uint8_t try = 0; try < tries; try++) {
|
||||
uint16_t single = AdcGet(antTest->externalAdc, 1000);
|
||||
antVoltage += single;
|
||||
}
|
||||
antVoltage /= tries;
|
||||
|
||||
if (antVoltage < 50) {
|
||||
return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
if ((antVoltage > 4080) && (antVoltage < 4090)) {
|
||||
return DEVICE_TESTING_CODE_CONNECTED;
|
||||
}
|
||||
|
||||
if ((antVoltage > 4000) && (antVoltage < 4075)) {
|
||||
return DEVICE_TESTING_CODE_SHORT_CIRCUIT;
|
||||
}
|
||||
|
||||
return DEVICE_TESTING_CODE_CONNECTED;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_INPUT_ANTENA_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_ModemCertValidation(tModemVersionRevisionTest *env) {
|
||||
if((*env->telematicaIsActive == true) || ( (*env->testTelematicaIsActive == true)||(*env->fl_telematicaServerIsActive == true)) ) {
|
||||
if (env->modemDataCollector->fl_IsLoad == true) {
|
||||
if (env->modemDataCollector->modemVersionRevision.sertRevision.validSert == MOD_READY) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
if (env->modemDataCollector->modemVersionRevision.sertRevision.validSert == MOD_UNDEFANDED) {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
if (env->modemDataCollector->modemVersionRevision.sertRevision.validSert == MOD_ERROR) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_NOT_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_ModemAudioFileValidation(tModemVersionRevisionTest *env) {
|
||||
if (env->modemDataCollector->fl_IsLoad == true) {
|
||||
if (env->modemDataCollector->modemVersionRevision.validAudio == MOD_READY) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
if (env->modemDataCollector->modemVersionRevision.validAudio == MOD_UNDEFANDED) {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
if (env->modemDataCollector->modemVersionRevision.validAudio == MOD_ERROR) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_ModemSoftwareValidation(tModemVersionRevisionTest *env) {
|
||||
// if((*env->telematicaIsActive == true) || ( (*env->testTelematicaIsActive == true)||(*env->fl_telematicaServerIsActive == true)) ) {
|
||||
if (env->modemDataCollector->fl_IsLoad == true) {
|
||||
tVariableDescriptor *var = VariablesTable_GetByNameStatic(&env->deviceStorage->publicVariablesTable,
|
||||
"GSM_CGMR");
|
||||
if (var->len) {
|
||||
tStringLink cgmrOldValue = {
|
||||
.length = var->len,
|
||||
.data = var->addr
|
||||
};
|
||||
tStringLink cgmr = {
|
||||
.length = &env->modemDataCollector->modemVersionRevision.softValue.length,
|
||||
.data = env->modemDataCollector->modemVersionRevision.softValue.data
|
||||
};
|
||||
if (
|
||||
(memcmp(cgmr.data, cgmrOldValue.data, *cgmrOldValue.length) == 0) &&
|
||||
(*cgmr.length == *cgmrOldValue.length)
|
||||
) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
return DEVICE_TESTING_CODE_NOT_ACTIVE;
|
||||
// } else {
|
||||
// return DEVICE_TESTING_CODE_NOT_ACTIVE;
|
||||
// }
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_Aamplifier(tAmplifier *amplifier) {
|
||||
if (amplifier->isTest == 2) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
} else if (amplifier->isTest == 1) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_BipConnectTest(tBipPins *env) {
|
||||
bool res = GpioPinGet(&env->Diagnost);
|
||||
if (res) {
|
||||
return DEVICE_TESTING_CODE_CONNECTED;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||
}
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcSpeakerTest(tSpekTestPower *env) {
|
||||
eDeviceTestingCode result = DEVICE_TESTING_CODE_CONNECTED;
|
||||
if (env->lastTestTime < SystemGetMs()) {
|
||||
if (env->speakTestAcsess == true) {
|
||||
GpioPinSet(&env->PowerCheckSpkOn, true);
|
||||
SystemDelayMs(40);
|
||||
bool res = GpioPinGet(&env->PowerTestSpkIn);
|
||||
GpioPinSet(&env->PowerCheckSpkOn, false);
|
||||
SystemDelayMs(40);
|
||||
if (res) {
|
||||
return DEVICE_TESTING_CODE_CONNECTED;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_NOT_CONNECTED;
|
||||
}
|
||||
}
|
||||
env->lastTestTime = SystemGetMs() + 5000;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcBatteryConnectionTest(tBatteryPower *batteryPower) {
|
||||
if (batteryPower->currentBatVoltage < 1500) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_CONNECTED;
|
||||
}
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcBatteryChargeTest(tBatteryPower *batteryPower) {
|
||||
if (batteryPower->currentBatVoltage < 2500) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
} else if ((batteryPower->currentBatVoltage >= 2500) && (batteryPower->currentBatVoltage < 3000)) {
|
||||
return DEVICE_TESTING_CODE_BATTERY_PRE_CHARGE;
|
||||
} else if ((batteryPower->currentBatVoltage >= 3000) && (batteryPower->currentBatVoltage < 4000)) {
|
||||
return DEVICE_TESTING_CODE_BATTERY_FAST_CHARGE;
|
||||
} else if ((batteryPower->currentBatVoltage >= 4000) && (batteryPower->currentBatVoltage < 4450)) {
|
||||
return DEVICE_TESTING_CODE_BATTERY_CHARGE_DONE;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_AdcBatteryVoltageTest(tBatteryPower *batteryPower) {
|
||||
if(batteryPower->currentBatVoltage > 2500) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_CanTest(const tCanTest *env) {
|
||||
if (env->deviceStorage->nvm->device.factoryMode) {
|
||||
return *env->deviceTestingCodeCan;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_NOT_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_IgnitionTest(tGpioPin *gpioPin) {
|
||||
return GpioPinGet(gpioPin) ? DEVICE_TESTING_CODE_CONNECTED : DEVICE_TESTING_CODE_NOT_CONNECTED_OK;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_TestAt(tModemVersionRevisionTest *env) {
|
||||
if (env->modemDataCollector->fl_IsLoad == true) {
|
||||
if (env->modemDataCollector->modemVersionRevision.modemStateIsValid == false) {
|
||||
|
||||
// if (env->modemDataCollector->modemVersionRevision.deviceTestFix_ModemValidation != NULL) {
|
||||
// if ((*env->modemDataCollector->modemVersionRevision.deviceTestFix_ModemValidation !=
|
||||
// DEVICE_TESTING_CODE_NOT_TESTED) &&
|
||||
// (*env->modemDataCollector->modemVersionRevision.deviceTestFix_ModemValidation !=
|
||||
// DEVICE_TESTING_CODE_IN_PROCESS))
|
||||
// return DEVICE_TESTING_CODE_ERROR;
|
||||
// }
|
||||
|
||||
AtCommandResult resGetCgmr = AT_ERROR;
|
||||
if (osMutexAcquire(env->modemDataCollector->gsmAt->access, 500) == osOK) {
|
||||
resGetCgmr = AtCmdWaitOk(&env->gsmWithGnss->gsmAt, 500, 5000);
|
||||
osMutexRelease(env->modemDataCollector->gsmAt->access);
|
||||
if (resGetCgmr == AT_OK) {
|
||||
env->modemDataCollector->modemVersionRevision.modemStateIsValid = true;
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
}
|
||||
|
||||
if(env->modemDataCollector->timeIsTestModemLimit < SystemGetMs()){
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_TestAudioCodec(tAudioCodec *audioCodec) {
|
||||
// return AudioCodecTestStatus(audioCodec) ? DEVICE_TESTING_CODE_PASSED : DEVICE_TESTING_CODE_ERROR;
|
||||
if(audioCodec->state == true){
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_TestAccel(tAccel *accel) {
|
||||
if ((accel->accel.xyz.x == 0) &&
|
||||
(accel->accel.xyz.y == 0) &&
|
||||
(accel->accel.xyz.z == 0)) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
|
||||
if ((accel->accel.xyz.x == -1950) &&
|
||||
(accel->accel.xyz.y == -1950) &&
|
||||
(accel->accel.xyz.z == -1950)) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
|
||||
// float len = vector3Len(accel->current);
|
||||
// if ((len < 0.89) || (len > 1.1)) {
|
||||
// return DEVICE_TESTING_CODE_ERROR;
|
||||
// }
|
||||
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_JustOk(void *nil) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_SimEra(tModemVersionRevisionTest *env) {
|
||||
if (env->modemDataCollector->fl_IsLoad == true) {
|
||||
if (
|
||||
(env->modemDataCollector->modemVersionRevision.ssidValue.length > 18) &&
|
||||
(env->modemDataCollector->modemVersionRevision.ssidValue.length <= 20)
|
||||
) {
|
||||
if (env->modemDataCollector->modemVersionRevision.valid_CCID == MOD_READY) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
} else {
|
||||
if (env->modemDataCollector->modemVersionRevision.valid_CCID == MOD_ERROR) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
if (env->modemDataCollector->modemVersionRevision.valid_CCID == MOD_UNDEFANDED) {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
}
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_SimComers(tModemVersionRevisionTest *env){
|
||||
if((*env->telematicaIsActive == true) || ( (*env->testTelematicaIsActive == true)||(*env->fl_telematicaServerIsActive == true)) ) {
|
||||
if (env->modemDataCollector->fl_IsLoad == true) {
|
||||
if (
|
||||
(env->modemDataCollector->modemVersionRevision.ssidComersValue.length > 18) &&
|
||||
(env->modemDataCollector->modemVersionRevision.ssidComersValue.length <= 20)
|
||||
) {
|
||||
if (env->modemDataCollector->modemVersionRevision.valid_CCIDComer == MOD_READY) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
} else {
|
||||
if (env->modemDataCollector->modemVersionRevision.valid_CCIDComer == MOD_ERROR) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
if (env->modemDataCollector->modemVersionRevision.valid_CCIDComer == MOD_UNDEFANDED) {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
}
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_NOT_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_VIN(tDeviceStorage *deviceStorage) {
|
||||
|
||||
if (osMutexAcquire(deviceStorage->dumpObserver.access, 100) == osOK) {
|
||||
if ((deviceStorage->nvm->gost.VIN.length <= 1) ||
|
||||
(memcmp(&deviceStorage->nvm->gost.VIN.data, "00000000000000000", sizeof("00000000000000000") - 1) == 0)) {
|
||||
osMutexRelease(deviceStorage->dumpObserver.access);
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
osMutexRelease(deviceStorage->dumpObserver.access);
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_CALIB_ACCEL(tDeviceStorage *deviceStorage) {
|
||||
// return DEVICE_TESTING_CODE_PASSED;
|
||||
|
||||
if (osMutexAcquire(deviceStorage->dumpObserver.access, 100) == osOK) {
|
||||
|
||||
if ((deviceStorage->nvm->device.AccelCalibrationX == -32768) ||
|
||||
(deviceStorage->nvm->device.AccelCalibrationY == -32768) ||
|
||||
(deviceStorage->nvm->device.AccelCalibrationZ == -32768) ||
|
||||
(deviceStorage->nvm->device.RolloverAngle == 255) ||
|
||||
(deviceStorage->nvm->device.RolloverTime == 255) ||
|
||||
(deviceStorage->nvm->device.DirectionAngle == 255)) {
|
||||
|
||||
osMutexRelease(deviceStorage->dumpObserver.access);
|
||||
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
|
||||
osMutexRelease(deviceStorage->dumpObserver.access);
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_IN_PROCESS;
|
||||
}
|
||||
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_EOL(tDeviceTestsTable *env) {
|
||||
for (uint16_t i = 0; i < env->count; ++i) {
|
||||
if ((env->items[i].result == DEVICE_TESTING_CODE_ERROR) ||
|
||||
(env->items[i].result == DEVICE_TESTING_CODE_NOT_CONNECTED) ||
|
||||
(env->items[i].result == DEVICE_TESTING_CODE_SHORT_CIRCUIT)) {
|
||||
if ((memcmp(env->items[i].name.str, "ACCEL_CALIB", env->items[i].name.length) == 0) ||
|
||||
(memcmp(env->items[i].name.str, "VIN", env->items[i].name.length) == 0)) {
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
|
||||
eDeviceTestingCode DeviceTesting_Telematica(tModemVersionRevisionTest *env){
|
||||
if((*env->telematicaIsActive == true) || ( (*env->testTelematicaIsActive == true)||(*env->fl_telematicaServerIsActive == true)) ) {
|
||||
if (EXT_ENV_ADR_TELE.META_EXT_ENV_TELE) {
|
||||
return DEVICE_TESTING_CODE_PASSED;
|
||||
}
|
||||
return DEVICE_TESTING_CODE_ERROR;
|
||||
} else {
|
||||
return DEVICE_TESTING_CODE_NOT_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,578 @@
|
|||
////
|
||||
//// Created by xemon on 09.11.2021.
|
||||
////
|
||||
#include <SystemDelayInterface.h>
|
||||
#include "DeviceTesting.h"
|
||||
#include "UserInput.h"
|
||||
#include "EraGlonassMsd.h"
|
||||
#include "EraGlonassUveos.h"
|
||||
|
||||
#define LOGGER env->logger
|
||||
#define LOG_SIGN "Тест. Пользв."
|
||||
|
||||
uint16_t timeoutPresButton = 10000;
|
||||
|
||||
|
||||
void DeviceTesting_ErorEmergencyPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("emer_test_eror.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorEmergencyNumberNotSetPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("incorrect_test_number.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorEmergencyTempLocPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("tets_call_timeuot.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_EmergencySucsessPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("test_call_sucsess.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorAddButtonPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("buttom.mp3")
|
||||
DEVTST_PLAY_SAMPLE("add_functions.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorSosButtonPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("buttom.mp3")
|
||||
DEVTST_PLAY_SAMPLE("sos_call.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ButtonSuccessPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("bip_button_ok.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_IgnitionSucsessPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("ignition.mp3")
|
||||
DEVTST_PLAY_SAMPLE("successfully.mp3")
|
||||
DEVTST_PLAY_SAMPLE("done.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_IgnitionOffErrorPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("when_turned_off.mp3")
|
||||
DEVTST_PLAY_SAMPLE("ignition.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_IgnitionOnErrorPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("when_turned_on.mp3")
|
||||
DEVTST_PLAY_SAMPLE("ignition.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorGreenIndicationPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("green_ind.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorRedIndicationPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("red_ind.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_SucsessIndicationPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("indicators.mp3")
|
||||
DEVTST_PLAY_SAMPLE("successfully.mp3")
|
||||
DEVTST_PLAY_SAMPLE("done.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorMicPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("microphon.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_SucsessMicPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("microphon.mp3")
|
||||
DEVTST_PLAY_SAMPLE("successfully.mp3")
|
||||
DEVTST_PLAY_SAMPLE("done.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_ErorSpeakerPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("error_testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("dinamics.mp3")
|
||||
}
|
||||
|
||||
void DeviceTesting_SucsessSpeakerPlay(tDeviceTesting *env) {
|
||||
DEVTST_PLAY_SAMPLE("testing.mp3")
|
||||
DEVTST_PLAY_SAMPLE("dinamics.mp3")
|
||||
DEVTST_PLAY_SAMPLE("successfully.mp3")
|
||||
DEVTST_PLAY_SAMPLE("done.mp3")
|
||||
}
|
||||
|
||||
bool DeviceTesting_WaitTestResult(tTestDescriptor *test, uint16_t value, uint32_t timeout) {
|
||||
uint32_t end = SystemGetMs() + timeout;
|
||||
while (SystemGetMs() < end) {
|
||||
DeviceTestsTable_MakeTest(test);
|
||||
if (test->result == value) {
|
||||
return true;
|
||||
}
|
||||
SystemDelayMs(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeviceTesting_ExitTestPlay(tDeviceTesting *env) {
|
||||
#if (AURUS_CAR_UI == 0)
|
||||
AudioPlayer_PlayToWait(env->audioPlayer, "era_mode.mp3", 3 * 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DeviceTesting_WaitAddButtonClick(tDeviceTesting *env, char *audioFileName, uint8_t audioFileLenght, uint32_t timeout, uint8_t value) {
|
||||
if(value != UIU_OFF) {
|
||||
UserIndication_Uiu(env->indication, value);
|
||||
}
|
||||
tUserInputButtonEvent buttonEvent = {0};
|
||||
uint32_t end = SystemGetMs() + timeout;
|
||||
UserButtons_Clear(env->input);
|
||||
bool fl_onePlay = false;
|
||||
while (SystemGetMs() < end) {
|
||||
if(value != UIU_OFF) {
|
||||
UserIndication_Uiu(env->indication, value);
|
||||
}
|
||||
if(fl_onePlay == false){
|
||||
AudioPlayer_PlayToEnd(env->audioPlayer, audioFileName, audioFileLenght, timeout);
|
||||
fl_onePlay = true;
|
||||
}
|
||||
|
||||
UserButtons_GetNext(env->input, &buttonEvent, timeout);
|
||||
if (UserInputButtonEventIs(buttonEvent, UI_VIRT_BUTTON_ADDITIONAL, FALL)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Нажата \"Доп.Функции\"")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
SystemDelayMs(1);
|
||||
}
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_WaitSosButtonClick(tDeviceTesting *env, char *audioFileName, uint8_t audioFileLenght, uint32_t timeout) {
|
||||
uint32_t end = SystemGetMs() + timeout;
|
||||
UserButtons_Clear(env->input);
|
||||
bool fl_onePlay = false;
|
||||
while (SystemGetMs() < end) {
|
||||
if(fl_onePlay == false){
|
||||
AudioPlayer_PlayToEnd(env->audioPlayer, audioFileName, audioFileLenght, timeout);
|
||||
fl_onePlay = true;
|
||||
}
|
||||
if (UserButtons_GetNext(env->input, &env->buttonEvent, timeout)) {
|
||||
if (UserInputButtonEventIs(env->buttonEvent, UI_VIRT_BUTTON_EMERGENCY, FALL)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Нажата \"SOS\"")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
SystemDelayMs(1);
|
||||
}
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestAudioSpeaker(tDeviceTesting *env) {
|
||||
SystemDelayMs(50);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест динамика")
|
||||
|
||||
char audioFileName[] = "test_dinam.mp3";
|
||||
DeviceTesting_ChekExit(env);
|
||||
if (!DeviceTesting_WaitAddButtonClick(env, audioFileName, sizeof(audioFileName)-1, timeoutPresButton, UIU_OFF)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
DEVTST_PLAY_SAMPLE("error_this_test.mp3")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool DeviceTesting_TestSpeakMic(tDeviceTesting *env) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тестирование микрофона, ожидание контрольной фразы от оператора")
|
||||
|
||||
DEVTST_PLAY_SAMPLE("micSpeakTestInputTestAudio.mp3")
|
||||
DEVTST_REC_TO_WAIT_SAMPLE("test_rec_name.wav")
|
||||
DEVTST_PLAY_SAMPLE("test_rec_name.wav")
|
||||
|
||||
SystemDelayMs(50);
|
||||
DeviceTesting_ChekExit(env);
|
||||
char audioFileName[] = "submitSosButton.mp3";
|
||||
if (!DeviceTesting_WaitSosButtonClick(env, audioFileName, sizeof(audioFileName)-1, timeoutPresButton)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
DEVTST_PLAY_SAMPLE("isError.mp3")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
DEVTST_PLAY_SAMPLE("notError.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestMic(tDeviceTesting *env) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тестирование микрофона, ожидание контрольной фразы от оператора")
|
||||
|
||||
DEVTST_PLAY_SAMPLE("mic_test_get.mp3")
|
||||
DEVTST_REC_TO_WAIT_SAMPLE("test_rec_name.wav")
|
||||
DEVTST_PLAY_SAMPLE("test_rec_name.wav")
|
||||
|
||||
SystemDelayMs(50);
|
||||
DeviceTesting_ChekExit(env);
|
||||
char audioFileName[] = "mic_test_set.mp3";
|
||||
if (!DeviceTesting_WaitAddButtonClick(env, audioFileName, sizeof(audioFileName)-1, timeoutPresButton, UIU_OFF)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
DEVTST_PLAY_SAMPLE("error_this_test.mp3")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_Ignition(tDeviceTesting *env) {
|
||||
env->flagAcsessExitThread = SYSTEM_IS_BUSY;
|
||||
tTestDescriptor *currentTest;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест зажигания")
|
||||
currentTest = DeviceTestsTable_GetModeTestStatic(&env->testsTable, DEVICE_TESTING_MODE_ALL, "IGNITION");
|
||||
if (currentTest) {
|
||||
bool res = false;
|
||||
env->ignitionAddStatusRes = 0;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Запрос выключить зажигание")
|
||||
DEVTST_PLAY_SAMPLE("ign_of.mp3")
|
||||
DeviceTesting_ChekExit(env);
|
||||
if (!DeviceTesting_WaitTestResult(currentTest, DEVICE_TESTING_CODE_NOT_CONNECTED_OK, 10000)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
env->ignitionAddStatusRes = 1;
|
||||
DEVTST_PLAY_SAMPLE("error_this_test.mp3")
|
||||
res = true;
|
||||
} else {
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
res = false;
|
||||
}
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Запрос включить зажигание")
|
||||
DEVTST_PLAY_SAMPLE("ign_on.mp3")
|
||||
if (!DeviceTesting_WaitTestResult(currentTest, DEVICE_TESTING_CODE_CONNECTED, 10000)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
env->ignitionAddStatusRes = 2;
|
||||
DEVTST_PLAY_SAMPLE("error_this_test.mp3")
|
||||
res = true;
|
||||
} else {
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||
if (env->ignitionAddStatusRes == 0 && res == false) {
|
||||
env->ignitionAddStatusRes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SystemDelayMs(200);
|
||||
env->flagAcsessExitThread = SYSTEM_IS_FREE;
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
SystemDelayMs(200);
|
||||
env->flagAcsessExitThread = SYSTEM_IS_FREE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool DeviceTesting_Indication(tDeviceTesting *env) {
|
||||
bool res = false;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест индикатора")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Горит зеленый")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание подтверждения кнопкой доп. функций...")
|
||||
if(env->audioHintsMode != HINTS_MINIMAL){
|
||||
DEVTST_PLAY_SAMPLE("test_gren_led.mp3")
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
char audioFileName[] = "gren_led_ok.mp3";
|
||||
if (!DeviceTesting_WaitAddButtonClick(env, audioFileName,sizeof(audioFileName)-1, timeoutPresButton, UIU_GREEN)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
DEVTST_PLAY_SAMPLE("gren_led_error.mp3")
|
||||
env->indicationStatusRes = 1;
|
||||
res = true;
|
||||
} else {
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест пройден")
|
||||
}
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Горит красный")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание подтверждения кнопкой доп. функций...")
|
||||
|
||||
if(env->audioHintsMode != HINTS_MINIMAL){
|
||||
DEVTST_PLAY_SAMPLE("test_red_led.mp3")
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
char audioFileName_[] = "red_led_ok.mp3";
|
||||
if (!DeviceTesting_WaitAddButtonClick(env, audioFileName_,sizeof(audioFileName_)-1, timeoutPresButton, UIU_RED)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
DEVTST_PLAY_SAMPLE("red_led_error.mp3")
|
||||
res = true;
|
||||
if (env->indicationStatusRes == 0) {
|
||||
env->indicationStatusRes = 2;
|
||||
} else {
|
||||
env->indicationStatusRes = 3;
|
||||
}
|
||||
} else {
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||
if (env->indicationStatusRes == 0 && res == false) {
|
||||
env->indicationStatusRes = 0;
|
||||
}
|
||||
}
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return res;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_Buttons(tDeviceTesting *env) {
|
||||
bool res = false;
|
||||
env->buttonAddStatusRes = 0;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест кнопок")
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание нажатия кнопки экстренного вызова...")
|
||||
char audioFileName_[] = "test_button_emer.mp3";
|
||||
if (!DeviceTesting_WaitSosButtonClick(env, audioFileName_, sizeof(audioFileName_)-1,timeoutPresButton)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
DEVTST_PLAY_SAMPLE("error_this_test.mp3")
|
||||
env->buttonAddStatusRes = 1;
|
||||
res = true;
|
||||
} else {
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест пройден")
|
||||
}
|
||||
|
||||
DeviceTesting_ChekExit(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание нажатия кнопки дополнительных функций...")
|
||||
SystemDelayMs(100);
|
||||
char audioFileName[] = "test_button_add.mp3";
|
||||
if (!DeviceTesting_WaitAddButtonClick(env, audioFileName, sizeof(audioFileName)-1,timeoutPresButton, UIU_OFF)) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста...")
|
||||
DEVTST_PLAY_SAMPLE("error_this_test.mp3")
|
||||
res = true;
|
||||
if (env->buttonAddStatusRes == 0) {
|
||||
env->buttonAddStatusRes = 2;
|
||||
} else {
|
||||
env->buttonAddStatusRes = 3;
|
||||
}
|
||||
} else {
|
||||
DEVTST_PLAY_SAMPLE("sucsess.mp3")
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||
if (env->buttonAddStatusRes == 0 && res == false) {
|
||||
env->buttonAddStatusRes = 0;
|
||||
}
|
||||
}
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return res;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_Ecall(tDeviceTesting *env) {
|
||||
SystemDelayMs(800);
|
||||
env->ecallAddStatusRes = 0;
|
||||
bool res = false;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест экстренного вызова")
|
||||
|
||||
if (env->ErGlUv->settings->ECALL_TEST_NUMBER.length < 2) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста 1")
|
||||
DEVTST_PLAY_SAMPLE("error_this_test")
|
||||
env->ecallAddStatusRes = 1;
|
||||
res = false;
|
||||
} else {
|
||||
eEraGlonassUveos_EcallProcessingResult resCall;
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ожидание выполнения теста экстренного вызова...")
|
||||
resCall = EraGlonassUveos_TestEmergencyCall(env->ErGlUv, &env->tmsdDiagRes);
|
||||
if (resCall == ERA_GLONASS_UVEOS_TEST_CALL_NOT_ALLOWED) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка текущего теста 2")
|
||||
DEVTST_PLAY_SAMPLE("error_this_test")
|
||||
env->ecallAddStatusRes = 2;
|
||||
res = false;
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Текущий тест пройден")
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestIgnitionRes(tDeviceTesting *env) {
|
||||
SystemDelayMs(100);
|
||||
bool res = false;
|
||||
if (env->tmsdDiagRes.ignitionLineFailure != 1) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест зажигания успешно выполнен")
|
||||
// DeviceTesting_IgnitionSucsessPlay(env);
|
||||
res = true;
|
||||
} else {
|
||||
// if (env->ignitionAddStatusRes == 1) {
|
||||
// SystemDelayMs(100);
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при тестировании отключения заигания")
|
||||
// DeviceTesting_IgnitionOffErrorPlay(env);
|
||||
// }
|
||||
// if (env->ignitionAddStatusRes == 2) {
|
||||
// SystemDelayMs(100);
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка при тестировании включения заигания")
|
||||
// DeviceTesting_IgnitionOnErrorPlay(env);
|
||||
// }
|
||||
res = false;
|
||||
}
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return res;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestButtonRes(tDeviceTesting *env) {
|
||||
bool res = false;
|
||||
if (env->tmsdDiagRes.uimFailure != 1) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест кнопок успешно выполнен")
|
||||
// DeviceTesting_ButtonSuccessPlay(env);
|
||||
// SystemDelayMs(500);
|
||||
res = true;
|
||||
} else {
|
||||
// if (env->buttonAddStatusRes == 1) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестировании кнопки экстренного вызова")
|
||||
// SystemDelayMs(500);
|
||||
// DeviceTesting_ErorSosButtonPlay(env);
|
||||
// }
|
||||
// if (env->buttonAddStatusRes == 2) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестировании кнопки дополнительный функций")
|
||||
// SystemDelayMs(500);
|
||||
// DeviceTesting_ErorAddButtonPlay(env);
|
||||
// }
|
||||
// if (env->buttonAddStatusRes == 3) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестировании кнопки дополнительный функций")
|
||||
// SystemDelayMs(500);
|
||||
// DeviceTesting_ErorSosButtonPlay(env);
|
||||
// SystemDelayMs(500);
|
||||
// DeviceTesting_ErorAddButtonPlay(env);
|
||||
// }
|
||||
res = false;
|
||||
}
|
||||
if(!AudioPlayer_IsBusy(env->audioPlayer,0)) {
|
||||
return res;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestAudioSpeakerRes(tDeviceTesting *env) {
|
||||
if (env->tmsdDiagRes.speakersFailure == 1) {
|
||||
// DeviceTesting_ErorSpeakerPlay(env);
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестирования динамика")
|
||||
return 0;
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест динамика успешно выполнен")
|
||||
// DeviceTesting_SucsessSpeakerPlay(env);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestMicRes(tDeviceTesting *env) {
|
||||
if (env->tmsdDiagRes.micFailure != 1) {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест микрофона успешно выполнен")
|
||||
// DeviceTesting_SucsessMicPlay(env);
|
||||
return 1;
|
||||
} else {
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "Ошибка тестирования микрофона")
|
||||
// DeviceTesting_ErorMicPlay(env);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceTesting_TestIndicationRes(tDeviceTesting *env) {
|
||||
bool res = false;
|
||||
if (env->tmsdDiagRes.statusIndicatorFailure != 1) {
|
||||
//// LoggerInfoStatic(LOGGER, LOG_SIGN, "Тест индикаторов успешно выполнен")
|
||||
// SystemDelayMs(500);
|
||||
// DeviceTesting_SucsessIndicationPlay(env);
|
||||
res = true;
|
||||
} else {
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void DeviceTesting_GetEcalRes(tDeviceTesting *env) {
|
||||
if (env->ecallAddStatusRes == 0) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Тестирование вызова выполнено успешно")
|
||||
SystemDelayMs(500);
|
||||
DeviceTesting_EmergencySucsessPlay(env);
|
||||
}
|
||||
if (env->ecallAddStatusRes == 1) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Номер тестового вызова не установлен, вызов не возможен")
|
||||
// DeviceTesting_ErorEmergencyPlay(env);
|
||||
SystemDelayMs(500);
|
||||
DeviceTesting_ErorEmergencyNumberNotSetPlay(env);
|
||||
}
|
||||
if (env->ecallAddStatusRes == 2) {
|
||||
// LoggerInfoStatic(LOGGER, LOG_SIGN, "Превышен допустимый интервал, вызов не возможен, попробуйте позже")
|
||||
SystemDelayMs(500);
|
||||
DeviceTesting_ErorEmergencyTempLocPlay(env);
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceTesting_UserGetResult(tDeviceTesting *env) {
|
||||
bool fullRes = true;
|
||||
SystemDelayMs(1000);
|
||||
if (DeviceTesting_TestAudioSpeakerRes(env) && fullRes) {
|
||||
fullRes = true;
|
||||
} else {
|
||||
fullRes = false;
|
||||
}
|
||||
|
||||
if (DeviceTesting_TestMicRes(env) && fullRes) {
|
||||
fullRes = true;
|
||||
} else {
|
||||
fullRes = false;
|
||||
}
|
||||
|
||||
if (DeviceTesting_TestIgnitionRes(env) && fullRes) {
|
||||
fullRes = true;
|
||||
} else {
|
||||
fullRes = false;
|
||||
}
|
||||
|
||||
if (DeviceTesting_TestButtonRes(env) && fullRes) {
|
||||
fullRes = true;
|
||||
} else {
|
||||
fullRes = false;
|
||||
}
|
||||
|
||||
if (DeviceTesting_TestIndicationRes(env) && fullRes) {
|
||||
fullRes = true;
|
||||
} else {
|
||||
fullRes = false;
|
||||
}
|
||||
|
||||
return fullRes;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"dep": [
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "XfcTransportProtocol"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "BaseTypes"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "DeviceTestsTable"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "AudioPlayerInterface"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "UserButtonsInterface"
|
||||
}
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"Inc"
|
||||
],
|
||||
"srcs": [
|
||||
"Src/**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue