Init
This commit is contained in:
commit
dceb2526da
|
|
@ -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,13 @@
|
|||
//
|
||||
// Created by zemon on 20.02.24.
|
||||
//
|
||||
|
||||
#ifndef HEAVY_TERMINAL_CLIPRIVATE_H
|
||||
#define HEAVY_TERMINAL_CLIPRIVATE_H
|
||||
|
||||
#include "ComandLineInterface.h"
|
||||
|
||||
int32_t CliCmd_baseCommandHelp(void *env, tCliCmd *cli);
|
||||
void vTaskGetRunTime(void *env, tCliCmd *cli);
|
||||
|
||||
#endif //HEAVY_TERMINAL_CLIPRIVATE_H
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
//
|
||||
// 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 "PowerManagment.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,
|
||||
tAccelCoor *accelCoor,
|
||||
tCarCrashDetection *carCrashDetection
|
||||
) {
|
||||
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, accelCoor, carCrashDetection);
|
||||
|
||||
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, "reboot", (cliCall) CliCmd_CmsisReboot, NULL);
|
||||
CliRedirectionTable_RecAddStatic(&env->redirectTable, "emerTest", (cliCall) CliCmd_EcoolSimulation,
|
||||
&env->sub.uvEmrgSimInter);
|
||||
CliRedirectionTable_RecAddStatic(&env->redirectTable, "mem", (cliCall) vTaskGetRunTime, NULL);
|
||||
|
||||
//Инициализируем поток
|
||||
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,72 @@
|
|||
//
|
||||
// Created by zemon on 20.02.24.
|
||||
//
|
||||
|
||||
#ifndef HEAVY_TERMINAL_COMANDLINEINTERFACE_H
|
||||
#define HEAVY_TERMINAL_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(1024) 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,
|
||||
tAccelCoor *tAccelCoor,
|
||||
tCarCrashDetection *carCrashDetection
|
||||
);
|
||||
|
||||
void Cli_StartThread(tCli *env);
|
||||
|
||||
#endif //HEAVY_TERMINAL_COMANDLINEINTERFACE_H
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// Created by cfif on 17.12.2024.
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "CliPrivate.h"
|
||||
|
||||
void vTaskGetRunTime(void *env, tCliCmd *cli) {
|
||||
|
||||
volatile UBaseType_t uxArraySize, x;
|
||||
char bufSprintf[1024];
|
||||
|
||||
uxArraySize = uxTaskGetNumberOfTasks();
|
||||
|
||||
TaskStatus_t pxTaskStatusArray[uxArraySize];
|
||||
|
||||
|
||||
uxArraySize = uxTaskGetSystemState((void *) pxTaskStatusArray, uxArraySize, NULL);
|
||||
|
||||
uint16_t p = 1;
|
||||
bufSprintf[0] = '\n';
|
||||
|
||||
for (x = 0; x < uxArraySize; x++) {
|
||||
|
||||
sprintf(&bufSprintf[p], "%lu\t%d\t%s\n",
|
||||
pxTaskStatusArray[x].xTaskNumber,
|
||||
pxTaskStatusArray[x].usStackHighWaterMark,
|
||||
pxTaskStatusArray[x].pcTaskName);
|
||||
|
||||
p = strlen(bufSprintf);
|
||||
|
||||
}
|
||||
|
||||
CliCmd_Print(cli, bufSprintf, p);
|
||||
// LoggerStrInfo(LOGGER, LOG_SIGN, env->bufSprintf, strlen(env->bufSprintf));
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"dep": [
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "StreamBuf"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_RedirectTable"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_EcallSimulation"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_Reboot_CM4"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_Vars"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_MsdTable"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_SerialBridge"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_FlipSetting"
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "Smart_Components_Aurus",
|
||||
"repo": "CliCmd_netGsmUpDown"
|
||||
}
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"./"
|
||||
],
|
||||
"srcs": [
|
||||
"./**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue