#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_stb_ctrl.h"
#include "al_console.h"

enum {
    UartA,
    UartB,
};

typedef enum {
    STB_SUCCESS,                 // successful outcome
    STB_ERR_FAILURE,             // operation failed
    STB_ERR_NULL_PARAM,          // null parameter
} STB_Status_e;


typedef enum {
    STB_TASK_IDLE = 0,
    STB_TASK_SEND_MESAGE,
    STB_TASK_Standby,
} STBTaskStatus_t;


/*******************************************************************************
 * Constant
 ******************************************************************************/
#define STB_DAEMON_DELAY         	60


typedef struct Event_LinkList_Node_s {
    STB_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;
} STB_SendBuffer_t;

void STB_Init(STB_ModualCfg_t * pSTB_ModualCfg);
void Al_STB_Enable(void);
void Al_STB_Disable(void);
void Al_STB_Destory(void);
al_uint32 AL_STB_getDecNumFromBCD(al_uint32 bcd);
al_uint32 AL_STB_getBCDFromDecNum(al_uint32 num);
STB_Status_e STB_SendEvtToAp(STB_MessageBody_t stEvt);
void STB_sendCmdToModule(al_uint8 * str, int size);
pCON_DEV get_pSTBCON_DEV(void);
al_uint8 AL_STB_Get_UARTCmd_CheckSum(al_uint8 * cmdtable, int len);


#endif
