#ifndef _TELLTALES_H_
#define _TELLTALES_H_

#include "TYW_stdint.h"
#include "string.h"
#include "RTE_BASE_TYPE.h"

typedef enum
{
    /* 0*/em_LED_INTER_DIFF_LOCK_T,
    /* 1*/em_LED_FOUR_MUL_FOUR_T,
    /* 2*/em_LED_EXH_BRAKE_T,
    /* 3*/em_LED_QOS_GLOW_T,
    /* 4*/em_LED_HI_BEAM_T,
    /* 5*/em_LED_Rr_FOG_LAMP_T,
    /* 6*/em_LED_MIL_T,
    /* 7*/em_LED_SVS_T,
    /* 8*/em_LED_H_S_A__T,
    /* 9*/em_LED_RETARDER_T,
    /*10*/em_LED_AUTO_LEVELING_T,
    /*11*/em_LED_ROWS_L,
    /*12*/em_LED_BSM_OFF_L,
    /*13*/em_LED_AEBS_OFF_L,
    /*14*/em_LED_LDWS_L,
    /*15*/em_LED_SRS_L,
    /*16*/em_LED_ENG_OIL_L,
    /*17*/em_LED_CHARG_L,
    /*18*/em_LED_SEAT_BELT_L,
    /*19*/em_LED_RR_DIFF_LOCK_L,
    /*20*/em_LED_TPMS_L,
    /*21*/em_LED_ASR_or_EVSC_OFF_L,
    /*22*/em_LED_EVSC_L,
    /*23*/em_LED_eco_stop_OFF_L,
    /*24*/em_LED_AMT_L,
    /*25*/em_LED_WEAR_IND_L,
    /*26*/em_LED_TRAILER_BRAKE_R,
    /*27*/em_LED_BRAKE_AIR_or_EBS_YELLOW_R,
    /*28*/em_LED_ACC_AIR_R,
    /*29*/em_LED_ABS_R,
    /*30*/em_LED_PARK_BRAKE_R,
    /*31*/em_LED_BRAKE_AIR_or_EBS_RED_R,
    /*32*/em_LED_BRAKE_LOCK_R,
    /*33*/em_LED_AIR_SUS_R,
    /*34*/em_LED_TRAILER_ABS_U,
    /*35*/em_LED_WORKING_LAMP_U,
    /*36*/em_LED_TRAILER_ABS_INFO_U,
    /*37*/em_LED_TEMP,
    /*38*/em_LED_FUEL,

    LED_Max,
} LED_Idx_t;

typedef uint8_t (*LED_Judgment)(void);
typedef void (*LED_Execution)(uint8_t led_status);

typedef struct
{
    LED_Idx_t LED_Index;
    SelfCheck_t isSelfCheck;
    ExtCheck_t isExCheck;
    WorkStatus_t WorkSts;

    uint32_t CheckStart;
    uint32_t CheckEnd;

    LED_Judgment LED_Judgment_Cbk;
    LED_Execution LED_Execution_Cbk;
} LED_Attribute_st;

typedef struct
{
    PowerStatus_t IG_Status;
    Checktatus_t LED_CheckFinish;
    uint32_t IG_ON_Timer;
    uint32_t IG_OFF_Timer;
} ExternalPara_st;

typedef struct
{
    uint8_t LastLeft;
    uint8_t LastRight;
    uint8_t Delay;
} TelltaleLRCtrlStruct;

extern const LED_Attribute_st LED_Attribute[LED_Max];

void Telltales_SetPara(ExternalPara_st *Para);
void Telltales_Management(void); /*50ms*/
void Telltales_Left_Right_KL30_Init(void);
void Telltales_Left_Right_Management_Service(void); /*must put into 10ms task*/
void Telltales_IG_ON_Work(void);
void Telltales_IGOFF_Work(void);
void Test_LED_AllLight(void);

void Telltales_Wakeup_Init(void);
void Telltales_KL30_Init(void);
void Telltales_KL15_Init(void);

void LED_RIGHT_G_Execution(uint8_t led_status);
void LED_LEFT_G_Execution(uint8_t led_status);
uint8_t LED_RIGHT_G_Judgement(void);
uint8_t LED_LEFT_G_Judgement(void);

void Write_LED_POSITION_G(uint8_t led_status);
uint8_t GET_LED_POSITION_G(void);

void Write_LED_READY_G_Execution(uint8_t led_status);
uint8_t GET_LED_READY_G_Execution(void);

