123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #ifndef __hal_ble_client__
- #define __hal_ble_client__
- #include <stdbool.h>
- #include <stdint.h>
- #include <string.h>
- #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_Client_T_UPDATE
- BLE_Client_T_UPDATE_BASEINFO = 0, //设备基本信息
- BLE_Client_T_UPDATE_DATA , //设备数据
- BLE_Client_T_UPDATE_STEPNUM , //回复存储步数
- BLE_Client_T_UPDATE_STEPNUM_CLERA, //删除存储步数
- };
- enum { //BLE_Client_T_CHARGE
- BLE_Client_T_CHARGE_NONE = 0,
- BLE_Client_T_CHARGE_PULLOUT,
- BLE_Client_T_CHARGE_INSERT,
- BLE_Client_T_CHARGE_DONE,
- };
- /*************** 接收子命令 ********************/
- enum { //BLE_Client_R_UPDATE
- BLE_Client_R_UPDATE_BASEINFO = 0,
- BLE_Client_R_UPDATE_DATA ,
- BLE_Client_R_UPDATE_STEPNUM,
- BLE_Client_R_UPDATE_STEPNUM_CLERA,
- };
- enum { //BLE_Client_R_REALTIMESTEP
- BLE_Client_R_REALTIMESTEP_EXIT = 0, //实时计步退出
- BLE_Client_R_REALTIMESTEP_ENTER, //实时计步进入
- BLE_Client_R_REALTIMESTEP_HANDUP, //实时计步挂起
- };
- typedef void (*BLE_Client_Callback)(void*);
- typedef struct _BLE_Client_Rx{
- uint8_t cmd;
- uint8_t* pDat;
- uint8_t datLen;
- BLE_Client_Callback cb;
- }BLE_Client_Rx_t;
- typedef struct _BLE_Client_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_Client_Callback cb;
- struct _BLE_Client_Tx *next; //单向链表
- }BLE_Client_Tx_t;
- void BLE_Client_Initialize(void);
- void BLE_Client_Send(BLE_CMD_n cmd,unsigned char *pDat,unsigned char datLen);
- int BLE_Client_Rx_Regist(BLE_CMD_n cmd,BLE_Client_Callback cb);
- void BLE_Client_Tx_Send(BLE_Client_Tx_t* handle,BLE_CMD_n cmd,unsigned char *pDat,unsigned char datLen);
- void BLE_Client_Tx_Clear(BLE_Client_Tx_t* handle);
- void BLE_Client_Push(unsigned char* p,int len);
- #endif
|