Init
This commit is contained in:
commit
c0d617cf89
|
|
@ -0,0 +1,27 @@
|
||||||
|
//
|
||||||
|
// Created by zemon on 01.12.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "CliPrivate.h"
|
||||||
|
|
||||||
|
int32_t CliCmd_baseCommandHelp(void *env, tCliCmd *cli) {
|
||||||
|
CliCmd_PrintLnStatic(cli, "================================================");
|
||||||
|
CliCmd_PrintLnStatic(cli, "ACCESS COMANDS:");
|
||||||
|
// CliCmd_PrintLnStatic(cli, "");
|
||||||
|
// CliCmd_PrintLnStatic(cli, " [setting ] - switch to variable setting mode");
|
||||||
|
// CliCmd_VarsHelp(cli);
|
||||||
|
CliCmd_PrintLnStatic(cli,
|
||||||
|
"[ gnss_mode ] - switch in gnss mode, accessing to AT interface (ONLY TERMINAL CONNECTED)");
|
||||||
|
CliCmdSerialBridge_Help(env, cli);
|
||||||
|
CliCmd_PrintLnStatic(cli, "[ set_flip ] - switch in mode setting flip params");
|
||||||
|
CliCmd_flipModedHelp(env, cli);
|
||||||
|
CliCmd_PrintLnStatic(cli, "[ msd_info ] - switch in mode setting flip params");
|
||||||
|
CliCmdMsdTable_Help(cli);
|
||||||
|
CliCmd_PrintLnStatic(cli, "[ emerTest ] - testing ecall and sendn support data");
|
||||||
|
CliCmd_EcoolSimulationHelp(cli);
|
||||||
|
CliCmd_PrintLnStatic(cli, "[ reboot ] - full devise rebooting");
|
||||||
|
CliCmd_rebootHelp(cli);
|
||||||
|
CliCmd_PrintLnStatic(cli, "[ addFun ] - additional function");
|
||||||
|
CliCmd_powerStateHelp(cli);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 10.12.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_CLIPRIVATE_H
|
||||||
|
#define UVEOS_ON_NATION_CLIPRIVATE_H
|
||||||
|
|
||||||
|
#include "ComandLineInterface.h"
|
||||||
|
|
||||||
|
int32_t CliCmd_baseCommandHelp(void *env, tCliCmd *cli);
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_CLIPRIVATE_H
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
//
|
||||||
|
// Created by zemon on 24.10.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "CliPrivate.h"
|
||||||
|
#include "SystemDelayInterface.h"
|
||||||
|
#include "AsciiStringParsingUtils.h"
|
||||||
|
#include "stream.h"
|
||||||
|
#include "EraGlonassUveos.h"
|
||||||
|
#include "CliCmd/NetGsmUpDown.h"
|
||||||
|
#include "PowerManagement.h"
|
||||||
|
|
||||||
|
void Cli_Init(
|
||||||
|
tCli *env,
|
||||||
|
tSerialPortIO *serial,
|
||||||
|
tSerialPortIO *serialSniffer,
|
||||||
|
tVariablesTable *extTable,
|
||||||
|
tCarFlipDetection *tFlip,
|
||||||
|
tEraGlonassMsdTable *msdTable,
|
||||||
|
tUveosEmergencySimulationInterface *uvEmrgSimInter,
|
||||||
|
tUserInputButtonWatcher *userIntButtWatch,
|
||||||
|
tEraGlonassUveosDumperInterface *dumperInterface,
|
||||||
|
tPowerManagement *power,
|
||||||
|
tGsmWithGnss *gsmWithGnss,
|
||||||
|
tEraGlonassUveos *uveos
|
||||||
|
) {
|
||||||
|
env->serialCommandPort = serial;
|
||||||
|
env->serialSnifferPort = serialSniffer;
|
||||||
|
env->externTable = extTable;
|
||||||
|
|
||||||
|
CliCmd_InitStatic(&env->cmd, serial, env->mem.cmdRxLine);
|
||||||
|
CliRedirectionTable_InitStatic(&env->redirectTable, env->mem.commandPrefixes);
|
||||||
|
|
||||||
|
CliCmdMsdTable_Init(&env->sub.msdTab, msdTable, dumperInterface);
|
||||||
|
CliCmd_FlipSettingInit(&env->sub.flipSet, tFlip, extTable);
|
||||||
|
|
||||||
|
CliCmd_AddInfoInit(&env->sub.addFunc, gsmWithGnss, uveos, power);
|
||||||
|
|
||||||
|
CliCmd_EcoolSimulationInit(
|
||||||
|
&env->sub.uvEmrgSimInter,
|
||||||
|
uvEmrgSimInter,
|
||||||
|
userIntButtWatch,
|
||||||
|
msdTable->items->msd.MSD_Data.additionalData.asi15,
|
||||||
|
tFlip->current.angleCos,
|
||||||
|
gsmWithGnss
|
||||||
|
);
|
||||||
|
|
||||||
|
if (serialSniffer != NULL) {
|
||||||
|
CliCmdSerialBridge_Init(&env->sub.serialBridge, serialSniffer);
|
||||||
|
CliRedirectionTable_RecAddStatic(
|
||||||
|
&env->redirectTable,
|
||||||
|
"gnss_mode",
|
||||||
|
(cliCall) CliCmdSerialBridge_Process,
|
||||||
|
&env->sub.serialBridge
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CliRedirectionTable_RecAddStatic(
|
||||||
|
&env->redirectTable,
|
||||||
|
"msd_info", (cliCall)
|
||||||
|
CliCmdMsdTable_Process,
|
||||||
|
&env->sub.msdTab
|
||||||
|
);
|
||||||
|
|
||||||
|
CliRedirectionTable_RecAddStatic(&env->redirectTable, "help", (cliCall) CliCmd_baseCommandHelp, NULL);
|
||||||
|
CliRedirectionTable_RecAddStatic(&env->redirectTable, "set_flip", (cliCall) CliCmd_FlipSetting, &env->sub.flipSet);
|
||||||
|
CliRedirectionTable_RecAddStatic(&env->redirectTable, "addFun", (cliCall) CliCmd_AddInfo, &env->sub.addFunc);
|
||||||
|
// CliRedirectionTable_RecAddStatic(&env->redirectTable, "setting", (cliCall) CliCmd_ChangeListVar, extTable);
|
||||||
|
CliRedirectionTable_RecAddStatic(&env->redirectTable, "reboot", (cliCall) CliCmd_CmsisReboot, NULL);
|
||||||
|
CliRedirectionTable_RecAddStatic(&env->redirectTable, "emerTest", (cliCall) CliCmd_EcoolSimulation,
|
||||||
|
&env->sub.uvEmrgSimInter);
|
||||||
|
|
||||||
|
//Инициализируем поток
|
||||||
|
InitThreadBlock(env->thread, "Cli", osPriorityNormal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ListenCLICommand(tCli *env) {
|
||||||
|
CliCmd_WaitLine(&env->cmd);
|
||||||
|
if (CliRedirectionTable_ProcessCmd(&env->redirectTable, &env->cmd) != 0) {
|
||||||
|
|
||||||
|
CliCmd_PrintStatic(&env->cmd, "COMMAND NOT FOUND!");
|
||||||
|
CliCmd_PrintStatic(&env->cmd, " EXECUTE COMMAND [ help ] OF MORE INFORMATION ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static _Noreturn void Cli_Thread(tCli *env) {
|
||||||
|
for (;;) {
|
||||||
|
ListenCLICommand(env);
|
||||||
|
SystemDelayMs(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cli_StartThread(tCli *env) {
|
||||||
|
if (!env->thread.id) {
|
||||||
|
env->thread.id = osThreadNew((osThreadFunc_t) (Cli_Thread), (void *) (env), &env->thread.attr);
|
||||||
|
} else {
|
||||||
|
osThreadResume(env->thread.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
//
|
||||||
|
// Created by zemon on 24.10.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_COMANDLINEINTERFACE_H
|
||||||
|
#define UVEOS_ON_NATION_COMANDLINEINTERFACE_H
|
||||||
|
|
||||||
|
#include "CliRedirectTable.h"
|
||||||
|
#include "ComandLineInterface.h"
|
||||||
|
#include "CmsisRtosThreadUtils.h"
|
||||||
|
|
||||||
|
#include "EraGlonassUveos_Dumper.h"
|
||||||
|
#include "CliCmd/CmsisReboot.h"
|
||||||
|
#include "CliCmd/Vars.h"
|
||||||
|
#include "CliCmd/SerialBridge.h"
|
||||||
|
#include "CliCmd/FlipSetting.h"
|
||||||
|
#include "CliCmd/MsdTable.h"
|
||||||
|
#include "CliCmd/EcoolSimulation.h"
|
||||||
|
#include "CliCmd/NetGsmUpDown.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
struct {
|
||||||
|
char data[128];
|
||||||
|
size_t length;
|
||||||
|
} rxCommandBuffer;
|
||||||
|
|
||||||
|
char res[64];
|
||||||
|
|
||||||
|
tSerialPortIO *serialCommandPort;
|
||||||
|
tSerialPortIO *serialSnifferPort;
|
||||||
|
tVariablesTable *externTable;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
tCliRedirectItem commandPrefixes[10];
|
||||||
|
uint8_t cmdRxLine[512];
|
||||||
|
} mem;
|
||||||
|
|
||||||
|
tCliRedirectTable redirectTable;
|
||||||
|
tCliCmd cmd;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
tCliCmdSerialBridge serialBridge;
|
||||||
|
tFlipSetting flipSet;
|
||||||
|
tCliCmdMsdTable msdTab;
|
||||||
|
tEcoolSimulation uvEmrgSimInter;
|
||||||
|
tAddFunc addFunc;
|
||||||
|
} sub;
|
||||||
|
|
||||||
|
|
||||||
|
tStaticThreadBlock(512) thread;
|
||||||
|
} tCli;
|
||||||
|
|
||||||
|
|
||||||
|
void Cli_Init(
|
||||||
|
tCli *env,
|
||||||
|
tSerialPortIO *serial,
|
||||||
|
tSerialPortIO *serialSniffer,
|
||||||
|
tVariablesTable *extTable,
|
||||||
|
tCarFlipDetection *tFlip,
|
||||||
|
tEraGlonassMsdTable *msdTable,
|
||||||
|
tUveosEmergencySimulationInterface *uvEmrgSimInter,
|
||||||
|
tUserInputButtonWatcher *userIntButtWatch,
|
||||||
|
tEraGlonassUveosDumperInterface *dumperInterface,
|
||||||
|
tPowerManagement *power,
|
||||||
|
tGsmWithGnss *gsmWithGnss,
|
||||||
|
tEraGlonassUveos *uveos
|
||||||
|
);
|
||||||
|
|
||||||
|
void Cli_StartThread(tCli *env);
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_COMANDLINEINTERFACE_H
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
{
|
||||||
|
"dep": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "StreamBuf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_RedirectTable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_EcallSimulation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_Reboot_CM4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_Vars"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_MsdTable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_SerialBridge"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_FlipSetting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||||
|
"repo": "CliCmd_netGsmUpDown"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"./"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"./**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue