From: Caisking Date: Wed, 15 Oct 2025 02:37:08 +0000 (+0800) Subject: 增加app发起运动log X-Git-Tag: V1.0.9_20251128_194606_LN~212^2~24 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=0baa0463d33efa706205bcdda918f1705338a831;p=mirrors%2FFD230.git 增加app发起运动log --- diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp index 1485333d7..0fff18fa6 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingModel.cpp @@ -292,7 +292,7 @@ int TraingModel::GetBleSportId(Exercisetype sporttype, UIResourceTextId id) { offset = 0; break; } - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " offset %d id %d", offset, id); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "编译id offset %d id %d", offset, id); return id - offset; } @@ -780,7 +780,15 @@ void TraingModel::SetTimestamp() { Startstate = true; Endstate = false; // 确保"开始"和"结束"状态互斥 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开始运动"); + //打印目前运动配置项 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "*******************************"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开始运动"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sportType:%d", sportdata->sportType); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sportId:%d", sportdata->sportId); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sportTagType:%d", sportdata->sportTagType); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sportTag:%d", sportdata->tag); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "*******************************"); + sport_start_data_timer(300); //开启数据获取定时器 刷新频率是300ms @@ -1395,8 +1403,7 @@ bool TraingModel::SaveSportData() { Trainingdata data; data.src = Openingway; data.bt = static_cast(sportdata->sportType); - data.ty = static_cast( - GetBleSportId(sportdata->sportType, sportdata->sportId)); + data.ty = static_cast(GetBleSportId(sportdata->sportType, sportdata->sportId)); data.st = static_cast(sportdata->starttime); data.sp = static_cast(sportdata->endtime); data.tgt = static_cast(sportdata->sportTagType); @@ -3142,7 +3149,7 @@ static void gnss_timer_callbackProc(int data) { if (gps_timer_count == 2) { #if defined(SUPPORT_GNSS) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开启gps"); - gnss_start(); + // gnss_start(); #endif } #if defined(SUPPORT_GNSS) @@ -3515,8 +3522,30 @@ char *struct_to_json_buf_malloc_(uint8_t day) { cJSON_AddNumberToObject(itemJSON, "spc", data->spc); cJSON_AddNumberToObject(itemJSON, "std", data->std); cJSON_AddNumberToObject(itemJSON, "cdc", data->cdc); - cJSON_AddItemReferenceToArray(data_arryJSON, itemJSON); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"*******************************"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"src:%d",data->src); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"bt:%d",data->bt); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ty:%d",data->ty); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"st:%d",data->st); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"sp:%d",data->sp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"tgt:%d",data->tgt); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"tg:%d",data->tg); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"pg:%d",data->pg); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"du:%d",data->du); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ca:%d",data->ca); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"di:%d",data->di); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"hr:%d",data->hr); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"stp:%d",data->stp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ti:%d",data->ti); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cir:%d",data->cir); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"alt:%d",data->alt); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"apc:%d",data->apc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"fpc:%d",data->fpc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"spc:%d",data->spc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"std:%d",data->std); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cdc:%d",data->cdc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"*******************************"); free(data); data = NULL; } else { @@ -3620,6 +3649,30 @@ cJSON* ble_get_Trainingdata_by_timetamp_(uint32_t timetamp) if(data!=NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"%d,%d\r\n",timetamp,data->st); + // 打印data数据 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"*******************************"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"src:%d",data->src); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"bt:%d",data->bt); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ty:%d",data->ty); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"st:%d",data->st); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"sp:%d",data->sp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"tgt:%d",data->tgt); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"tg:%d",data->tg); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"pg:%d",data->pg); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"du:%d",data->du); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ca:%d",data->ca); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"di:%d",data->di); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"hr:%d",data->hr); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"stp:%d",data->stp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"ti:%d",data->ti); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cir:%d",data->cir); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"alt:%d",data->alt); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"apc:%d",data->apc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"fpc:%d",data->fpc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"spc:%d",data->spc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"std:%d",data->std); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cdc:%d",data->cdc); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"*******************************"); int time_error= timetamp>data->st ? timetamp-data->st:data->st-timetamp; if(time_error<=2) { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp index c0ccf3b5b..3d65e368a 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -145,7 +145,7 @@ void TraingCardPresenter::UpdateTimeOfControl() { bool isNeedGPS = TraingModel::GetInstance()->IsNeedGPS(TraingModel::GetInstance()->GetSportEvent()); if(isNeedGPS == false) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "该运动项不需要GPS"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "该运动项不需要GPS"); return; } @@ -502,6 +502,12 @@ bool TraingCardPresenter::send_sport_cmd(training_ble *cmd) { } } reply_APP_OpenSportModeCmd(true); + // 打印app开启的运动的数据 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"*************app开启运动******************"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"sportType:%d",cmd->sportType); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"sportTagType:%d",cmd->sportTagType); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"sportTag:%d",cmd->sportTag); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"*******************************"); handleStartState(); return true; } else { @@ -611,6 +617,14 @@ void TraingCardPresenter::handleContinueState() { void TraingCardPresenter::handleStartState() { ControlSensor(ExerciseState::Start); TraingModel::GetInstance()->SetSportOpenWay(true); + //开启心率 + TraingModel::GetInstance()->start_training_heart(); +#if defined(SUPPORT_GNSS) + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "开启gps定时器"); + TraingModel::GetInstance()->gnss_start_timer(1000); +#endif + // 快捷训练都属于健身类 + TraingModel::GetInstance()->SetSportType(Exercisetype::FITNESS); } } // namespace OHOS diff --git a/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp index ac3946b7e..37f7369c3 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/n9/service/msg_center/src/msg_center_customer.cpp @@ -1536,9 +1536,9 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, MsgCenterNotifyArAlertProc}, {TOPIC_EVENT_INACTIVITY_UPDATE, MsgCenterNotifyInactivityProc}, {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE, MsgCenterNotifyInactivityAccumulateTimeProc}, - {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining}, {TOPIC_EVENT_GOAL_SHOW_VIEW, MsgCenterNotifygoalnotificationviewProc}, #endif + {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining}, {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit}, {TOPIC_EVENT_CHARGE_PLUG, MsgCenterNotifyChargePlugProc}, diff --git a/code/sdk/zhihui/services/ble_service/bleservice/bleEvent.c b/code/sdk/zhihui/services/ble_service/bleservice/bleEvent.c index b8115ac4b..2deac8886 100644 --- a/code/sdk/zhihui/services/ble_service/bleservice/bleEvent.c +++ b/code/sdk/zhihui/services/ble_service/bleservice/bleEvent.c @@ -6024,7 +6024,7 @@ static void Send_json_Data_Cmd(uint8_t day,uint16_t pack_size,uint8_t id) switch (id) { case 0x49: - json_format=struct_to_json_buf_malloc_(day); + json_format=struct_to_json_buf_malloc(day); break; case 0x01: json_format=struct_to_json_buf_malloc_Alarm(); @@ -6070,7 +6070,7 @@ static void Send_json_Data_Cmd(uint8_t day,uint16_t pack_size,uint8_t id) else { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"%d %d %d %d\r\n",data_len,surplus_len,pack_id,pack); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"%d %d %d %d\r\n",data_len,surplus_len,pack_id,pack); ble_data_type type_={0x01,id,data_len,pack,pack_id}; send_big_data(type_,json_format+offset,surplus_len); //send_big_data(1,json_format+offset,surplus_len,data_len,pack_id,pack,id,1); @@ -6781,10 +6781,12 @@ void readDevDataBle(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u uapi_dev_runtime_set_goal_storage_status(0); break; case 0x49://同步基础训练历史数据 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"同步基础训练历史数据 目前存储状态:%d",uapi_dev_runtime_get_train_storage_status()); if(uapi_dev_runtime_get_train_storage_status()) { ble_reply_cmdarr(SYN_BASIC_TRANIN_HISTORY_DATA_CMD,NULL,0); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"同步基础训练历史数据 失败"); return; } @@ -6795,7 +6797,7 @@ void readDevDataBle(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u num=482; } uapi_dev_runtime_set_train_storage_status(1); - Send_json_Data_Cmd(data[0],num,0x49); + Send_json_Data_Cmd(data[0],num,0x49); uapi_dev_runtime_set_train_storage_status(0); break; case 0x01://同步闹钟