From: hcj <1224667075@qq.com> Date: Wed, 27 Mar 2024 11:43:22 +0000 (+0800) Subject: 关于手表增加cat1信息 X-Git-Tag: release_V1.2.70_20241020_135402~1250^2~3^2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=434c870808772ef058b24f46537e51da8745d8c2;p=mirrors%2FFD230.git 关于手表增加cat1信息 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp index 9d937409d..d9a79b85b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp @@ -94,7 +94,10 @@ namespace OHOS gsenson_t t; get_gsonsen_xyz(&t); char buf[124]={0}; - sprintf(buf,"X:%d\nY:%d\nZ:%d",t.x,t.y,t.z); + float x_t=t.x/1024.0; + float y_t=t.y/1024.0; + float z_t=t.z/1024.0; + sprintf(buf,"X:%3f\nY:%3f\nZ:%3f",x_t,y_t,z_t); x->SetText(buf); RootView::GetInstance()->Invalidate(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h index 09b40efb3..6521e90a0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemAboutTheWatchView.h @@ -47,6 +47,13 @@ namespace OHOS UILabel *LANAddress = nullptr; UILabel *FONTTitle = nullptr; UILabel *FONT = nullptr; + + UILabel *CAT1Title = nullptr; + UILabel *CAT1mode = nullptr; + + UILabel *pyTitle = nullptr; + UILabel *pymode = nullptr; + bool initViewStatus{false}; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp index 0642e93dc..56cfa2b85 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemAboutTheWatchView.cpp @@ -2,6 +2,7 @@ #include "system/include/SystemPresenter.h" #include "wearable_log.h" #include "custom_utils.h" +#include "config/include/ConfigModel.h" namespace OHOS { @@ -56,9 +57,16 @@ namespace OHOS delete FONTTitle; FONTTitle = nullptr; delete FONT; - FONT = nullptr; + delete CAT1Title; + CAT1Title = nullptr; + delete CAT1mode; + CAT1mode = nullptr; + delete pyTitle; + pyTitle = nullptr; + delete pymode; + pymode = nullptr; delete SystemAboutTheWatchScrollView; - SystemAboutTheWatchScrollView = nullptr; + SystemAboutTheWatchScrollView = nullptr; } } @@ -366,6 +374,83 @@ namespace OHOS } LANAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); SystemAboutTheWatchScrollView->Add(LANAddress); + + Config = { + .left = 173, + .top = 885+145, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "CAT1mode", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + CAT1Title = InitLabel(Config); + if (CAT1Title == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FONTTitle new fail!"); + return nullptr; + } + SystemAboutTheWatchScrollView->Add(CAT1Title); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 37, + .top = 941+145, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = "HarmonyOS Sans", + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + Config.text=ConfigModel::GetInstance()->GetmoderVer(); + CAT1mode = InitLabel(Config); + if (CAT1mode == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddress new fail!"); + return nullptr; + } + CAT1mode->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + SystemAboutTheWatchScrollView->Add(CAT1mode); + + Config = { + .left = 173, + .top = 885+145*2, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "pyVer", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + pyTitle = InitLabel(Config); + if (pyTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FONTTitle new fail!"); + return nullptr; + } + SystemAboutTheWatchScrollView->Add(pyTitle); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 37, + .top = 941+145*2, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = "HarmonyOS Sans", + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + Config.text=ConfigModel::GetInstance()->GetpyVer(); + pymode = InitLabel(Config); + if (CAT1mode == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddress new fail!"); + return nullptr; + } + pymode->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + SystemAboutTheWatchScrollView->Add(pymode); + initViewStatus = true; return SystemAboutTheWatchScrollView; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp index a6b0dd57f..2588b8dbe 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp @@ -32,7 +32,7 @@ namespace OHOS static char *Path_ota_package= "/user/update.fwpkg"; static uint8_t uri_ota_package[124] ={0}; - #define UP_TEST + //#define UP_TEST static void upgrade_task(void *arg) { @@ -61,7 +61,8 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "httpc_download_result_ui"); if(root!=NULL) { - bool falg=cJSON_GetObjectItem(root, "UptoDate")->valueint; + + int falg=cJSON_GetObjectItem(root, "UptoDate")->valueint; char *uri = cJSON_GetObjectItem(root, "url")->valuestring; sprintf((char *)uri_ota_package,"%s",uri); char *OtaPackageVersion = cJSON_GetObjectItem(root, "OtaPackageVersion")->valuestring; @@ -74,7 +75,7 @@ namespace OHOS #ifdef UP_TEST SystemupgradeView::GetInstance()->set_string_value(buf,true); #else - if(falg) + if(falg==0) { SystemupgradeView::GetInstance()->set_string_value(buf,true); }