85 lines
1.7 KiB
C
85 lines
1.7 KiB
C
//
|
|
// Created by cfif on 04.10.2022.
|
|
//
|
|
|
|
#ifndef TEXTERNAL_H
|
|
#define TEXTERNAL_H
|
|
|
|
#include <SerialPortIO.h>
|
|
#include <DeviceStorageIni.h>
|
|
#include <Gnss.h>
|
|
#include "ModemMain.h"
|
|
#include "auth.h"
|
|
#include "file_logger.h"
|
|
|
|
#define lenHexCRC 4
|
|
|
|
typedef enum {
|
|
PROTOCOL_EXTERNAL = 0,
|
|
PROTOKOL_TELEMETRY = 1,
|
|
PROTOKOL_AMS_RADAR = 2,
|
|
PROTOKOL_LORA_WAN = 3
|
|
} tProtokolExternal;
|
|
|
|
typedef struct {
|
|
tSerialPortIO *io;
|
|
tDeviceStorageIni *store;
|
|
tFs *fs;
|
|
tModemMain *modemMain;
|
|
tRtcIO *rtcIo;
|
|
|
|
struct {
|
|
uint8_t modemRx[1024];
|
|
uint8_t modemTx[1024];
|
|
} mem;
|
|
|
|
tAtCmd externalAt;
|
|
uint32_t count;
|
|
uint32_t countPack;
|
|
uint32_t stepTimeSecond;
|
|
|
|
uint16_t sensorA;
|
|
uint16_t sensorB;
|
|
uint8_t sensorExt[16];
|
|
|
|
tLoggerInterface *logger;
|
|
|
|
struct {
|
|
osThreadId_t id;
|
|
uint32_t stack[2048];
|
|
StaticTask_t controlBlock;
|
|
osThreadAttr_t attr;
|
|
} thread;
|
|
|
|
uint32_t left;
|
|
char *bufAnswer;
|
|
char fileNameContent[128];
|
|
bool isContentFile;
|
|
|
|
|
|
struct {
|
|
int paramcount;
|
|
char *params_names[MAX_POST_GET_PARAMETERS];
|
|
char *params_vals[MAX_POST_GET_PARAMETERS];
|
|
} params_post_uri;
|
|
|
|
osMutexId_t sensorAccess;
|
|
|
|
} tExternal;
|
|
|
|
void getSensorAbExt(tExternal *env, uint16_t *sensorA, uint16_t *sensorB, uint8_t *sensorExt);
|
|
|
|
void ReInitExternalProtocol(tExternal *env);
|
|
|
|
void External_Init(tExternal *env,
|
|
tSerialPortIO *io,
|
|
tDeviceStorageIni *store,
|
|
tFs *fs,
|
|
tRtcIO *rtcIo,
|
|
tModemMain *modemMain);
|
|
|
|
void External_StartThread(tExternal *env);
|
|
|
|
|
|
#endif //TEXTERNAL_H
|