/*LED点灯条件判别函数*/
uint8_t LED_INTER_DIFF_LOCK_T_Judgement(void);
uint8_t LED_FOUR_MUL_FOUR_T_Judgement(void);
uint8_t LED_EXH_BRAKE_T_Judgement(void);
uint8_t LED_QOS_GLOW_T_Judgement(void);
uint8_t LED_HI_BEAM_T_Judgement(void);
uint8_t LED_Rr_FOG_LAMP_T_Judgement(void);
uint8_t LED_MIL_T_Judgement(void);
uint8_t LED_SVS_T_Judgement(void);
uint8_t LED_H_S_A_T_Judgement(void);
uint8_t LED_RETARDER_T_Judgement(void);
uint8_t LED_AUTO_LEVELING_T_Judgement(void);
uint8_t LED_ROWS_L_Judgement(void);
uint8_t LED_BSM_OFF_L_Judgement(void);
uint8_t LED_AEBS_OFF_L_Judgement(void);
uint8_t LED_LDWS_L_Judgement(void);
uint8_t LED_SRS_L_Judgement(void);
uint8_t LED_ENG_OIL_L_Judgement(void);
uint8_t LED_CHARG_L_Judgement(void);
uint8_t LED_SEAT_BELT_L_Judgement(void);
uint8_t LED_RR_DIFF_LOCK_L_Judgement(void);
uint8_t LED_TPMS_L_Judgement(void);
uint8_t LED_ASR_or_EVSC_OFF_L_Judgement(void);
uint8_t LED_EVSC_L_Judgement(void);
uint8_t LED_eco_stop_OFF_L_Judgement(void);
uint8_t LED_AMT_L_Judgement(void);
uint8_t LED_WEAR_IND_L_Judgement(void);
uint8_t LED_TRAILER_BRAKE_R_Judgement(void);
uint8_t LED_BRAKE_AIR_or_EBS_YELLOW_R_Judgement(void);
uint8_t LED_ACC_AIR_R_Judgement(void);
uint8_t LED_ABS_R_Judgement(void);
uint8_t LED_PARK_BRAKE_R_Judgement(void);
uint8_t LED_BRAKE_AIR_or_EBS_RED_R_Judgement(void);
uint8_t LED_BRAKE_LOCK_R_Judgement(void);
uint8_t LED_AIR_SUS_R_Judgement(void);
uint8_t LED_TRAILER_ABS_U_Judgement(void);
uint8_t LED_WORKING_LAMP_U_Judgement(void);
uint8_t LED_TRAILER_ABS_INFO_U_Judgement(void);
uint8_t LED_Temp_Judgement(void);
uint8_t LED_Fuel_Judgement(void);

/*LED执行函数*/
void LED_Left_Right_Execution(uint8_t led_status);
void LED_INTER_DIFF_LOCK_T_Execution(uint8_t led_status);
void LED_FOUR_MUL_FOUR_T_Execution(uint8_t led_status);
void LED_EXH_BRAKE_T_Execution(uint8_t led_status);
void LED_QOS_GLOW_T_Execution(uint8_t led_status);
void LED_HI_BEAM_T_Execution(uint8_t led_status);
void LED_Rr_FOG_LAMP_T_Execution(uint8_t led_status);
void LED_MIL_T_Execution(uint8_t led_status);
void LED_SVS_T_Execution(uint8_t led_status);
void LED_H_S_A_T_Execution(uint8_t led_status);
void LED_RETARDER_T_Execution(uint8_t led_status);
void LED_AUTO_LEVELING_T_Execution(uint8_t led_status);
void LED_ROWS_L_Execution(uint8_t led_status);
void LED_BSM_OFF_L_Execution(uint8_t led_status);
void LED_AEBS_OFF_L_Execution(uint8_t led_status);
void LED_LDWS_L_Execution(uint8_t led_status);
void LED_SRS_L_Execution(uint8_t led_status);
void LED_ENG_OIL_L_Execution(uint8_t led_status);
void LED_CHARG_L_Execution(uint8_t led_status);
void LED_SEAT_BELT_L_Execution(uint8_t led_status);
void LED_RR_DIFF_LOCK_L_Execution(uint8_t led_status);
void LED_TPMS_L_Execution(uint8_t led_status);
void LED_ASR_or_EVSC_OFF_L_Execution(uint8_t led_status);
void LED_EVSC_L_Execution(uint8_t led_status);
void LED_eco_stop_OFF_L_Execution(uint8_t led_status);
void LED_AMT_L_Execution(uint8_t led_status);
void LED_WEAR_IND_L_Execution(uint8_t led_status);
void LED_TRAILER_BRAKE_R_Execution(uint8_t led_status);
void LED_BRAKE_AIR_or_EBS_YELLOW_R_Execution(uint8_t led_status);
void LED_ACC_AIR_R_Execution(uint8_t led_status);
void LED_ABS_R_Execution(uint8_t led_status);
void LED_PARK_BRAKE_R_Execution(uint8_t led_status);
void LED_BRAKE_AIR_or_EBS_RED_R_Execution(uint8_t led_status);
void LED_BRAKE_LOCK_R_Execution(uint8_t led_status);
void LED_AIR_SUS_R_Execution(uint8_t led_status);
void LED_TRAILER_ABS_U_Execution(uint8_t led_status);
void LED_WORKING_LAMP_U_Execution(uint8_t led_status);
void LED_TRAILER_ABS_INFO_U_Execution(uint8_t led_status);
void LED_Temp_Execution(uint8_t led_status);
void LED_Fuel_Execution(uint8_t led_status);

#endif
