From: DXY <1731678236@qq.com> Date: Mon, 6 May 2024 07:48:56 +0000 (+0800) Subject: 获取其他目标协议和UI对接已完成 X-Git-Tag: release_V1.2.70_20241020_135402~1108^2~20 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=b2c7bbd8d06d19027ce2d4e9332a65678a1acf61;p=mirrors%2FFD230.git 获取其他目标协议和UI对接已完成 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h b/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h index ed37cf36b..ea6021048 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h @@ -78,6 +78,9 @@ namespace OHOS CONFIFMOFEL_ITEM_HEARTRATE_DETECTED,//心率周期频率 0(关闭) 1 5 10 CONFIFMOFEL_ITEM_HEARTRATE_MAX,//最大心率 CONFIFMOFEL_ITEM_HEARTRATE_MIN,//最小心率 + + CONFIFMOFEL_ITEM_NOTIFY,//消息通知开关 + CONFIGMODEL_ITEM_MAX, } ; diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 05014b1b2..5ded21a2e 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -200,7 +200,16 @@ int get_goal_stepcount(void) OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT); } - +int get_goal_caloriescount(void)//获取运动目标卡路里 +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES); +} +int get_goal_discount(void)//获取运动目标卡路里 +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE); +} int get_vibrationremiander(void) { OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); @@ -220,6 +229,56 @@ void set_goal_stepcount(uint32_t step) p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT,step); return ; } +void set_goal_caloriescount(uint32_t kcal) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + + p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES,kcal); + return ; +} +void set_notify_switch(uint8_t on) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + + p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIFMOFEL_ITEM_NOTIFY,on); + return ; +} +bool get_notify_switch(void) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIFMOFEL_ITEM_NOTIFY); +} +void set_goal_discount(uint32_t dis) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + + p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE,dis); + return ; +} +void set_goal_durationcount(uint32_t time) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + + p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION,time); + return ; +} +int get_goal_durationcount(void) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION); +} +void set_goal_standupcount(uint32_t time) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + + p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES,time); + return ; +} +int get_goal_standupcount(void) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES); +} void set_vibrationremiander(uint8_t falg) { @@ -455,7 +514,7 @@ void read_message_data(void) memset(message_infor_s.message_t[i].title,0,TITLE_BUF_LEN); } - printf("message_infor_s.message_t[i].title:%s",message_infor_s.message_t[i].title); + // printf("message_infor_s.message_t[i].title:%s",message_infor_s.message_t[i].title); if(strlen(msg_buf->valuestring) != 0) { @@ -463,7 +522,7 @@ void read_message_data(void) }else{ memset(message_infor_s.message_t[i].msg,0,MSG_BUF_LEN); } - printf("message_infor_s.message_t[count - 1- i].msg:%s",message_infor_s.message_t[i].msg); + // printf("message_infor_s.message_t[count - 1- i].msg:%s",message_infor_s.message_t[i].msg); message_infor_s.message_t[i].time = time->valueint; message_infor_s.message_t[i].hasCode = hasCode->valueint; message_infor_s.message_t[i].read = read_t->valueint; @@ -471,10 +530,10 @@ void read_message_data(void) } } } - printf("message_infor_s.num%d\r\n",message_infor_s.num); //2 1 0 + // printf("message_infor_s.num%d\r\n",message_infor_s.num); //2 1 0 for(uint8_t i = message_infor_s.num-1;i > 0 ;i--) { - printf("message_infor_s:title %s msg :%s\r\n",message_infor_s.message_t[i].title,message_infor_s.message_t[i].msg); + // printf("message_infor_s:title %s msg :%s\r\n",message_infor_s.message_t[i].title,message_infor_s.message_t[i].msg); } } message_infor_t *get_message_info(void) diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h index 72ea3a236..5d663009d 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -134,6 +134,20 @@ void set_traning_updata_freq(uint8_t freq); /*设置训练最高心率*/ void set_traning_heart_max(uint8_t data); +void set_goal_caloriescount(uint32_t kcal);//设置目标卡路里 +int get_goal_caloriescount(void);//获取目标卡路里 + +void set_goal_discount(uint32_t dis);//设置目标里程 +int get_goal_discount(void);//获取目标里程 + +void set_notify_switch(uint8_t on);//设置消息通知开关 +bool get_notify_switch(void);//获取消息通知开关 + +void set_goal_durationcount(uint32_t time);//设置目标燃脂时间 +int get_goal_durationcount(void);//获取目标燃脂时间 + +void set_goal_standupcount(uint32_t time);//设置目标战立次数 +int get_goal_standupcount(void);//获取目标站立次数 #ifdef __cplusplus #if __cplusplus } 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 9de5c8936..4e6fffb47 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -1368,7 +1368,51 @@ void GetTarinTarget(uint16_t cmd,uint8_t *crcnum,uint16_t len,uint8_t *totalData } - +static void GetOtherTarget(uint16_t cmd,uint8_t *crcnum,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] = 0x17; + memcpy(sendBuf+3,&tmp,4); + memcpy(sendBuf+7,&tmp,4); + memcpy(sendBuf+11,&tmp,4); + memcpy(sendBuf+15,&tmp_data,2); + + if(Check_CRC(crcnum,len,crcvalue)) + { + // 73 2 17 1 0 0 0 8 0 0 0 1 0 0 0 8 0 2c 1 a 8 1e 1 1 1 2 + + uint16_t target_kcal = crcnum[0]+crcnum[1]*256;//目标卡路里 + uint8_t target_km = crcnum[2];//目标里程 + uint8_t target_stand = crcnum[3];//目标站立 + uint8_t target_fattime = crcnum[4];//目标燃脂 + uint8_t ring = crcnum[5];//铃声 + uint8_t vibratior = crcnum[6];//振动 + uint8_t notify = crcnum[7];//通知 + + set_goal_caloriescount(target_kcal); + set_goal_discount(target_km); + set_goal_standupcount(target_stand); + set_goal_durationcount(target_fattime); + set_SilentMode(ring); + set_vibrationremiander(vibratior); + set_notify_switch(notify); + sendBuf[17] = 1; + sendBuf[18] = Calculate_CRC(sendBuf,18); + sendBleData(sendBuf,19); + } + else + { + sendBuf[17] = 0; + sendBuf[18] = Calculate_CRC(sendBuf,18); + sendBleData(sendBuf,19); + } + +} static void jsonCheck_alarm(uint8_t *buf)//json 解析闹钟数据 { uint8_t *json; @@ -2012,6 +2056,9 @@ void type2AE4Data(uint8_t *buf_cmd,uint8_t *data,uint16_t datalen,uint8_t *total GetAlarmDataCmd(typeID,data,datalen,totalData,crcvalue); printf("alarm infor !!!!!!!!!!\r\n"); break; + case SET_OTHER_TARGET_CMD: + GetOtherTarget(typeID,data,datalen,totalData,crcvalue); + break; case DELETE_FILE_CMD: break; case SYN_BASIC_REAL_HEATR_CMD: @@ -2193,7 +2240,7 @@ static void aboutDeviceCmd(uint16_t cmd,uint8_t *crcnum,uint16_t len,uint8_t *to memcpy(value+17,(uint8_t *)json_format,data_len);//17+69 = 86 free(json_format); value[data_len+17] = Calculate_CRC(value,data_len+17);// - printf("data_len:%d %x %d!!!!!\r\n",data_len,value[data_len+17],data_len+17); + // printf("data_len:%d %x %d!!!!!\r\n",data_len,value[data_len+17],data_len+17); sendBleData(value,data_len+18); }else { @@ -3345,13 +3392,21 @@ static void GetTargetOtherCmd(uint16_t cmd,uint8_t *crcnum,uint16_t len,uint8_t memcpy(value+15,&tmp_data,2); if(1) { - uint16_t targetKcal = 4556;//目标卡路里 + uint16_t targetKcal = 0;//目标卡路里 uint8_t targetKm = 0;//目标里程 uint8_t targetstand = 0;//目标站立 uint8_t targetfat = 0;//目标燃脂时间 uint8_t ringTime = 0;//铃声提醒 uint8_t vibration = 0;//振动提醒 uint8_t notify = 0;//通知提醒 + + targetKcal = get_goal_caloriescount(); + targetKm = get_goal_discount(); + targetstand =get_goal_standupcount(); + targetfat = get_goal_durationcount(); + ringTime = get_SilentMode(); + vibration = get_vibrationremiander(); + notify = get_notify_switch(); memcpy(&value[17],&targetKcal,2);//目标卡路里 value[19] = targetKm;// value[20] = targetstand;// 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 1e5e622a8..8d818dc56 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -513,6 +513,7 @@ TYPE:02 #define SET_WATCH_SPO2_SET_PARAM_CMD 0x0213 //app发送血氧设置参数 #define SET_DRINK_PARAM_CMD 0x0214 //app发送喝水提醒设置 #define SET_STEP_TARGET_CMD 0x0216 //app发送步数目标 +#define SET_OTHER_TARGET_CMD 0x0217 //app发送其他目标 #define SET_WEATHER_DATA_CMD 0x0220 //发送天气数据 #define SET_ALARM_DATA_CMD 0x0221 //发送闹钟数据 #define DELETE_FILE_CMD 0x0222 //删除指定文件