GONEC_ARTERY_Modem_Main/Inc/ModemReceiveFunc.h

81 lines
3.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// Created by cfif on 21.02.23.
//
#ifndef GONEC_GSM_MODEMRECEIVEFUNC_C_H
#define GONEC_GSM_MODEMRECEIVEFUNC_C_H
#include <SerialPortIO.h>
#include <Gnss.h>
#include "ModemGonec.h"
#include "fs_interface.h"
#include "RtcIO.h"
#include "ModemGnss.h"
#include "httpd_types.h"
#include "file_logger.h"
#include "stdbool.h"
#include "stdlib.h"
#include "string.h"
#include "fs_base_func.h"
typedef enum {
RECV_OK = 0,
RECV_ERROR_CRC = 1,
RECV_ERROR= 2
} tReceiveBuildResult;
// Получение информации о принятых файлах
bool checkNumSentBox(tFs *fs, tRtcIO *rtc, uint32_t mnum, uint32_t from);
// Создание имени файла
void createFileNameForId(char *path, char *basePath, uint32_t id, char *ext);
// Создание имени файла
void createFileNameForId_REP_MSK_INF(char *pathRep, char *pathMsk, char *pathInf, char *basePath, uint32_t id);
// Создание имени файла из транспортного пакета
//void
//createFileFragInbox(char *path, uint32_t dateCreateTransportPacket, uint32_t numberSender, uint32_t numberMessage, char t, char *ext);
bool readRecvFileInfo(tFs *fs, tFileRecvInfo *fileRecvInfo, char *path_inf_fileName);
bool writeRecvFileInfo(tFs *fs, tFileRecvInfo *fileRecvInfo, char *path_inf_fileName);
bool readRepresentationRecvFileRep(tFs *fs, tStructRepresentationPacket *structRepresentationPacket,
char *path_dir_frag_inbox_fileName);
// Прием пакетов - Создание файлов
bool isReceivedCreate(tFs *fs, uint32_t mnum, uint32_t to, tStructTransportPacket *packet, uint8_t *buf, uint32_t buf_len,
char *path_dir_info_fileName, char *path_dir_mask_fileName, char *path_dir_frag_inbox_fileName, bool *isCrcUpdate);
// Прием пакетов - Добавление файлов
bool isReceivedAppend(tFs *fs, tStructTransportPacket *packet, uint8_t *buf, uint32_t buf_len,
char *path_dir_info_fileName, char *path_dir_mask_fileName, char *path_dir_frag_inbox_fileName, bool *isCrcUpdate);
// Сообщение принято целиком
bool isReceivedAll(tFs *fs, char *path_dir_info_fileName, char *path_dir_mask_fileName, bool *isAll);
bool Kvitin(tFs *fs, tRtcIO *rtcIo, uint32_t numberMessage, uint32_t numberSender,
char *path_dir_info_fileName, char *path_dir_mask_fileName, uint8_t *bufKvit, uint32_t *lenPacketKvit,
bool *isAll);
// Получение информации о принятых файлах квитанций
bool checkNumSentBoxKvitin(tFs *fs,
uint8_t *bufReceivedPacket,
uint32_t bufReceivedPacketLen,
uint32_t numberSender,
uint32_t numberMessage,
uint32_t dateCreateTransportPacketMon,
uint32_t dateCreateTransportPacketDay);
// Перенос собранного фрагментированного файла в хранилище принятых сообщений inbox
tReceiveBuildResult renameFromFrgToInBox(tFs *fs, tGonetsReedSalmon *gonetsReedSalmon, md5a_context *md5ctx, uint32_t idFile, tRtcIO *rtc, char *path_dir_info_fileName,
char *path_dir_frag_inbox_fileName, tLoggerInterface *logger);
tReceiveBuildResult
renameFromFrgToInBox5555(tFs *fs, tGonetsReedSalmon *gonetsReedSalmon, md5a_context *md5ctx, uint32_t idFile, tRtcIO *rtc,
char *path_dir_info_fileName,
char *path_dir_frag_inbox_fileName, tLoggerInterface *logger);
#endif //GONEC_GSM_MODEMRECEIVEFUNC_C_H