From 27d2d6a411ade7171dc0501d0dcf9b1c970572be Mon Sep 17 00:00:00 2001 From: cfif Date: Mon, 2 Jun 2025 13:26:40 +0300 Subject: [PATCH] Init --- Inc/CliCmd/EcoolSimulation.h | 38 ++++++++++++++++++++ Src/CliCmd/EcoolSimulation.c | 67 ++++++++++++++++++++++++++++++++++++ modular.json | 23 +++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 Inc/CliCmd/EcoolSimulation.h create mode 100644 Src/CliCmd/EcoolSimulation.c create mode 100644 modular.json diff --git a/Inc/CliCmd/EcoolSimulation.h b/Inc/CliCmd/EcoolSimulation.h new file mode 100644 index 0000000..e141a42 --- /dev/null +++ b/Inc/CliCmd/EcoolSimulation.h @@ -0,0 +1,38 @@ +// +// Created by zemon on 20.12.22. +// + +#ifndef UVEOS_ON_NATION_ECOOLSIMULATION_H +#define UVEOS_ON_NATION_ECOOLSIMULATION_H + +#include "UveosEmergencyEventInterface.h" +#include "SystemDelayInterface.h" +#include "UserInputButtonWatcher.h" +#include "CliCmd.h" +#include "GsmWithGnss.h" + + +typedef struct { + tUveosEmergencySimulationInterface *uveosEmergSimulInter; + tUserInputButtonWatcher *userInpButtWatch; + float asi15; + float flipAngle; + tGsmWithGnss *gsmWithGnss +} tEcoolSimulation; + +void CliCmd_EcoolSimulationHelp(tCliCmd *cli); + +void CliCmd_EcoolSimulationInit( + tEcoolSimulation *envEmSim, + tUveosEmergencySimulationInterface *envEmSimExt, + tUserInputButtonWatcher *userInpButtWatch, + float asi15Ext, + float angleExt, + tGsmWithGnss *gsmWithGnss + ); + +uint8_t CliCmd_EcoolSimulation(tEcoolSimulation *envEmSim, tCliCmd *cli); + + + +#endif //UVEOS_ON_NATION_ECOOLSIMULATION_H \ No newline at end of file diff --git a/Src/CliCmd/EcoolSimulation.c b/Src/CliCmd/EcoolSimulation.c new file mode 100644 index 0000000..a28110c --- /dev/null +++ b/Src/CliCmd/EcoolSimulation.c @@ -0,0 +1,67 @@ +// +// Created by zemon on 20.12.22. +// + +#include "CliCmd/EcoolSimulation.h" +#include "UserInput.h" + +void CliCmd_EcoolSimulationHelp(tCliCmd *cli) { + CliCmd_PrintLnStatic(cli, " access sub commands:"); + CliCmd_PrintLnStatic(cli, " command [ sendAsi ] - Call, and sending ASI15 info"); + CliCmd_PrintLnStatic(cli, " command [ sendFlip ] - Call, and sending flip angle info"); + CliCmd_PrintLnStatic(cli, " command [ sendFull ] - Call, and sending full crash info"); + CliCmd_PrintLnStatic(cli, " command [ help ] - help this as sub mode"); + CliCmd_PrintLnStatic(cli, " command [ exit ] - exit as this sub mode"); + CliCmd_PrintLnStatic(cli, ""); +} + +void CliCmd_EcoolSimulationInit( + tEcoolSimulation *envEmSim, + tUveosEmergencySimulationInterface *envEmSimExt, + tUserInputButtonWatcher *userInpButtWatch, + float asi15Ext, + float angleExt, + tGsmWithGnss *gsmWithGnss +){ + envEmSim->uveosEmergSimulInter = envEmSimExt; + envEmSim->userInpButtWatch = userInpButtWatch; + envEmSim->asi15 = asi15Ext; + envEmSim->flipAngle = angleExt; + envEmSim->gsmWithGnss = gsmWithGnss; +} + + +uint8_t CliCmd_EcoolSimulation(tEcoolSimulation *envEmSim, tCliCmd *cli){ + CliCmd_PrintLnStatic(cli, "THIS MODE EMERGENCY MANUAL CALL"); + CliCmd_EcoolSimulationHelp(cli); + + while (1) { + CliCmd_WaitLineDelay(cli, 1500); + if (CliCmd_RxStartsWithStatic(cli, "exit")) { + CliCmd_PrintLnStatic(cli, "EXIT IN BASE MODE..."); + return 0; + } + + if (CliCmd_RxStartsWithStatic(cli, "help")) { + CliCmd_EcoolSimulationHelp(cli); + CliCmd_WaitLine(cli); + } + + if (CliCmd_RxStartsWithStatic(cli, "sendAsi")) { + CliCmd_PrintLnStatic(cli, "Ручная отправка данных ASI15"); + UveosEmergencySimulationInterface_ASI15(envEmSim->uveosEmergSimulInter, envEmSim->asi15) + } + + if (CliCmd_RxStartsWithStatic(cli, "sendFlip")) { + CliCmd_PrintLnStatic(cli, "Ручная отправка данных переворота"); + UveosEmergencySimulationInterface_Flip(envEmSim->uveosEmergSimulInter, envEmSim->flipAngle) + } + + if (CliCmd_RxStartsWithStatic(cli, "sendFull")) { + CliCmd_PrintLnStatic(cli, "Ручной вызов отправки полных данный экстренной ситуации"); + UserInputButtonWatcher_SimulateButton(envEmSim->userInpButtWatch, UI_VIRT_BUTTON_EMERGENCY); + } + + SystemDelayMs(4); + } +} \ No newline at end of file diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..8348db0 --- /dev/null +++ b/modular.json @@ -0,0 +1,23 @@ +{ + "dep": [ + { + "type": "git", + "provider": "Smart_Components_Aurus", + "repo": "CmsisCore5" + }, + { + "type": "git", + "provider": "Smart_Components_Aurus", + "repo": "CliCmd" + } + ], + "cmake": { + "inc_dirs": [ + "Inc" + ], + "srcs": [ + "Src/**.c" + ] + } + +} \ No newline at end of file