From: Caisking <3449750381@qq.com> Date: Tue, 30 Apr 2024 01:41:09 +0000 (+0800) Subject: 增加发送手表运动结束状态 X-Git-Tag: release_V1.2.70_20241020_135402~1025^2~43 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=bc6f7d156f60d11a17312e125ce885b590df619c;p=mirrors%2FFD230.git 增加发送手表运动结束状态 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index e47768f14..3b41e35ff 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -247,10 +247,21 @@ namespace OHOS /*设置运动状态*/ void TraingModel::SetSportState(ExerciseState state) { - /*运动开始并且是app发起的运动*/ - if (state != ExerciseState::General && Openingway == true) + if (state != ExerciseState::General) { - sendtraningstatedata(static_cast(state), sportdata->duration); + /*运动开始并且是app发起的运动*/ + if (Openingway == true) + { + sendtraningstatedata(static_cast(state), sportdata->duration); + } + else + { + /*手表发起并且是结束状态*/ + if (state == ExerciseState::End) + { + sendtraningstateend(); + } + } } sportState_ = state; } @@ -358,6 +369,8 @@ namespace OHOS sportdata->sportTagType = sportTagType_; sportdata->tag = sportTag_; } + + (Openingway == true) ? (printf("app发起运动\n")) : (printf("手表发起运动\n")); char *start_date = (char *)malloc(9 * sizeof(char)); // 分配内存给start_date if (uapi_get_YYMMDD_Time(start_date, '/') != ERRCODE_SUCC) 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 ff58c4214..ac0ba9816 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -330,6 +330,16 @@ void sendtraningstatedata(uint8_t state ,uint16_t time) } +//发送训练结束状态[手表发起] +void sendtraningstateend(void) +{ + char data[1]={0}; + uint32_t data_len=1; + data[0]=0; //[0 结束] + printf("发送训练状态结束%d\r\n",data[0]); + send_big_data(0,data,data_len,data_len,1,1,0x51,5); +} + void sendtraningdata(msg_get_train_data_info_t *data) { cJSON* dataJSON=cJSON_CreateObject(); 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 005c1c885..1e5e622a8 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -626,6 +626,9 @@ void free_ble_data(void); void sendtraningdata(msg_get_train_data_info_t *data); void sendtraningstatedata(uint8_t state ,uint16_t time); + +void sendtraningstateend(void); + #ifdef __cplusplus } #endif