From 9007fa76bf97f88ab35dfaf8bd226d31c3c41d72 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Mon, 21 Oct 2024 18:32:24 +0800 Subject: [PATCH] =?utf8?q?=E8=A1=A8=E7=9B=98=EF=BC=9A=E5=90=8C=E6=AD=A5ble?= =?utf8?q?=E4=BF=AE=E6=94=B9=EF=BC=88=E5=B7=B2=E9=AA=8C=E8=AF=81=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/set_dial/include/SetDialModel.h | 2 +- .../nativeui/set_dial/src/SetDialModel.cpp | 4 +++- .../service/ble_service/blemoder/bletest.cpp | 4 ++++ .../service/ble_service/blemoder/bletest.h | 4 +++- .../service/ble_service/bleservice/bleEvent.c | 14 +++++++++----- 5 files changed, 20 insertions(+), 8 deletions(-) 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 f3e544f9b..beb91656a 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 @@ -35,7 +35,7 @@ namespace OHOS constexpr uint16_t CUSTOM_DIAL_ID_5 = 5; #define DIAL_ID_LENGTH 2 #define DIAL_NAME_LENGTH 50 - #define DIAL_ID_PATH "user/dial/dial_id.bin" + #define DIAL_ID_PATH "user/userdata/dial_id.bin" #define DIAL_MAX_NUM 21 #define DIAL_CUSTOM_MAX_NUM 1 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 bf8af6583..3366fdebd 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 @@ -109,8 +109,8 @@ bool SetDialModel::readDialfile() { } SetDialModel::SetDialModel() { + LoadAllDial(); // 更新表盘个数 当前表盘 readDialfile(); // 读取表盘map配置文件 - LoadAllDial(); // 更新表盘个数 当前表盘 char idBuffer[10]; // 读取表盘Id配置文件 int len = UtilsGetValue("dial_id", idBuffer, sizeof(idBuffer)); if (len >= 0) { @@ -334,6 +334,8 @@ bool SetDialModel::DeleteCustomDial(uint16_t Id) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "DeleteCustomDial: Successfully deleted custom dial with ID %d", Id); + //删除表盘,更新id文件 + saveDialfile(); return true; } 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 c58611b31..d72f6c3a2 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -918,6 +918,10 @@ void get_sedent_param( msg_sedent_set_param_info_t * data) return; } +bool check_dial_freespace(uint16_t id,uint32_t dial_size) { + return OHOS::SetDialModel::GetInstance().CheckDialDownload(id,dial_size); +} + void ble_get_dial_path(char * buf,uint16_t id) { char *path= (char*)OHOS::SetDialModel::GetInstance().GetSaveDir(id,0).c_str(); 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 f20fafe1b..e4e41d34a 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -247,7 +247,9 @@ 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 ble_get_custom_dial(uint16_t id, char *buf); + +bool check_dial_freespace(uint16_t id,uint32_t dial_size); //////////////////////久坐提醒//////////////////////////// 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 6563c350e..7330aad0d 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -7284,8 +7284,11 @@ errcode_t decode_single_dial_info(ble_read_data *buffer_handle) ble_dial_uid = dialinfo.dial_uid; // if(ble_dial_uid<=4) // ble_dial_uid++; - + if (check_dial_freespace(ble_dial_uid, file_size) == false) + { + return ERRCODE_FAIL; + } buffer_handle->file_recv_stat.file_name = filename; buffer_handle->file_recv_stat.file_size = file_size; @@ -7760,10 +7763,10 @@ void type2AE0Data(ble_read_data *buffer_handle) if (decode_single_dial_info(buffer_handle) == ERRCODE_SUCC) { ble_reply_cmd(SINGLE_DIAL_FILE_RECV_CMD,1); - - }else{ + } else { + TRANSMIT_DATA=TRANS_DIAL_FAIL; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); ble_reply_cmd(SINGLE_DIAL_FILE_RECV_CMD,2); - } break; case EPO_DATA_RECV_CMD: @@ -7857,7 +7860,8 @@ void type2AE6Data(ble_read_data *buffer_handle,uint8_t *cmd_buf ,uint8_t *data,u { ble_reply_cmd(DIAL_SINGEL_FILE_CMD,1); - }else{ + } else { + ble_reply_cmd(DIAL_SINGEL_FILE_CMD,2); } -- 2.17.1