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

enum {
    UartA,
    UartB,
};

typedef enum {
    BT_SUCCESS,                 // successful outcome
    BT_ERR_FAILURE,             // operation failed
    BT_ERR_NULL_PARAM,          // null parameter

} BT_Status_e;


typedef enum {
    BT_TASK_IDLE = 0,
    BT_TASK_SEND_MESAGE,
    BT_TASK_Standby,
} BTTaskStatus_t;


/*******************************************************************************
 * Constant
 ******************************************************************************/
#define BT_DAEMON_DELAY         	60


typedef struct BT_Event_LinkList_Node_s {
    BT_MessageBody_t stEvt;
    struct BT_Event_LinkList_Node_s *pstNext;
} BT_Event_LinkList_Node_t;

typedef struct BT_Frame_LinkList_Node_s {
    struct BT_Frame_LinkList_Node_s *pstNext;
} BT_Frame_LinkList_Node_t;

typedef struct {
    BT_Event_LinkList_Node_t *pstEvtList;
    BT_Frame_LinkList_Node_t *pstFrmList;
} BT_SendBuffer_t;

void BlueTooth_Init(BT_ModualCfg_t * pBT_ModualCfg);
void bluetooth_cmd_send(al_uint8 * str, al_uint size);
void bluetooth_upgrade_cmd_send(al_uint8 * str, al_uint size);
void Al_Bluetooth_Disable(void);
void Al_Bluetooth_Enable(void);
void Al_Bluetooth_Destory(void);
BT_Status_e _bt_SendEvt(BT_MessageBody_t stEvt);
pCON_DEV get_pBtCON_DEV(void);


#endif
