#ifndef __AL_UART_VEHICLE_H__
#define __AL_UART_VEHICLE_H__

#include "al_basictypes.h"
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/file.h>
#include <termios.h>
#include <time.h>
#include <sys/ioctl.h>
#include "types.h"
#include "al_uart_vehicle_ctrl.h"
#include "al_console.h"

enum {
    UartA,
    UartB,
};

typedef enum {
    VEHICLE_SUCCESS,                 // successful outcome
    VEHICLE_ERR_FAILURE,             // operation failed
    VEHICLE_ERR_NULL_PARAM,          // null parameter
} Vehicle_Status_e;


typedef enum {
    VEHICLE_TASK_IDLE = 0,
    VEHICLE_TASK_SEND_MESAGE,
    VEHICLE_TASK_Standby,
} VehicleTaskStatus_t;


/*******************************************************************************
 * Constant
 ******************************************************************************/
#define VEHICLE_DAEMON_DELAY         	60


typedef struct Event_LinkList_Node_s {
    Vehicle_MessageBody_t stEvt;
    struct Event_LinkList_Node_s *pstNext;
} Event_LinkList_Node_t;

typedef struct Frame_LinkList_Node_s {
    struct Frame_LinkList_Node_s *pstNext;
} Frame_LinkList_Node_t;

typedef struct {
    Event_LinkList_Node_t *pstEvtList;
    Frame_LinkList_Node_t *pstFrmList;
} Vehicle_SendBuffer_t;

void Vehicle_Init(Vehicle_ModualCfg_t * pVehicle_ModualCfg);
void Al_Vehicle_Enable(void);
void Al_Vehicle_Disable(void);
void Al_Vehicle_Destory(void);
al_uint32 AL_Vehicle_getDecNumFromBCD(al_uint32 bcd);
al_uint32 AL_Vehicle_getBCDFromDecNum(al_uint32 num);
Vehicle_Status_e Vehicle_SendEvtToAp(Vehicle_MessageBody_t stEvt);
void Vehicle_sendCmdToModule(al_uint8 * str, int size);
pCON_DEV get_pVehicleCON_DEV(void);
al_uint8 AL_Vehicle_Get_UARTCmd_CheckSum(al_uint8 * cmdtable, int len);


#endif
