#include "UDS_2FService_Internal.h"
#include "Telltales_user.h"
#include "Telltales_Lib.h"
//#include "SEG_DISPLAY.h"
//#include "Sound_List.h"
//#include "Sound_Player.h"
/**
  *蜂鸣器测试
  *@param ControlStatus 控制状态：0关闭解除控制，3强制控制
  *@param BuzzerStatus 蜂鸣器状态：0关闭蜂鸣器，FF开启蜂鸣器
  */
//uint8_t DIAG_Soundsts=0u;
//uint8_t DIAG_SoundPlaysts=0u;
//uint8_t DIAG_TelltalesCtrlsts=0u;
uint8_t DID3F80Flag = 0;
uint8_t DID3F81Flag = 0;
uint8_t DID3F82Flag = 0;
uint8_t DID3F83Flag = 0;
uint8_t DID3F84Flag = 0;
uint8_t DID3F85Flag = 0;

uint8_t Get_DIAG_Soundsts(void)//等于1时，有报警信号也不播放声音
{
    return DID3F85Flag;
}

void Set_DIAG_Soundsts(uint8_t Soundsts)
{
     DID3F85Flag = Soundsts;
}

void Set_DIAG_TelltalesCtrlsts(uint8_t n)
{
     DID3F80Flag = n;
}

uint8_t Get_DIAG_TelltalesCtrlsts(void)
{
     return DID3F80Flag;
}

void Set_DIAG_Vehicle_Speedsts(uint8_t n)
{
     DID3F81Flag = n;
}

uint8_t Get_DIAG_Vehicle_Speedsts(void)
{
     return DID3F81Flag;
}


void Set_DIAG_Engine_Speedsts(uint8_t n)
{
     DID3F82Flag = n;
}

uint8_t Get_DIAG_Engine_Speedsts(void)
{
     return DID3F82Flag;
}

void Set_DIAG_BACKLIGHTsts(uint8_t n)
{
     DID3F83Flag = n;
}

uint8_t Get_DIAG_BACKLIGHTsts(void)
{
     return DID3F83Flag;
}

void Set_DIAG_LCDsts(uint8_t n)
{
     DID3F84Flag = n;
}

uint8_t Get_DIAG_LCDsts(void)
{
     return DID3F84Flag;
}




void BuzzerTest(uint8_t ControlStatus, uint8_t BuzzerStatus)
{
    if(ControlStatus == 0x00u)
    {
        // Set_DIAG_Soundsts(0u);
        //BuzzerForceCtrlRelease();
    }
    if(ControlStatus == 0x03u)
    {
        // Set_DIAG_Soundsts(1u);
        //BuzzerForceCtrlRequest();
        if(BuzzerStatus == 0x00u)
        {
            // Set_DIAG_SoundPlaysts(0u);
            //BuzzerCtrlStopPlaying();
        }
        if(BuzzerStatus == 0xFFu)
        {
            // Set_DIAG_SoundPlaysts(1u);
           //BuzzerCtrlPlayBack();
        }
    }
}

/**
  *指针测试
  *@param ControlStatus 控制状态：0关闭解除控制，3强制控制
  *@param GaugeType 控制的指针类型：1车速，2转速，3燃油，4水温
  *@param GaugeStatus 控制的指针类型：0零刻度，1半刻度，2满刻度
  */
void GaugeTest(uint8_t ControlStatus, uint8_t GaugeType, uint8_t GaugeStatus)
{
    
}

/**
  *报警灯测试
  *@param ControlStatus 控制状态：0关闭解除控制，3强制控制
  *@param LampWarningStatus 报警灯状态：0关闭报警灯，FF开启报警灯
  */
void LampWarningTest(uint8_t ControlStatus, uint8_t LampWarningStatus)
{
    #if 0
    uint32_t i = 0u;
    if(ControlStatus == 0x00u)
    {
        for(i = 0u; i < LED_Max; ++i)
        {
            Telltales_DiagRelease(i);
        }
        Set_DIAG_TelltalesCtrlsts(0u);
    }
    if(ControlStatus == 0x03u)
    {
        Set_DIAG_TelltalesCtrlsts(1u);
        for(i = 0u; i < LED_Max; ++i)
        {
            if(LampWarningStatus == 0x00u)
            {
                Telltales_DiagCtrl(i, 0u);
                LED_Driver_Channel_Set(LED_Attr [ LED_TurnLeft_G ].chip, LED_Attr [ LED_TurnLeft_G ].channel, 0);
                SEG_SET_LED_STS(SEG_LED_TurnLeft, IC_SEG_OFF);
                LED_Driver_Channel_Set(LED_Attr [ LED_TurnRight_G ].chip, LED_Attr [ LED_TurnRight_G ].channel, 0);
                SEG_SET_LED_STS(SEG_LED_TurnRight, IC_SEG_OFF);
            }
            if(LampWarningStatus == 0xFFu)
            {
                Telltales_DiagCtrl(i, 1u);
                LED_Driver_Channel_Set(LED_Attr [ LED_TurnLeft_G ].chip, LED_Attr [ LED_TurnLeft_G ].channel, LED_Attr [ LED_TurnLeft_G ].brightness);
                SEG_SET_LED_STS(SEG_LED_TurnLeft, IC_SEG_ON);
                LED_Driver_Channel_Set(LED_Attr [ LED_TurnRight_G ].chip, LED_Attr [ LED_TurnRight_G ].channel, LED_Attr [ LED_TurnRight_G ].brightness);
                SEG_SET_LED_STS(SEG_LED_TurnRight, IC_SEG_ON);
            }
        }
    }
    #endif
}
