48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
//
|
|
// Created by xemon on 09.11.22.
|
|
//
|
|
|
|
#ifndef UVEOS_ON_NATION_SERIALBRIDGE_H
|
|
#define UVEOS_ON_NATION_SERIALBRIDGE_H
|
|
|
|
#include <memory.h>
|
|
#include "XfcProtProcessorUtilDefines.h"
|
|
#include "SerialPort.h"
|
|
|
|
typedef struct {
|
|
char *name;
|
|
uint8_t nameLength;
|
|
uint8_t flags;
|
|
tSerialPortIO *serialIo;
|
|
} tSerialBridge;
|
|
|
|
typedef struct {
|
|
uint16_t count;
|
|
uint16_t limit;
|
|
tSerialBridge *items;
|
|
} tSerialBridges;
|
|
|
|
|
|
void SerialBridges_Init(tSerialBridges *env, tSerialBridge *allocatedMem, uint16_t memCountLimit);
|
|
|
|
#define SerialBridges_InitStatic(ENV, MEM) SerialBridges_Init(ENV,MEM,sizeof(MEM)/sizeof(tSerialBridge));
|
|
|
|
bool SerialBridges_Add(tSerialBridges *env, char *staticStringName, uint8_t nameLen, tSerialPortIO *io);
|
|
|
|
#define SerialBridges_AddStatic(ENV, STR, IO) SerialBridges_Add(ENV,STR,sizeof(STR)-1,IO)
|
|
|
|
tSerialBridge *SerialBridges_GetForName(tSerialBridges *table, char *name, uint8_t nameLen);
|
|
|
|
|
|
///
|
|
void XfcProtMethodsAdd_SerialBridge(tXfcProtTable *protTab, tSerialBridges *bridges);
|
|
|
|
////Methods
|
|
uint8_t XfcProtMethod_SerialBridgeTable(tXfcArray *request, tXfcArray *response, tSerialBridges *env);
|
|
|
|
uint8_t XfcProtMethod_SerialBridgeReed(tXfcArray *request, tXfcArray *response, tSerialBridges *env);
|
|
|
|
uint8_t XfcProtMethod_SerialBridgeWrite(tXfcArray *request, tXfcArray *response, tSerialBridges *env);
|
|
|
|
#endif //UVEOS_ON_NATION_SERIALBRIDGE_H
|