From 21a11bdf0c2606780cf3f3983e21973e02376a57 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 27 Jul 2024 12:09:41 +0800 Subject: [PATCH] =?utf8?q?=E7=9B=B4=E6=8E=A5=E5=9C=A8ble=E6=9C=8D=E5=8A=A1?= =?utf8?q?=E4=B8=AD=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E9=85=8D=E5=AF=B9?= =?utf8?q?=E5=90=8C=E6=84=8F=EF=BC=88=E6=9C=AA=E5=BC=80=E5=90=AF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/bleservice/bleEvent.c | 51 ++++++++++++++++++- .../service/ble_service/bleservice/bleEvent.h | 2 +- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index e3033394e..34b67215f 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -958,6 +958,9 @@ void sendBindInfor(uint8_t *data) value[18] = Calculate_CRC(value,18); sendBleData(value,19); #ifdef SUPPORT_DEVICE_PAIRING_NOTIFICATION + #ifdef SUPPORT_A5133_SERVICE_BLE_PAIR + comfirmPaire(1); + #else devnamelen = 0; getPhoneNameLen(data,&devnamelen);//获取手机下发的手机设备名称长度 if(devnamelen > 0 ) @@ -995,6 +998,8 @@ void sendBindInfor(uint8_t *data) CustomEventPublish(TOPIC_EVENT_DEVICE_BIND,buf,2); } #endif + #endif + return; }else @@ -2224,6 +2229,47 @@ void SetAiResultCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u sendBleData(sendBuf,19); } } + +void SaveChatGPTCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue) +{ + uint32_t tmp = 1; + uint16_t tmp_data = 1; + uint8_t sendBuf[19]; + memset(sendBuf,0,19); + sendBuf[0] = 0x72; + sendBuf[1] = 0x02; + sendBuf[2] = 0x23; + memcpy(sendBuf+3,&tmp,4); + memcpy(sendBuf+7,&tmp,4); + memcpy(sendBuf+11,&tmp,4); + memcpy(sendBuf+15,&tmp_data,2); + // printf("GetWeatherCmd:len:%d data:%s\r\n",len,data); + if(Check_CRC(data,len,crcvalue)) + { + + FILE *fp= fopen("/user/userdata/chatGPTkey.bin","wb+"); + if(fp) + { + fwrite(data,1,len,fp); + fclose(fp); + sendBuf[17] = 1; + } + else + { + sendBuf[17] = 2; + } + + sendBuf[18] = Calculate_CRC(sendBuf,18); + sendBleData(sendBuf,19); + } + else + { + sendBuf[17] = 0; + sendBuf[18] = Calculate_CRC(sendBuf,18); + sendBleData(sendBuf,19); + } +} + void GetGPSCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue) { send_big_data(1,NULL,0,0,1,1,0x4f,2); @@ -2509,6 +2555,9 @@ void type2AE4Data(ble_read_data *buffer_handle,uint8_t *buf_cmd,uint8_t *data,ui case SYN_APP_GET_GPS_DATA_CMD://app获取GPS数据 GetGPSCmd(typeID,data,datalen,totalData,crcvalue); break; + case APP_SEND_CHATGPT_KEY_CMD: + + break; default: break; @@ -2534,7 +2583,7 @@ static void switchDialCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total { uint16_t daila_type = 0; memcpy(&daila_type,&data[0],2); - printf("switchDialCmd %d %s %d !!!!!!!!!!\r\n",daila_type,data,len); + printf("switchDialCmd %d !!!!!!!!!!\r\n",daila_type,data,len); ble_set_dial_by_id(daila_type); diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index b04903a91..3fc50357c 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -625,7 +625,7 @@ TYPE:02 #define SET_ALARM_DATA_CMD 0x0221 //发送闹钟数据 #define DELETE_FILE_CMD 0x0222 //删除指定文件 #define SYN_BASIC_REAL_HEATR_CMD 0x024B //同步基础训练试试心率记录 - +#define APP_SEND_CHATGPT_KEY_CMD 0x0223 //APP发送chatGPT key #define SYN_TODAY_BASIC_TRAIN_TXT_CMD 0x024D //同步当天任意时间之后的基础训练记录 #define SYN_APP_GET_GPS_DATA_CMD 0x024F //同步gps信息 -- 2.17.1