From: hcj <1224667075@qq.com> Date: Sat, 24 Aug 2024 02:40:00 +0000 (+0800) Subject: 自定义表盘增加保存配置文件接口 X-Git-Tag: release_V1.2.70_20241020_135402~595 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=1d03bff4608d2db9fa602f64952d067300777476;p=mirrors%2FFD230.git 自定义表盘增加保存配置文件接口 --- 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 41d84fdf1..533dc0a3c 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 @@ -12,13 +12,13 @@ namespace OHOS DEFULTDIAL, DOWNLOADDIAL, }; - struct DialLayout + typedef struct DialLayout_ { - uint8_t dialId; + uint16_t dialId; uint8_t batteryDisplay; // 电池配置 [0:无 1:白 2:黑] uint8_t timeDisplay; // 时间位置 [0:上 1:下] uint8_t colorTypeSet; // 颜色配置 [0:白 1:黑 2:灰 3:绿 4:橙 5:蓝] - }; + }DialLayout; class SetDialModel { public: 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 620675f15..12a3cd923 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -668,10 +668,17 @@ void ble_get_dial_path(char * buf,uint16_t id) return; } -// void ble_save_dial_() -// { - -// } +void ble_save_dial_custom(msg_recv_custom_dial_info_t *data) +{ + #ifdef FD230 + OHOS:: DialLayout info; + info.dialId=data->dial_uid; + info.batteryDisplay=data->battery; + info.timeDisplay=data->time; + info.colorTypeSet=data->time_font; + OHOS::SetDialModel::GetInstance().saveDialConfig(info); + #endif +} void ble_set_dial_by_id(uint16_t id) { 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 ec8c59566..036180e37 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -239,6 +239,8 @@ void install_Register_dial( char * name,uint16_t id); bool dial_file_save(void); +void ble_save_dial_custom(msg_recv_custom_dial_info_t *data); + //////////////////////久坐提醒//////////////////////////// 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 eee2c06cd..90ad5dad2 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -6348,13 +6348,20 @@ errcode_t decode_dial_info(ble_read_data *buffer_handle) dialinfo.dial_uid = pdialinfo->dial_uid; if(dialinfo.dial_uid<=4) { + 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; printf("custom_dial_info %d %d %d %d", custom_dial_info->dial_uid, custom_dial_info->battery, custom_dial_info->time, custom_dial_info->time_font); + + ble_save_dial_custom(custom_dial_info); + ble_dial_file_count=*(data+sizeof(msg_recv_custom_dial_info_t)); + printf(" custom_dial file_count %d\r\n",ble_dial_file_count); }