#ifndef __hal_BLE_Host__ #define __hal_BLE_Host__ #include #include #include #include "sdk_common.h" #include "SEGGER_RTT.h" #include "usr_config.h" #include "hal_ble_common.h" #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif /*************** 发送子命令 ********************/ enum { //BLE_Host_T_UPDATE BLE_Host_T_UPDATE_BASEINFO = 0, //设备基本信息 BLE_Host_T_UPDATE_DATA , //设备数据 BLE_Host_T_UPDATE_STEPNUM , //回复存储步数 BLE_Host_T_UPDATE_STEPNUM_CLERA, //删除存储步数 }; enum { //BLE_Host_T_CHARGE BLE_Host_T_CHARGE_NONE = 0, BLE_Host_T_CHARGE_PULLOUT, BLE_Host_T_CHARGE_INSERT, BLE_Host_T_CHARGE_DONE, BLE_Host_T_CHARGE_ERROR, }; /*************** 接收子命令 ********************/ enum { //BLE_Host_R_UPDATE BLE_Host_R_UPDATE_BASEINFO = 0, BLE_Host_R_UPDATE_DATA , BLE_Host_R_UPDATE_STEPNUM, BLE_Host_R_UPDATE_STEPNUM_CLERA, }; typedef void (*BLE_Host_Callback)(void*); typedef struct _BLE_Host_Rx{ uint8_t cmd; uint8_t* pDat; uint8_t datLen; BLE_Host_Callback cb; }BLE_Host_Rx_t; typedef struct _BLE_Host_Tx{ uint8_t n; uint32_t t; uint8_t ncnt; uint32_t tcnt; BLE_CMD_n cmd; uint8_t* pDat; uint8_t datLen; uint8_t holdon; BLE_Host_Callback cb; struct _BLE_Host_Tx *next; //单向链表 }BLE_Host_Tx_t; void BLE_Host_Initialize(void); void BLE_Host_Send(BLE_CMD_n cmd,unsigned char *pDat,unsigned char datLen); int BLE_Host_Rx_Regist(BLE_CMD_n cmd,BLE_Host_Callback cb); void BLE_Host_Tx_Send(BLE_Host_Tx_t* handle,BLE_CMD_n cmd,unsigned char *pDat,unsigned char datLen); void BLE_Host_Tx_Clear(BLE_Host_Tx_t* handle); void BLE_Host_Push(unsigned char* p,int len); #endif