From 83739fd62eae9eced9b948d0816a2d3ab085ad5e Mon Sep 17 00:00:00 2001 From: cfif Date: Wed, 4 Dec 2024 13:10:47 +0300 Subject: [PATCH] Init --- DeviceDataRuntime.c | 43 +++++++++++++++++++++++++++++++++++++++++++ DeviceDataRuntime.h | 30 ++++++++++++++++++++++++++++++ modular.json | 17 +++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 DeviceDataRuntime.c create mode 100644 DeviceDataRuntime.h create mode 100644 modular.json diff --git a/DeviceDataRuntime.c b/DeviceDataRuntime.c new file mode 100644 index 0000000..26aae2c --- /dev/null +++ b/DeviceDataRuntime.c @@ -0,0 +1,43 @@ +// +// Created by xemon on 19.12.22. +// + +#include "DeviceDataRuntime.h" +#include "FirmwareMetadataSection.h" + +void DeviceDataRuntime_InitDefaults(tDeviceDataRuntime *env) { + env->enableGnssUpdate = true; + env->disallowWrite = 0; +} + + +#define ADD_VAR_SIZE(TYPE, NAME, VALUE, LEN, GROUP) \ + VariablesTableAdd( \ + variablesTable, \ + #NAME, \ + sizeof (#NAME)-1, \ + VARIABLE_TYPE_##TYPE, \ + (VALUE), \ + (LEN), \ + 0, \ + GROUP \ + ) + +#define ADD_VAR(TYPE, NAME, VALUE) ADD_VAR_SIZE(TYPE, NAME, VALUE, 0, VARIABLES_GROUP) +#define ADD_VAR_STR_OBJ(TYPE, NAME, VALUE) ADD_VAR_SIZE(TYPE, NAME, &(VALUE).data, &(VALUE).length,VARIABLES_GROUP) + +// Добавление переменных в таблицу +void DeviceDataRuntime_AddToVarTab( + tDeviceDataRuntime *env, + tVariablesTable *variablesTable, + uint32_t VARIABLES_GROUP +) { + ADD_VAR(BOOL, ENABLE_GNSS_UPDATE, &env->enableGnssUpdate); + + ADD_VAR_SIZE(STRING, DEV_VERSION, (void *) META_FW_NAME, (void *) &META_FW_NAME_SIZE, VARIABLES_GROUP); + VariablesTable_GetLast(variablesTable)->writeAttempts = &env->disallowWrite; +} + +#undef ADD_VAR_SIZE +#undef ADD_VAR +#undef ADD_VAR_STR_OBJ \ No newline at end of file diff --git a/DeviceDataRuntime.h b/DeviceDataRuntime.h new file mode 100644 index 0000000..ffbb139 --- /dev/null +++ b/DeviceDataRuntime.h @@ -0,0 +1,30 @@ +// +// Created by xemon on 19.12.22. +// + +#ifndef UVEOS_ON_NATION_DEVICEDATARUNTIME_H +#define UVEOS_ON_NATION_DEVICEDATARUNTIME_H + +#include +#include +#include + +typedef struct { + bool enableGnssUpdate; + uint16_t disallowWrite; + + bool EGTS_FLEET_ON; + bool telematicaServerIsActive; + bool telematicaCloseConnect; + bool telematicaWaitConnect; +} tDeviceDataRuntime; + +void DeviceDataRuntime_InitDefaults(tDeviceDataRuntime *env); + +void DeviceDataRuntime_AddToVarTab( + tDeviceDataRuntime *env, + tVariablesTable *variablesTable, + uint32_t VARIABLES_GROUP +); + +#endif //UVEOS_ON_NATION_DEVICEDATARUNTIME_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..f3e7d2b --- /dev/null +++ b/modular.json @@ -0,0 +1,17 @@ +{ + "dep": [ + { + "type": "git", + "provider": "NAVIGATOR_UVEOS_NATION_TELIT", + "repo": "VariablesTable" + } + ], + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "./**.c" + ] + } +} \ No newline at end of file