#ifndef __AL_BLUETOOTH_H__
#define __AL_BLUETOOTH_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_smart_ctrl.h"
#include "al_console.h"

enum {
    UartA,
    UartB,
};

typedef enum {
    SMART_SUCCESS,                 // successful outcome
    SMART_ERR_FAILURE,             // operation failed
    SMART_ERR_NULL_PARAM,          // null parameter
} Smart_Status_e;


typedef enum {
    SMART_TASK_IDLE = 0,
    SMART_TASK_SEND_MESAGE,
    SMART_TASK_Standby,
} SmartTaskStatus_t;


/*******************************************************************************
 * Constant
 ******************************************************************************/
#define SMART_DAEMON_DELAY         	60


typedef struct Event_LinkList_Node_s {
    Smart_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;
} Smart_SendBuffer_t;

void Smart_Init(Smart_ModualCfg_t * pSmart_ModualCfg);
void Al_Smart_Enable(void);
void Al_Smart_Disable(void);
void Al_Smart_Destory(void);
al_uint32 AL_Smart_getDecNumFromBCD(al_uint32 bcd);
al_uint32 AL_Smart_getBCDFromDecNum(al_uint32 num);
Smart_Status_e smart_SendEvtToAp(Smart_MessageBody_t stEvt);
void smart_sendCmdToModule(al_uint8 * str, int size);
pCON_DEV get_pSmartCON_DEV(void);
al_uint8 AL_Smart_Get_UARTCmd_CheckSum(al_uint8 * cmdtable, int len);


#endif
