Files
TSCP/TSCP/src/APP/ciapp/CutoffPoint/CutoffPointDataManage.h
T

359 lines
9.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.
#ifndef _CUTOFPOINT_DATA_MANAGE_H_
#define _CUTOFPOINT_DATA_MANAGE_H_
#include "CutoffPointDefine.h"
#include "EnvelopeDefine.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
UINT16 wTrainId; /* 离分界点最近的列车ID */
UINT8 chTrainLevel; /* 离分界点最近的列车的运行级别 */
UINT32 dwDis; /* 离分界点最近的列车与分界点之间距离(cm) */
}CfpTrainInfoStru;
/** 定义与相邻TIOC接口使用的包络 */
typedef struct
{
UINT8 envelopeType; /* 包络类型 */
UINT16 headTrainID; /*包络前端列车ID*/
UINT16 tailTrainID; /*包络后端列车ID*/
LOD_STRU startPos; /*始端位置*/
LOD_STRU endPos; /*终端位置*/
UINT8 trianCnt; /*包络中包含的列车数量*/
UINT16 trainID[TRAIN_IN_ENVELOPE_SUM_MAX]; /*包络中包含的列车ID*/
UINT8 ACTPort[TRAIN_IN_ENVELOPE_SUM_MAX]; /*包络中列车激活端——解决UCT包络跨分界点无法RMM问题 */
UINT8 ACCnt; /*包含的AC数量*/
UINT16 ACID[SECTION_IN_ENVELOPE_SUM_MAX]; /*包含的AC ID*/
}CfpEnvelopeStruct;
/* 分界点通信列车 */
typedef struct
{
UINT16 wTrainId; /* 列车ID */
UINT8 chLevel; /* 列车运行级别 */
UINT32 dwDelay; /* TIOC与列车通信延时 */
UINT16 wSpeed; /* 列车速度 */
UINT8 chSpeedDir; /* 速度方向 */
UINT8 chTrainDir; /* 列车运行方向 */
UINT16 wMaxHeadLink; /* 列车最大安全前端link */
UINT32 dwMaxHeadOff; /* 列车最大安全前端偏移量 */
UINT16 wMinHeadLink; /* 列车最小安全前端link */
UINT32 dwMinHeadOff; /* 列车最小安全前端偏移量 */
UINT16 wMaxTailLink; /* 列车最大安全后端link */
UINT32 dwMaxTailOff; /* 列车最大安全后端偏移量 */
UINT16 wMinTailLink; /* 列车最小安全后端link */
UINT32 dwMinTailOff; /* 列车最小安全后端偏移量 */
}CfpCtTrainStruct;
/* 跨控区远程RM数据 */
typedef struct
{
UINT8 cRrmSrcRcId; /* 源RC ID */
UINT16 wRrmTrainId; /* RRM列车ID */
UINT16 wRrmTrainNextStaId; /* RRM列车申请的下一站台ID */
UINT8 chRrmSrcApplyState; /* 跨控区远程RM时,源TIOC申请状态 */
UINT8 chRrmDstAllowState; /* 跨控区远程RM时,目标TIOC允许状态 */
}CfpRRMDataStruct;
typedef struct
{
UINT16 wId; /* 分界点ID */
CfpTrainInfoStru otherTiocTrainInfo; /* 接收到的其他联锁的列车信息 */
CfpTrainInfoStru localTiocTrainInfo; /* 待发送到其他联锁的列车信息 */
UINT8 chLocalTiocEnvelopeNum; /* 待发送到其他联锁的包络数量 */
CfpEnvelopeStruct szLocalEnvelope[SECTION_REL_ENVELOPE_SUM_MAX]; /* 待发送到其他联锁的包络数量 */
UINT8 chOtherTiocEnvelopeNum; /* 接收到的其他联锁的包络数量 */
CfpEnvelopeStruct szOtherEnvelope[SECTION_REL_ENVELOPE_SUM_MAX]; /* 接收到的其他联锁的包络信息 */
UINT8 chCtNum; /* 分界点通信车数量 */
CfpCtTrainStruct szLocalCtTrain[TRAIN_SUM_MAX]; /* 分界点通信车信息 */
CfpRRMDataStruct szCfpRRMData; /* 分界点远程RM数据*/
UINT8 cSignalLightUpFlag; /*分界点信号机亮灯标志:0x55 亮灯标志无效;0xAA 亮灯标志有效*/
}CfpDataStru;
/*全局变量声明*/
extern CfpDataStru g_CutoffPointDataBuf[CUTOFF_POINT_SUM_MAX];
/*
* 功能描述: 分界点数据初始化
* 参数说明: 无
* 返回值 0: 设置失败
* 1: 设置成功
*/
UINT8 CutoffPointDataManageInit(void);
/**
* @brief 获取分界点相邻OC发来的列车信息
* @param wCfpId 分界点ID
* @return 列车信息
*/
CfpTrainInfoStru GetCfpOtherOcTrainInfo(const UINT16 wCfpId);
/**
* @brief 获取分界点本地OC发送的列车信息
* @param wCfpId 分界点ID
* @return 列车信息
*/
CfpTrainInfoStru GetCfpLocalOcTrainInfo(const UINT16 wCfpId);
/**
* @brief 设置分界点相邻OC发来的列车信息
* @param wCfpId 分界点ID trainInfo 列车信息
* @return 列车信息
*/
void SetCfpOtherOcTrainInfo(const UINT16 wCfpId, CfpTrainInfoStru trainInfo);
/**
* @brief 设置分界点本地OC发送的列车信息
* @param wCfpId 分界点ID trainInfo 列车信息
* @return 列车信息
*/
void SetCfpLocalOcTrainInfo(const UINT16 wCfpId, CfpTrainInfoStru trainInfo);
/*
* 功能描述: 分界点数据输出处理
* 参数说明: 无
* 返回值
*/
void CutoffPointOutput(void);
/**
* @brief 获取分界点相邻OC发来的包络数量
* @param wCfpId 分界点ID
* @return 包络数量
*/
UINT16 GetCfpOtherOcENum(const UINT16 wCfpId);
/**
* @brief 获取分界点相邻OC发来的包络存储地址
* @param wCfpId 分界点ID
* @return 包络存储地址
*/
CfpEnvelopeStruct * GetCfpOtherOcEData(const UINT16 wCfpId);
/**
* @brief 获取分界点发送给相邻OC的包络数量
* @param wCfpId 分界点ID
* @return 包络数量
*/
UINT8 GetCfpLocalOcENum(const UINT16 wCfpId);
/**
* @brief 获取分界点发送给相邻OC的包络存储地址
* @param wCfpId 分界点ID
* @return 包络存储地址
*/
CfpEnvelopeStruct * GetCfpLocalOcEData(const UINT16 wCfpId);
/**
* @brief 设置分界点相邻OC发来的包络数量
* @param wCfpId 分界点ID
* @param UINT16 wNum 包络数量
* @return 无
*/
void SetCfpOtherOcENum(const UINT16 wCfpId, const UINT16 wNum);
/**
* @brief 设置分界点相邻OC发来的包络数据
* @param wCfpId 分界点ID
* @param UINT8 chEnvelopeIndex 包络索引
* @param CfpEnvelopeStruct strEnvelope 包络数据
* @return 无
*/
void SetCfpOtherOcEData(const UINT16 wCfpId, const UINT8 chEnvelopeIndex, const CfpEnvelopeStruct strEnvelope);
/**
* @brief 设置分界点发送给相邻OC的包络数据
* @param wCfpId 分界点ID
* @return 无
*/
void SetCfpLocalOcEData(const UINT16 wCfpId);
/**
* @brief 获取相邻OC发来的包络
* @param UINT16 wOtherOc 相邻OC编号
* @param CfpEnvelopeStruct szEnvelope 包络数据
* @return 包络数量
*/
UINT8 GetOtherOcEnvelope(const UINT16 wOtherOc, CfpEnvelopeStruct szEnvelope[SECTION_REL_ENVELOPE_SUM_MAX * ONE_OTHER_CFP_SUM_MAX]);
/*
* 功能描述: 获取边界点数据存储地址
* 参数说明: 无
* 返回值 边界点数据存储地址
*/
CfpDataStru * GetCfpData(void);
/**
* @brief 设置分界点发送给相邻OC的通信列车数据
* @param wCfpId 分界点ID
* @return 无
* @note
*/
void SetCfpLocalOcCtData(const UINT16 wCfpId);
/**
* @brief 获取分界点发送给相邻OC的通信车地址
* @param wCfpId 分界点ID
* @return 通信车存储地址
*/
CfpCtTrainStruct * GetCfpLocalOcCtData(const UINT16 wCfpId);
/**
* @brief 获取分界点发送给相邻OC的通信车数量
* @param wCfpId 分界点ID
* @return 通信车数量
*/
UINT8 GetCfpLocalOcCtNum(const UINT16 wCfpId);
/**
* @brief 截取分界点相邻OC发来的包络数据
* @param wCfpId 分界点ID
* @param CfpEnvelopeStruct* strEnvelope 包络数据
* @return CI_ ERROR 截取失败
* CI_ SUCCESS 截取成功
* by cgh 20240111
*/
UINT8 CutCfpOtherOcEData(const UINT16 wCfpId,CfpEnvelopeStruct* strEnvelope);
/**
* @brief 获取分界点跨控区RRM源RC ID
* @param const UINT16 wCfpId 分界点ID
* @return 0 获取失败,其它 源RC ID
* Created By LQ 20240229
*/
UINT8 GetCfpRrmSrcRcId(const UINT16 wCfpId);
/**
* @brief 设置分界点跨控区RRM源RC ID
* @param wCfpId 分界点ID
* @param const UINT8 chSrcRcId 源RC ID
* @return 无
* Created By LQ 20240229
*/
void SetCfpRrmSrcRcId(const UINT16 wCfpId, const UINT8 chSrcRcId);
/**
* @brief 获取分界点跨控区RRM源TIOC申请状态
* @param wCfpId 分界点ID
* @return 跨控区RRM源TIOC申请状态
* by cgh 20240220
*/
UINT8 GetCfpRrmSrcApplyState(const UINT16 wCfpId);
/**
* @brief 设置分界点跨控区RRM源TIOC申请状态
* @param wCfpId 分界点ID
* @param const UINT8 chRrmSrcApplyState RRM源TIOC申请状态
* @return 无
* by cgh 20240221
*/
void SetCfpRrmSrcApplyState(const UINT16 wCfpId, const UINT8 chRrmSrcApplyState);
/**
* @brief 获取分界点跨控区RRM目标TIOC允许状态
* @param wCfpId 分界点ID
* @return 跨控区RRM目标TIOC允许状态
* by cgh 20240220
*/
UINT8 GetCfpRrmDstAllowState(const UINT16 wCfpId);
/**
* @brief 设置分界点跨控区RRM目标TIOC允许状态
* @param wCfpId 分界点ID
* @param const UINT8 chRrmSrcApplyState RRM目标TIOC允许状态
* @return 无
* by cgh 20240221
*/
void SetCfpRrmDstAllowState(const UINT16 wCfpId, const UINT8 chRrmDstAllowState);
/**
* @brief 获取分界点跨控区RRM列车ID
* @param wCfpId 分界点ID
* @return 跨控区RRM列车ID
* by cgh 20240221
*/
UINT16 GetCfpRrmTrainId(const UINT16 wCfpId);
/**
* @brief 设置分界点跨控区RRM列车ID
* @param wCfpId 分界点ID
* @param const UINT16 wRrmTrainId 跨控区RRM列车ID
* @return 无
* by cgh 20240221
*/
void SetCfpRrmTrainId(const UINT16 wCfpId, const UINT16 wRrmTrainId);
/**
* @brief 获取分界点跨控区RRM列车申请的下一站台ID
* @param wCfpId 分界点ID
* @return RRM列车申请的下一站台ID
* by cgh 20240221
*/
UINT16 GetCfpRrmTrainNextStaId(const UINT16 wCfpId);
/**
* @brief 设置分界点跨控区RRM列车申请的下一站台ID
* @param wCfpId 分界点ID
* @param const UINT16 wRrmTrainNextStaId RRM列车申请的下一站台ID
* @return 无
* by cgh 20240221
*/
void SetCfpRrmTrainNextStaId(const UINT16 wCfpId, const UINT16 wRrmTrainNextStaId);
/*
* 功能描述: 相邻TIOC通信良好,RRM处理
* 参数说明: UINT8 chTiocId 相邻TIOC编号
* 返回值
* by cgh 20240221
*/
void NeighborGoodRrmProc(UINT8 chTiocId);
/*
* 功能描述:根据分界点ID获取本分界点处的计轴区段ID
* 参数说明:UINT16 wCfpId 分界点ID
* UINT8 cAxisSecNum 计轴区段数量
* UINT16 pAxisSecIdBuf[CUTOFF_POINT_SUM_MAX] 计轴区段ID数组
* 返回值 CI_ERROR 0 获取失败
* 其它 计轴区段ID
* Created by LQ 20240227
*/
UINT16 GetAxisSecIdAccordCfpId(UINT16 wCfpId, UINT8 cAxisSecNum, UINT16 pAxisSecIdBuf[CUTOFF_POINT_SUM_MAX]);
/*
* 功能描述:分界点RRM数据清除处理
* 参数说明:const UINT16 wCutoffPointId 分界点ID
* 返回值 :无
* Created By LQ 2024.02.28
*/
void CutoffPointRRMDataClearPro(const UINT16 wCutoffPointId);
/**
* @brief 获取分界点信号机亮灯标志
* @param const UINT16 wCfpId 分界点ID
* @return 0x55 点亮标志无效
* 0xAA 点亮标志有效
* Created By LQ 2024.09.03
*/
UINT8 GetCfpSignalLightUpFlag(const UINT16 wCfpId);
/**
* @brief 设置分界点信号机亮灯标志
* @param const UINT16 wCfpId 分界点ID
* @param const UINT8 cLightUpFlag 亮灯标志
* @return 无
* Created By LQ 2024.09.03
*/
void SetCfpSignalLightUpFlag(const UINT16 wCfpId, const UINT8 cLightUpFlag);
#ifdef __cplusplus
}
#endif
#endif