From 2d4aea3003a9d222ce3e9ba60e8353f3bcb48cb7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Mon, 26 Aug 2024 11:47:37 +0000 Subject: [PATCH] Merge #792 into sdk602patch0626 from refs/changes/792/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/792/head: (2 commits squashed) - 自定义表盘下载修复 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into 0626 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/792 --- .../service/ble_service/blemoder/bletest.cpp | 8 ++++++ .../service/ble_service/blemoder/bletest.h | 2 ++ .../service/ble_service/bleservice/bleEvent.c | 28 ++++++++++--------- 3 files changed, 25 insertions(+), 13 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 12a3cd923..81dc5c9a9 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -687,6 +687,14 @@ void ble_set_dial_by_id(uint16_t id) #endif } +void ble_get_custom_dial(uint16_t id,char *buf) +{ + #ifdef FD230 + const char *name=OHOS::SetDialModel::GetInstance().GetCustomName(id).c_str(); + memset_s(buf,32,0,32); + memcpy_s(buf,32,name,strlen(name)); + #endif +} uint16_t ble_get_dial_id(void) { #ifdef FD230 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 036180e37..d273b3f28 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -241,6 +241,8 @@ bool dial_file_save(void); void ble_save_dial_custom(msg_recv_custom_dial_info_t *data); +void ble_get_custom_dial(uint16_t id,char *buf); + //////////////////////久坐提醒//////////////////////////// void set_sedent_param( msg_sedent_set_param_info_t * data); 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 90ad5dad2..56678a547 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -6350,8 +6350,7 @@ errcode_t decode_dial_info(ble_read_data *buffer_handle) { msg_recv_custom_dial_info_t *custom_dial_info=(msg_recv_custom_dial_info_t*)data; - if(custom_dial_info->dial_uid==0) - custom_dial_info->dial_uid=1; + custom_dial_info->dial_uid+=1; printf("custom_dial_info %d %d %d %d", custom_dial_info->dial_uid, custom_dial_info->battery, @@ -6458,10 +6457,8 @@ errcode_t decode_single_dial_info(ble_read_data *buffer_handle) uapi_dev_runtime_set_dialname(filename); //存表盘id ble_dial_uid = dialinfo.dial_uid; - if(ble_dial_uid==0) - { - ble_dial_uid=1; - } + ble_dial_uid++; + buffer_handle->file_recv_stat.file_name = filename; @@ -6511,7 +6508,7 @@ static errcode_t install_dial(void) } printf("dial_basename %s\n",dial_basename); char dialbin_filepath[128]={0}; - if(ble_dial_uid>=5) + if(ble_dial_uid>5) { if (get_dial_file_path(dial_basename,strlen(dial_basename),dialbin_filepath,sizeof(dialbin_filepath)) != ERRCODE_SUCC) { @@ -6541,7 +6538,7 @@ static errcode_t install_dial(void) char *namebuf= strtok(lzmapkgname,"."); - if(ble_dial_uid>=5) + if(ble_dial_uid>5) { install_Register_dial(namebuf,ble_dial_uid); @@ -6550,10 +6547,15 @@ static errcode_t install_dial(void) } else { - - install_Register_dial(namebuf,ble_dial_uid); - - ble_set_dial_by_id(ble_dial_uid); + if(ble_dial_file_index==ble_dial_file_count) + { + printf("自定义表盘安装完毕\r\n"); + char name_str[32]={0}; + ble_get_custom_dial(ble_dial_uid,name_str); + install_Register_dial(name_str,ble_dial_uid); + ble_set_dial_by_id(ble_dial_uid); + } + } @@ -6670,7 +6672,7 @@ void decode_file_checksum(ble_read_data *buffer_handle) { //ble_set_dial_by_id(ble_dial_uid); - if(ble_dial_uid>=5 || ble_dial_file_index==ble_dial_file_count) + if(ble_dial_uid>5 || ble_dial_file_index==ble_dial_file_count) { TRANSMIT_DATA= TRANS_DIAL_SUCC; CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); -- 2.17.1