#include "UDS_19Service_Internal.h"

/**
  *获取该DTC数组下标
  *@param DTC
  *@return DTC数组下标
  */
uint8_t getDTCCount(uint32_t DTC)
{
    uint8_t DTCCount = 0u;
    #if(IC_Current == LD02)
    {
        for(DTCCount = 0u; DTCCount < (sizeof(DTCList) / sizeof(DTCList[0u])); ++DTCCount)
        {
            if(DTCList[DTCCount][0u] == DTC)
            {
                if(DTCList[DTCCount][1u] == 1u)
                {
                    break;
                } 
                else
                {
                    DTCCount = 0xFF;
                    break;
                }
            }
        }
    } 
    #else if(IC_Current == LD01) 
    {
        for(DTCCount = 0u; DTCCount < (sizeof(DTCList) / sizeof(DTCList[0u])); ++DTCCount)
        {
            if(DTCList[DTCCount][0u] == DTC)
            {
                if((DTCList[DTCCount][1u] == 1u) && (DTCCount != 10u) && (DTCCount != 7u))
                {
                    break;
                } 
                else
                {
                    DTCCount = 0xFF;
                    break;
                }
            }
        }
    }
    #endif
    return DTCCount;
}

/**
  *获取该DTC数组下标的DTC
  *@param DTCcount DTC数组下标
  *@return DTC
  */
uint32_t getDTCNumber(uint8_t DTCcount)
{
    return DTCList[DTCcount][0u];
}