Init
This commit is contained in:
commit
5e3a58147f
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// Created by zemon on 09.09.24.
|
||||
//
|
||||
|
||||
#include "XfcProtTable.h"
|
||||
#include "ComIntThisSubSystem.h"
|
||||
#include "SystemSelector.h"
|
||||
|
||||
void XfcProtMethodsAdd_SybSystemInit(tXfcSybSystem *env, eSubSystems *subSystem){
|
||||
env->subSystem = subSystem;
|
||||
}
|
||||
|
||||
void XfcProtMethodsAdd_SybSystem(tXfcProtTable *protTab, tXfcSybSystem *XfcSybSystem){
|
||||
XfcProtTable_AddStatic(protTab, "GET_THIS_SUBSYSTEM", XfcProtMethod_ThisSubSystemGet, XfcSybSystem);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// Created by zemon on 09.09.24.
|
||||
//
|
||||
|
||||
#ifndef SMART_COMPONENTS_V2_COMINTTHISSUBSYSTEM_H
|
||||
#define SMART_COMPONENTS_V2_COMINTTHISSUBSYSTEM_H
|
||||
|
||||
#include "XfcArray.h"
|
||||
#include "XfcProtTable.h"
|
||||
#include "SystemSelector.h"
|
||||
|
||||
typedef struct {
|
||||
eSubSystems *subSystem;
|
||||
} tXfcSybSystem;
|
||||
|
||||
void XfcProtMethodsAdd_SybSystem(tXfcProtTable *protTab, tXfcSybSystem *XfcSybSystem);
|
||||
|
||||
void XfcProtMethodsAdd_SybSystemInit(tXfcSybSystem *env, eSubSystems *subSystem);
|
||||
|
||||
uint16_t XfcProtMethod_ThisSubSystemGet(tXfcArray *request, tXfcArray *response, tXfcSybSystem *XfcSybSystem);
|
||||
|
||||
|
||||
#endif //SMART_COMPONENTS_V2_COMINTTHISSUBSYSTEM_H
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#include <string.h>
|
||||
#include "ComIntThisSubSystem.h"
|
||||
#include "XfcArray.h"
|
||||
#include "XfcProtProcessorUtilDefines.h"
|
||||
|
||||
//
|
||||
// Created by zemon on 09.09.24.
|
||||
//
|
||||
uint16_t XfcProtMethod_GetThisSystem(tXfcArray *request, tXfcArray *response, tXfcSybSystem *env, char *paramValueID_text, uint8_t paramValueID_len) {
|
||||
// Текстовый вид ID
|
||||
XFC_CMD_TX_ADD_RAW(paramValueID_len);
|
||||
XFC_CMD_TX_ADD_ARR(paramValueID_text, paramValueID_len);
|
||||
|
||||
if (memcmp(paramValueID_text, "SUBSYSTEM", sizeof("SUBSYSTEM") - 1) == 0) {
|
||||
uint8_t len = 2;
|
||||
// Размер данных
|
||||
XFC_CMD_TX_ADD_RAW(len);
|
||||
// Данные
|
||||
uint16_t value = 0;
|
||||
if(*env->subSystem == UVEOS){
|
||||
value = 1;
|
||||
}
|
||||
if(*env->subSystem == TELEMATICA){
|
||||
value = 2;
|
||||
}
|
||||
XFC_CMD_TX_ADD_ARR(&value, len);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t XfcProtMethod_ThisSubSystemGet(tXfcArray *request, tXfcArray *response, tXfcSybSystem *env){
|
||||
|
||||
// Чтение всех параметров
|
||||
if (XfcArrayGetDataSize(request) == 0) {
|
||||
|
||||
uint16_t paramCount = 1;
|
||||
// Количество параметров
|
||||
XFC_CMD_TX_ADD_RAW(paramCount);
|
||||
|
||||
uint8_t paramValueID_len;
|
||||
char paramValueID_text[20];
|
||||
|
||||
paramValueID_len = sizeof("SUBSYSTEM") - 1;
|
||||
paramValueID_text[0] = '\0';
|
||||
strcat(paramValueID_text, "SUBSYSTEM");
|
||||
if (!XfcProtMethod_GetThisSystem(request, response, env, paramValueID_text, paramValueID_len)) {
|
||||
return XFC_TRANSPORT_PROTOCOL_RESPONSE_RESULT_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
return XFC_TRANSPORT_PROTOCOL_RESPONSE_RESULT_OK;
|
||||
}
|
||||
|
||||
// Чтение избранных параметров
|
||||
uint16_t paramCount;
|
||||
XFC_CMD_RX_GET_RAW(paramCount);
|
||||
|
||||
// Количество параметров
|
||||
XFC_CMD_TX_ADD_RAW(paramCount);
|
||||
|
||||
for (uint16_t count = 0; count < paramCount; ++count) {
|
||||
// Получение текстового id параметра
|
||||
uint8_t paramValueID_len;
|
||||
XFC_CMD_RX_GET_RAW(paramValueID_len);
|
||||
char paramValueID_text[paramValueID_len];
|
||||
XFC_CMD_RX_GET_ARR(paramValueID_text, paramValueID_len);
|
||||
|
||||
if(!XfcProtMethod_GetThisSystem(request, response, env, paramValueID_text, paramValueID_len)) {
|
||||
return XFC_TRANSPORT_PROTOCOL_RESPONSE_RESULT_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return XFC_TRANSPORT_PROTOCOL_RESPONSE_RESULT_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"./"
|
||||
],
|
||||
"srcs": [
|
||||
"./**.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue