#include "AxisConfigDataManage.h"

AxisConfigStru g_szAxisData[AXIS_NUM_MAX] = { 0u };/*计轴器信息数组*/
UINT16 g_axisNum = 0;/*计轴器数量*/

/**
* @brief 获取计轴器数量
* @param 无
* @return 计轴器数量
*/
UINT16 GetAxleNum(void)
{
	return g_axisNum;
}

/**
* @brief 根据ID获取存储索引
* @param wId 编号
* @return 索引
*/
UINT16 GetAxisIndexById(UINT16 wId)
{
	UINT16 index = UINT16_MAX;

	if ((0u < wId) && (AXIS_NUM_MAX > wId))
	{
		index = wId;
	}
	else
	{
		;
	}

	return index;
}

/**
* @brief 根据ID获取公里标
* @param wId 编号
* @return 公里标
*/
UINT32 GetAxisKmById(UINT16 wId)
{
	UINT32 rtnValue = UINT32_MAX;
	UINT16 index = UINT16_MAX;

	index = GetAxisIndexById(wId);

	if (UINT16_MAX != index)
	{
		rtnValue = g_szAxisData[index].dwAxleKilo;
	}

	return rtnValue;
}

/**
* @brief 根据索引获取计轴器ID
* @param wIndex
* @return 计轴器ID
*/
UINT16 GetAxisIdByIndex(UINT16 wIndex)
{
	UINT16 rtnValue = 0u;

	if (wIndex < AXIS_NUM_MAX)
	{
		rtnValue = g_szAxisData[wIndex].wId;
	}

	return rtnValue;
}

/**
* @brief 根据ID获取计轴器所处link
* @param wId 编号
* @return 所处link编号
*/
UINT16 GetAxisLinkId(UINT16 wId)
{
	UINT16 rtnValue = UINT16_MAX;
	UINT16 index = UINT16_MAX;

	index = GetAxisIndexById(wId);

	if (UINT16_MAX != index)
	{
		rtnValue = g_szAxisData[index].wLkId;
	}
	else
	{
		;
	}

	return rtnValue;
}

/**
* @brief 根据ID获取计轴器所处link偏移量
* @param wId 编号
* @return 所处link偏移量
*/
UINT32 GetAxisOffsetById(UINT16 wId)
{
	UINT32 rtnValue = UINT32_MAX;
	UINT16 index = UINT16_MAX;

	index = GetAxisIndexById(wId);

	if (UINT16_MAX != index)
	{
		rtnValue = g_szAxisData[index].dwLkOfst;
	}
	else
	{
		;
	}

	return rtnValue;
}