Init
This commit is contained in:
commit
f1fc3c0784
|
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Created by zemon on 23.03.23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef UVEOS_ON_NATION_NETGSMUPDOWN_H
|
||||||
|
#define UVEOS_ON_NATION_NETGSMUPDOWN_H
|
||||||
|
|
||||||
|
#include "CliCmd.h"
|
||||||
|
#include "PowerManagment.h"
|
||||||
|
#include "GsmWithGnss.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
tGsmWithGnss *gsmWithGnss;
|
||||||
|
tPowerManagement *power;
|
||||||
|
tEraGlonassUveos *uveos;
|
||||||
|
bool netState;
|
||||||
|
} tAddFunc;
|
||||||
|
|
||||||
|
void CliCmd_AddInfoInit(tAddFunc *addFunc, tGsmWithGnss *gsmWithGnss, tEraGlonassUveos *uveos, tPowerManagement *power);
|
||||||
|
|
||||||
|
uint8_t CliCmd_powerStateHelp(tCliCmd *cli);
|
||||||
|
uint8_t CliCmd_AddInfo(tAddFunc *addFunc, tCliCmd *cli);
|
||||||
|
|
||||||
|
#endif //UVEOS_ON_NATION_NETGSMUPDOWN_H
|
||||||
|
|
@ -0,0 +1,275 @@
|
||||||
|
//
|
||||||
|
// Created by zemon on 23.03.23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "CliCmd/NetGsmUpDown.h"
|
||||||
|
#include "SystemDelayInterface.h"
|
||||||
|
#include "PowerManagment.h"
|
||||||
|
#include "AsciiStringAssmeblingUtils.h"
|
||||||
|
#include "stream.h"
|
||||||
|
#include "MainModesArbiter_Private.h"
|
||||||
|
|
||||||
|
void CliCmd_AddInfoInit(tAddFunc *addFunc, tGsmWithGnss *gsmWithGnss, tEraGlonassUveos *uveos, tPowerManagement *power){
|
||||||
|
addFunc->gsmWithGnss = gsmWithGnss;
|
||||||
|
addFunc->power = power;
|
||||||
|
addFunc->uveos = uveos;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CliCmd_GetOffsetToDistance(tAddFunc *env, tCliCmd *cliCmd){
|
||||||
|
size_t str_len = 0;
|
||||||
|
char step[20];
|
||||||
|
EraGlonassUveosNavData movDinst;
|
||||||
|
while (1) {
|
||||||
|
CliCmd_WaitLineDelay(cliCmd, 1500);
|
||||||
|
if (CliCmd_RxStartsWithStatic(cliCmd, "exit")) {
|
||||||
|
CliCmd_PrintLnStatic(cliCmd, "EXIT IN BASE MODE...");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cliCmd, "exit")) {
|
||||||
|
CliCmd_PrintLnStatic(cliCmd, "EXIT IN BASE MODE...");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env->uveos->doNothing.stopLimitTime < SystemGetMs()) {
|
||||||
|
NavDataProvider_GetNavData(env->uveos->navDataProvider, &env->uveos->doNothing.movePosition, false);
|
||||||
|
CliCmd_PrintStatic(cliCmd, "Установлена новая точка отсчёта движения ТС\r\n");
|
||||||
|
env->uveos->doNothing.stopLimitTime = SystemGetMs() + (40 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env->uveos->doNothing.movePosition.valid > 0) {
|
||||||
|
NavDataProvider_GetNavData(env->uveos->navDataProvider, &movDinst, false);
|
||||||
|
uint32_t latDistance = abs(movDinst.latitude - env->uveos->doNothing.movePosition.latitude);
|
||||||
|
uint32_t lonDistance = abs(movDinst.longitude - env->uveos->doNothing.movePosition.longitude);
|
||||||
|
|
||||||
|
double x = latDistance * 0.1;
|
||||||
|
double y = lonDistance * 0.1;
|
||||||
|
double move = sqrt(x * x + y * y);
|
||||||
|
env->uveos->doNothing.movDist = (uint32_t) move;
|
||||||
|
|
||||||
|
vAsciiStringInit(step, &str_len, 5);
|
||||||
|
vAsciiStringAddDecimalInt64(step, &str_len, env->uveos->doNothing.movDist, 5);
|
||||||
|
CliCmd_PrintStatic(cliCmd, "Отклонение = ");
|
||||||
|
debug_printf(cliCmd->serialCommandPort, "%u", step);
|
||||||
|
CliCmd_PrintStatic(cliCmd, "\n");
|
||||||
|
} else {
|
||||||
|
CliCmd_PrintStatic(cliCmd, "Данные GNSS не валидны\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t CliCmd_AddInfo(tAddFunc *env, tCliCmd *cli) {
|
||||||
|
CliCmd_PrintLnStatic(cli, "THIS MODE IS MANAGE COMMUNICATION SUBSYSTEM STATUS");
|
||||||
|
CliCmd_powerStateHelp(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, "breakTest")) {
|
||||||
|
env->uveos->doNothing.mode = UVEOS_DO_NOTHING_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "pulMsd")) {
|
||||||
|
env->gsmWithGnss->urc.msdPull = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "getOfset")) {
|
||||||
|
CliCmd_GetOffsetToDistance(env, cli);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "gsmUp")) {
|
||||||
|
GsmWithGnssInitGnss(env->gsmWithGnss);
|
||||||
|
if(GsmWithGnss_InvalidateNetworkEnable(env->gsmWithGnss, 0, true)){
|
||||||
|
CliCmd_PrintLnStatic(cli, "GSM network is up");
|
||||||
|
} else {
|
||||||
|
CliCmd_PrintLnStatic(cli, "GSM network upping is error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "gsmDown")) {
|
||||||
|
GsmWithGnssInitGnss(env->gsmWithGnss);
|
||||||
|
if(GsmWithGnss_InvalidateNetworkEnable(env->gsmWithGnss, 0, false) == false){
|
||||||
|
CliCmd_PrintLnStatic(cli, "GSM network is down");
|
||||||
|
} else {
|
||||||
|
CliCmd_PrintLnStatic(cli, "GSM network down is error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "audioUp")) {
|
||||||
|
// Pwm_MuteAmpOff(env->power);
|
||||||
|
Mma_AudioTestSetMode(env->power,1);
|
||||||
|
CliCmd_PrintLnStatic(cli, "audio subsystem is up");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "audioDown")) {
|
||||||
|
// Pwm_MuteAmpOn(env->power);
|
||||||
|
Mma_AudioTestSetMode(env->power,1);
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, "audio subsystem is down");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "mndReq")) {
|
||||||
|
env->gsmWithGnss->gsmAt.test = 1;
|
||||||
|
CliCmd_PrintLnStatic(cli, "mndReq ok");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "ecallReq")) {
|
||||||
|
env->gsmWithGnss->gsmAt.test = 2;
|
||||||
|
CliCmd_PrintLnStatic(cli, "ecallReq ok");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "setFulBacNum")) {
|
||||||
|
env->gsmWithGnss->gsmAt.test = 3;
|
||||||
|
CliCmd_PrintLnStatic(cli, "setFulBacNum ok");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "updRemSostware")) {
|
||||||
|
env->gsmWithGnss->gsmAt.test = 4;
|
||||||
|
CliCmd_PrintLnStatic(cli, "updRemSostware ok");
|
||||||
|
}
|
||||||
|
// if (CliCmd_RxStartsWithStatic(cli, "bipUp")) {
|
||||||
|
// Pwm_GsmAndBipStartUp(env->power);
|
||||||
|
// CliCmd_PrintLnStatic(cli, "block user interface is up");
|
||||||
|
// }
|
||||||
|
// if (CliCmd_RxStartsWithStatic(cli, "bipDown")) {
|
||||||
|
// Pwm_BipShutdown(env->power);
|
||||||
|
// CliCmd_PrintLnStatic(cli, "block user interface is down");
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "commIntDown")) {
|
||||||
|
CliCmd_PrintLnStatic(cli, "Command interface is down");
|
||||||
|
Pwm_Rs485Disable(env->power);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "charUp")) {
|
||||||
|
Pwm_ChargeEnable(env->power);
|
||||||
|
CliCmd_PrintLnStatic(cli, "Charge battary is up");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "charDown")) {
|
||||||
|
Pwm_ChargeDisable(env->power);
|
||||||
|
CliCmd_PrintLnStatic(cli, "Charge battary is down");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CliCmd_RxStartsWithStatic(cli, "netPowerUp")) {
|
||||||
|
// Pwm_GsmAndGnssStartup(env->power);
|
||||||
|
// CliCmd_PrintLnStatic(cli, "Enabled power network subsystem");
|
||||||
|
// }
|
||||||
|
// if (CliCmd_RxStartsWithStatic(cli, "netPowerDown")) {
|
||||||
|
// Pwm_GsmAndGnssShutdown(env->power);
|
||||||
|
// CliCmd_PrintLnStatic(cli, "Disabled power network subsystem");
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "muteOn")) {
|
||||||
|
Pwm_SetMuteInCar(env->power,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "muteOff")) {
|
||||||
|
Pwm_SetMuteInCar(env->power,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "fullUp")) {
|
||||||
|
Pwm_PowerSavingDisable(env->power);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "fullDown")) {
|
||||||
|
Pwm_PowerSavingEnable(env->power);
|
||||||
|
CliCmd_PrintLnStatic(cli, "Command interface is upping, for is down ComInt enter command [ commIntDown ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "help")) {
|
||||||
|
CliCmd_powerStateHelp(cli);
|
||||||
|
CliCmd_WaitLine(cli);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "rmcStop")) {
|
||||||
|
// GsmWithGnss_StopRMCThread(&env->gsmWithGnss->gsmAt);
|
||||||
|
CliCmd_PrintLnStatic(cli, "+++ is sending");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "rmcStart")) {
|
||||||
|
// GsmWithGnss_ActivateRMCPort(&env->gsmWithGnss->gsmAt);
|
||||||
|
// GsmWithGnss_startUrcThread(&env->gsmWithGnss->gsmAt);
|
||||||
|
CliCmd_PrintLnStatic(cli, "rmc is sending");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "regBl1")) {
|
||||||
|
RegCost(true);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== regBl1 =======");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "regBl0")) {
|
||||||
|
RegCost(false);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== regBl0 =======");
|
||||||
|
}
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "shotDown")) {
|
||||||
|
Pwm_Shutdown(env->power);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== shotDown =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "mupePOn")) {
|
||||||
|
Pwm_SetPMuteInCar(env->power, true);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== mupePOn =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "mupePOff")) {
|
||||||
|
Pwm_SetPMuteInCar(env->power, false);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== mupePOff =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "mupeNOn")) {
|
||||||
|
Pwm_SetNMuteInCar(env->power, true);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== mupeNOn =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "muteNOff")) {
|
||||||
|
Pwm_SetNMuteInCar(env->power, false);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== muteNOff =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "ecallOutSignOn")) {
|
||||||
|
Pwm_SetEcallSignalOutInCar(env->power, true);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== ecallOutSignOn =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "ecallOutSignOff")) {
|
||||||
|
Pwm_SetEcallSignalOutInCar(env->power, false);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== ecallOutSignOff =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "serviseOutSignOn")) {
|
||||||
|
Pwm_SetServiseSignalOutInCar(env->power, true);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== serviseOutSignOn =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "serviseOutSignOff")) {
|
||||||
|
Pwm_SetServiseSignalOutInCar(env->power, false);
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== serviseOutSignOff =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "getSosButtonState")) {
|
||||||
|
if(Pwm_GetSosButtonState(env->power) == true){
|
||||||
|
CliCmd_PrintLnStatic(cli, "SOS BUTTON ON");
|
||||||
|
} else {
|
||||||
|
CliCmd_PrintLnStatic(cli, "SOS BUTTON OFF");
|
||||||
|
}
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== getSosButtonState =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CliCmd_RxStartsWithStatic(cli, "getServiseButtonState")) {
|
||||||
|
if(Pwm_GetServiseButtonState( env->power) == true){
|
||||||
|
CliCmd_PrintLnStatic(cli, "SERVICE BUTTON ON");
|
||||||
|
} else {
|
||||||
|
CliCmd_PrintLnStatic(cli, "SERVICE BUTTON OFF");
|
||||||
|
}
|
||||||
|
CliCmd_PrintLnStatic(cli, "====== getServiseButtonState =======");
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemDelayMs(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
//
|
||||||
|
// Created by zemon on 23.03.23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "CliCmd/NetGsmUpDown.h"
|
||||||
|
|
||||||
|
uint8_t CliCmd_powerStateHelp(tCliCmd *cli) {
|
||||||
|
CliCmd_PrintLnStatic(cli, " access sub commands:");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ rmcStop ] - stop RMC nav thread");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ gsmUp ] - Enabled GSM network");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ gsmDown ] - Disabled GSM network");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ netPowerUp ] - Enabled power network subsystem");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ netPowerDown ] - Disabled power network subsystem");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ audioUp ] - Audio power is up");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ audioDown ] - Audio power is down");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ bipUp ] - block user interface is up");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ bipDown ] - block user interface is down");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ charUp ] - Charge battary is up");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ charDown ] - Charge battary is down");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ commIntDown ] - Command interface is down");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ fullUp ] - Full peref devise is upiing");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ fullDown ] - Full peref devise is down");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ exit ] - exit as this sub mode");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ pulMsd ] - set pul qwery of msd");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ getOfset ] - get this offset to distance");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ breakTest ] - direct exit is testing mode of distance");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ rmcStop ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ rmcStart ]");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ mndReq ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ ecallReq ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ setFulBacNum ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ updRemSostware ]");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ muteOn ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ muteOff ]");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ mupePOn ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ mupePOff ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ mupeNOn ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ muteNOff ]");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ ecallOutSignOn ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ ecallOutSignOff ]");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ serviseOutSignOn ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ serviseOutSignOff ]");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ getSosButtonState ]");
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ getServiseButtonState ]");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, " command [ shotDown ] - full shot down as system");
|
||||||
|
|
||||||
|
CliCmd_PrintLnStatic(cli, "");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"dep": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "Smart_Components_Aurus",
|
||||||
|
"repo": "CliCmd"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"Inc"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"Src/**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue