From: Caisking <3449750381@qq.com> Date: Wed, 25 Sep 2024 09:37:15 +0000 (+0800) Subject: #605 APP iOS/安卓 手表切换表盘,APP上不同步 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=51f6fef9c8f3f8c555d772afa0e5c601042f3a57;p=mirrors%2FFD230.git #605 APP iOS/安卓 手表切换表盘,APP上不同步 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialModel.h b/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialModel.h index e3452215d..42556841d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialModel.h @@ -56,6 +56,7 @@ namespace OHOS bool DeleteCustomDial(uint16_t Id); void TestDialConfig(void); std::string GetSaveDir(int Id,uint8_t type); + void RegisterDial(uint16_t ID, const char *dialname,uint8_t type); private: void LoadAllDialFromRam(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp index c4008b968..d5df0dc3b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialModel.cpp @@ -128,6 +128,21 @@ SetDialModel &SetDialModel::GetInstance() { /* 注册表盘map */ void SetDialModel::RegisterDial(uint16_t ID, const char *dialname) { + + if (ID == 0 || strlen(dialname) == 0) + return; + + registeredDials[ID] = std::string(dialname); // 唯一性 + + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RegisterDial %d %s is ok!", ID, + dialname); + + LoadAllDial(); + saveDialfile(); +} + +/* 注册表盘map_ble*/ +void SetDialModel::RegisterDial(uint16_t ID, const char *dialname,uint8_t type) { // 增加 ID 对应 if (ID <= 4) { ID++; @@ -142,7 +157,6 @@ void SetDialModel::RegisterDial(uint16_t ID, const char *dialname) { dialname); LoadAllDial(); - saveDialfile(); } @@ -353,7 +367,6 @@ bool SetDialModel::UninstallDial(uint16_t ID) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UninstallDial: Failed to uninstall custom dial %d", ID); return false; - default: WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UninstallDial: dial ID %d is offline dial", ID); @@ -646,7 +659,7 @@ void SetDialModel::LoadAllDialFromRam() { // RegisterDial(dialInfo.id, dialInfo.dialName.c_str()); // 日志输出 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Parsed Dial: ID: %u, Name: %s, Image: %s", dialInfo.id, dialInfo.dialName.c_str(), dialInfo.imageFullName.c_str()); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp index a62750de3..ed0bb202e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp @@ -18,7 +18,8 @@ #include "KeyInputListener.h" #include "custom_utils.h" #include "common/key_code.h" - +#include "bleService.h" +#include "bleEvent.h" namespace OHOS { SetDialPresenter::SetDialPresenter() @@ -55,8 +56,11 @@ namespace OHOS bool SetDialPresenter::OnClick(UIView &view, const ClickEvent &event) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter::OnClick"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetDialPresenter::OnClick"); OnClickAction(); + //具有延迟 + svr_ble_read_data_value_updata_noyify(); + Watch_SendDial_ToAppCmd(); return true; } 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 73889b02f..5e3553aab 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -4006,6 +4006,15 @@ static void GetSportPasueResetCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_ } //发送当前表盘到app + +void Watch_SendDial_ToAppCmd(void) +{ + + uint16_t dialNum =ble_get_dial_id(); + ble_data_type type_={0x01,0x17,2,1,1}; + send_big_data(type_,(char *)&dialNum,2); +} + static void SendDialToAppCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue) { uint8_t value[20]; 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 f2e2caeef..0304681ee 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -818,6 +818,8 @@ void GetCurDataCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,ui bool get_ctkd_flag(void); +void Watch_SendDial_ToAppCmd(void); + uint8_t parse_jsonCheck_weather(uint8_t *buf,uint8_t *check);//json 格式解析 天气数据 uint8_t read_jsonHistory_weather(void); void GetwatchSaveMac(uint8_t *mac,uint8_t *mactype);