From c562db3142f98fb3c3f8d1486dc6358eafaf72d4 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Fri, 11 Oct 2024 19:12:48 +0800 Subject: [PATCH] =?utf8?q?otas=E5=8D=87=E7=BA=A7=E5=A4=B1=E8=B4=A5?= =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=BC=B9=E7=AA=97=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/blemoder/bletest.cpp | 21 +++++++++++++++++++ .../service/ble_service/blemoder/bletest.h | 2 ++ .../src/notify/goal_notification.cpp | 6 +++++- .../msg_center/src/notify/transmitting.cpp | 7 ++++++- .../peripheral/config/include/ConfigModel.h | 3 +++ .../peripheral/utils/custom_cmd_service.c | 1 + 6 files changed, 38 insertions(+), 2 deletions(-) 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 885dda3c4..0e64e0f2e 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -49,6 +49,7 @@ #include "MusicPlayerModel.h" #include "goal_notification.h" +// #include "AlarmClockModel.h" //#include "AlarmClockModel.h" #ifdef __cplusplus @@ -89,6 +90,24 @@ extern "C" { #include "alipay_feature.h" #include "transmitting.h" +void set_ota_upgrade(void) +{ + OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); + p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_OTA_UPGRADE,1); +} + +// void test_paly(uint8_t falg) +// { +// if(falg) +// { +// AlarmClockModel::GetInstance()->testPlayerStart("/music/ring/ring.mp3"); +// } +// else +// { +// AlarmClockModel::GetInstance()->AlarmPlayerStop(); +// } + +// } bool get_training_spead_path(char *path ,uint32_t time,uint32_t max_len) { std::string str= OHOS::TraingModel::GetInstance()->GetPaceTablePath(time); @@ -1869,6 +1888,8 @@ void set_user_data(msg_user_info_t *data) else p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_24HOUR,12); + + SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0); } 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 575b60d1e..ed6a4d36f 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -400,6 +400,8 @@ uint8_t get_step_goal_notify_switch(void); void set_goal_step_notification(uint8_t data); +void set_ota_upgrade(void); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp index 8c58a5476..81c82ba79 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp @@ -33,7 +33,7 @@ namespace OHOS static UILabelButtonExt *buttonok_ = nullptr; static UIImageAnimatorView *imageAnimator{nullptr}; static const ImageInfo **winimageInfos; - static ImageAnimatorInfo winimageAnimatorInfo[94]{0}; + static ImageAnimatorInfo *winimageAnimatorInfo{nullptr}; static std::string winbasePath = "/user/res/Training/training_GIF/win/"; void Freegoalview(void) @@ -69,6 +69,9 @@ namespace OHOS FreeImageInfoArray(winimageInfos, winbasePath.c_str(), 94); delete imageAnimator; imageAnimator = nullptr; + + delete [] winimageAnimatorInfo; + winimageAnimatorInfo = nullptr; } if(labelgettag) { @@ -223,6 +226,7 @@ namespace OHOS // 初始化图片数组以及动画 winimageInfos = CreateImageInfoArray(winbasePath.c_str(), 94); + winimageAnimatorInfo = new ImageAnimatorInfo[94]; InitImageAnimatorSource(imageAnimator, winimageAnimatorInfo, winimageInfos, 94, 173, 100, 120, 120, "imageAnimator1", 10); imageAnimator->Start(); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp index fcb1e1e45..19e23a023 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp @@ -18,6 +18,7 @@ #include "custom_runtime.h" #include "PhoneService.h" #include "ConfigModelC.h" +#include "ConfigModel.h" namespace OHOS { static UIImageView *imageCharge = nullptr; @@ -305,7 +306,11 @@ namespace OHOS { sprintf_s(updata_fail_str,32,"%d_%d",(int)upg_result,last_image_index); TRANSMIT_DATA=OTA_UPDATA_FAIL; - CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + if(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_OTA_UPGRADE)) + { + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_OTA_UPGRADE,0); + } } } diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h index 360de80be..fa41ad714 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -136,6 +136,8 @@ namespace OHOS CONFIGMODEL_ITEM_BLE_IOS_OR_ANDROID,//绑定设备为安卓或者ios 0:安卓 1:苹果 CONFIGMODEL_ITEM_BR_PAIR,//br第一次绑定 + CONFIGMODEL_ITEM_OTA_UPGRADE,//ota升级过 + // flashlight CONFIGMODEL_ITEM_FLASHLIGHT_COLOR_INDEX, // color index CONFIGMODEL_ITEM_FLASHLIGHT_COLOR_VALUE, // color value @@ -395,6 +397,7 @@ namespace OHOS {ConfigDataType::DATATYPE_STRING, "applist_style", "list" }, //CONFIGMODEL_ITEM_APPLIST_STYLE {ConfigDataType::DATATYPE_INT, "android_or_ios", "0" },//CONFIGMODEL_ITEM_BLE_IOS_OR_ANDROID {ConfigDataType::DATATYPE_INT, "br_pari" , "0"}, + {ConfigDataType::DATATYPE_INT, "ota_upgrade" , "0"},// CONFIGMODEL_ITEM_OTA_UPGRADE {ConfigDataType::DATATYPE_INT, "color_index", "0" }, // CONFIGMODEL_ITEM_FLASHLIGHT_COLOR_INDEX, // color index {ConfigDataType::DATATYPE_INT, "color_value", "0" }, // CONFIGMODEL_ITEM_FLASHLIGHT_COLOR_VALUE, // color value {ConfigDataType::DATATYPE_INT, "flashing_level", "0" }, // CONFIGMODEL_ITEM_FLASHLIGHT_FLASHING_LEVEL, // flashing level diff --git a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c index 7fa91ddff..c312ca557 100644 --- a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c +++ b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c @@ -155,6 +155,7 @@ static void custom_cmd_service_check_task(void const *arg) } break; case CUSTOM_CMD_MSG_TYPE_STARTOTA: + set_ota_upgrade(); uaip_cmd_update_request(); break; case CUSTOM_CMD_MSG_TYPE_LCD_TEST: -- 2.17.1