12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #include "system.h"
- #include "app_client.h"
- #include "hal_ble_client.h"
- #include "hal_ble_host.h"
- #include "bsp_time.h"
- #include "hal_led.h"
- #include "ble_gap.h"
- #include "app_host.h"
- #include "app_flash.h"
- #include "app_client_step.h"
- #include "app_client_infomation.h"
- #include "app_client_dataupdate.h"
- //>> 0xA1: 查询
- void cb_BLE_Client_R_UPDATE(void* handle)
- {
- BLE_Client_Rx_t *target = handle;
- uint8_t _cmd = target->pDat[0];
- switch(_cmd){
- case BLE_Client_R_UPDATE_BASEINFO:{
- //>> 0(设备基本信息): 开始时间ms(8)
- //<< 0(子命令): 设备型号(64)+左鞋蓝牙地址(6)+硬件版本(2)+软件版本(2)+右鞋蓝牙地址(6)+硬件版本(6)+软件版本(2)
- //>> AA 06 F9 A1 00 4A
- //<< AA 55 AA A1 00 53 4D 41 52 54 20 53 48 4F 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C1 EB D0 E3 87 47 01 00 01 00 00 00 00 00 00 4F
- if(mFlash.isHost){
- if(1 != mFlash.mClient.isConfig) app_host_GetClientInfo(); //申请设备基本信息
- else app_client_infomation_Send();
- }
- else{
- app_client_infomation_Send();
- }
- break;}
- case BLE_Client_R_UPDATE_DATA:{
- //>> 1(设备数据)
- //<< 1(子命令): 左鞋电量(1)+左鞋温度(1)+左鞋压力(4)+左鞋步数(4)+右鞋电量(1)+右鞋温度(1)+右鞋压力(4)+右鞋步数(4)
- if(mFlash.isHost){
- app_host_GetClientData();
- }else{
- app_client_DataUpdate_Send();
- }
- break;}
- case BLE_Client_R_UPDATE_STEPNUM:{
- //>> 2(查询步数): 包序号[0全部](2)
- //<< 2(查询步数): +开始时间ms(8)+包的数量(2)+包序号(2)+每小时步数(4)+...
- app_client_SendStep(target);
- break;}
- case BLE_Client_R_UPDATE_STEPNUM_CLERA:{
- //>> 3(删除步数): 开始时间ms(8)+距离上一个整点的分钟数(1)
- //<< 3(删除步数): 开始时间ms(8)+距离上一个整点的分钟数(1)
- BLE_Client_Tx_Send(0,BLE_UPDATE,target->pDat,target->datLen);
- app_client_DeleteStep(target);
- break;}
- default:break;
- }
- }
- void app_client_Initialize(void)
- {
- BLE_Client_Rx_Regist(BLE_UPDATE,cb_BLE_Client_R_UPDATE);
- app_client_step_Initialize();
- }
|