From 94e6d4e768217cd1e9db336b73f2f769d57abdf6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Tue, 11 Jun 2024 02:04:50 +0000 Subject: [PATCH] Merge #249 into sdk602patch0521 from refs/changes/249/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/249/head: (3 commits squashed) - 获取N天前日期 - 增加传输中UI - 增加OTA传输中的进度条 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/249 --- .../nativelauncher/include/UiConfig.h | 3 + .../nativeui/producttest/src/testbt.cpp | 2 +- .../service/ble_service/blemoder/bletest.h | 13 + .../service/ble_service/bleservice/bleEvent.c | 82 ++- .../service/ble_service/bleservice/bleEvent.h | 3 +- .../broadcast/include/broadcast_feature.h | 1 + .../broadcast/src/broadcast_implement.c | 2 + .../service/msg_center/CMakeLists.txt | 5 + .../include/notify/charge_notification.h | 2 +- .../include/notify/notification_manager.h | 1 + .../msg_center/include/notify/transmitting.h | 64 ++ .../msg_center/src/msg_center_customer.cpp | 43 +- .../src/notify/charge_notification.cpp | 4 +- .../notify/notification_manager_customer.cpp | 2 + .../msg_center/src/notify/transmitting.cpp | 584 ++++++++++++++++++ .../mk_fs_image/fd230/fs/user/res/OK.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/1.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/10.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/11.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/12.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/13.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/14.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/15.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/16.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/17.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/18.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/19.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/2.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/20.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/21.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/22.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/23.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/24.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/3.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/4.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/5.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/6.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/7.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/8.bin | 3 + .../mk_fs_image/fd230/fs/user/res/down/9.bin | 3 + .../peripheral/cywee/src/board_yh601s.c | 28 + .../drivers/peripheral/utils/custom_utils.c | 31 + .../drivers/peripheral/utils/custom_utils.h | 5 + 43 files changed, 939 insertions(+), 11 deletions(-) mode change 100755 => 100644 code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h mode change 100755 => 100644 code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c mode change 100755 => 100644 code/sdk/application/wearable/service/msg_center/CMakeLists.txt mode change 100755 => 100644 code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h create mode 100644 code/sdk/application/wearable/service/msg_center/include/notify/transmitting.h create mode 100644 code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/OK.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/1.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/10.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/11.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/12.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/13.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/14.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/15.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/16.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/17.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/18.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/19.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/2.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/20.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/21.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/22.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/23.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/24.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/3.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/4.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/5.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/6.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/7.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/8.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/9.bin diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index 812f88ce6..6f6e05d52 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -317,6 +317,9 @@ namespace OHOS static constexpr const char *PNG_TOGGLEBUTTON_OFF_IMAGE = APP_RES_PATH "/TOGGLEBUTTON_OFF.bin"; // togglebuttton未选中图片 static constexpr const char *PNG_TOGGLEBUTTON_ON_IMAGE = APP_RES_PATH "/TOGGLEBUTTON_ON.bin"; // togglebuttton选中图片 static constexpr const char *PNG_ATTENTION_IMAGE = APP_RES_PATH "/Attention.bin"; // 注意 + + static constexpr const char *PNG_SUCC_IMAGE = APP_RES_PATH "/OK.bin"; // 成功 + static constexpr const char *PNG_466x100BUTTON_IMAGE = APP_RES_PATH "/466x100button.bin"; // 466x100button图片 /* -------------------------------- 已删除的不必要图片 ------------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp index 630fe5506..9a9912eb1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp @@ -370,7 +370,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ":: %x !",ret); // bts_sample_log("gap reg cbk ret %x\n", ret); - + gap_br_set_inquiry_paramters(1, 5); //清楚配对 gap_remove_all_pairs(); 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 b4395cb03..fa8f95329 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -27,6 +27,19 @@ extern "C" #include "errcode.h" #include "bleEvent.h" + typedef enum transmitting_type { + TRANS_DIAL_TRANSMITTING, + TRANS_DIAL_SUCC, + TRANS_DIAL_FAIL, + + TRANS_OTA_TRANSMITTING, + TRANS_OTA_SUCC, + TRANS_OTA_FAIL, + + TRANS_FREE, + } transmitting_type; + + enum PAIRING { DEVICEBIND = 0, 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 2b4b033c3..2dbc96b32 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -5052,7 +5052,7 @@ errcode_t ble_reply_msg(uint8_t msg_cmdtype,uint8_t msg_cmdid,uint8_t replydata) - +uint8_t TRANSMIT_DATA; errcode_t decode_ota_json(ble_read_data *buffer_handle) { @@ -5139,6 +5139,10 @@ errcode_t decode_ota_json(ble_read_data *buffer_handle) buffer_handle->file_recv_stat.received_size = 0; buffer_handle->file_recv_stat.lrcvalue = 0; buffer_handle->receive_file_flag = 1; + //进入特殊UI + TRANSMIT_DATA=TRANS_OTA_TRANSMITTING; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + return ERRCODE_SUCC; }else{ buffer_handle->receive_file_flag = 0; @@ -5256,6 +5260,10 @@ errcode_t decode_dial_info(ble_read_data *buffer_handle) buffer_handle->file_recv_stat.lrcvalue = 0; buffer_handle->receive_file_flag = 0; + //进入特殊UI + TRANSMIT_DATA=TRANS_DIAL_TRANSMITTING; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + free(filename); return ERRCODE_SUCC; @@ -5392,6 +5400,11 @@ void decode_file_checksum(ble_read_data *buffer_handle) { case 1: //ota do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_STARTOTA,NULL,0); + + TRANSMIT_DATA=TRANS_OTA_SUCC; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + + break; case 2://mp3 @@ -5399,18 +5412,66 @@ void decode_file_checksum(ble_read_data *buffer_handle) case 3://dial //TODO: 设置成当前下载的表盘 if (install_dial() == ERRCODE_SUCC) + { + + TRANSMIT_DATA= TRANS_DIAL_SUCC; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + ble_reply_cmd(DIAL_INSTALL_REPY_CMD,1); + } else + { + TRANSMIT_DATA= TRANS_DIAL_FAIL; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + ble_reply_cmd(DIAL_INSTALL_REPY_CMD,0); + + } + break; default: break; } }else{ - ble_reply_cmd(FILE_CHECKSUM_RECV_CMD,2); + ble_reply_cmd(FILE_CHECKSUM_RECV_CMD,2); + switch (buffer_handle->file_recv_stat.file_type) + { + case 1: //ota + TRANSMIT_DATA=TRANS_OTA_FAIL; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + break; + case 2://mp3 + + break; + case 3://dial + TRANSMIT_DATA= TRANS_DIAL_FAIL; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + ble_reply_cmd(DIAL_INSTALL_REPY_CMD,0); + break; + default: + break; + } + } }else{ ble_reply_cmd(FILE_CHECKSUM_RECV_CMD,0); + switch (buffer_handle->file_recv_stat.file_type) + { + case 1: //ota + TRANSMIT_DATA=TRANS_OTA_FAIL; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + break; + case 2://mp3 + + break; + case 3://dial + TRANSMIT_DATA= TRANS_DIAL_FAIL; + CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); + ble_reply_cmd(DIAL_INSTALL_REPY_CMD,0); + break; + default: + break; + } } } @@ -5535,6 +5596,18 @@ errcode_t cancel_recv_file(ble_read_data *buffer_handle) return ERRCODE_SUCC; } +uint8_t OTA_FILE_value=0; + +uint8_t get_OTA_recv_value() +{ + return OTA_FILE_value; +} + +void Set_OTA_recv_value() +{ + OTA_FILE_value=0; + return; +} errcode_t handle_recv_file(ble_read_data *buffer_handle,uint8_t *data, uint16_t event_size) { @@ -5552,6 +5625,7 @@ errcode_t handle_recv_file(ble_read_data *buffer_handle,uint8_t *data, uint16_t { buffer_handle->file_recv_stat.file = fopen("/update/update.fwpkg","w+"); printf("create file /update/update.fwpkg %X\n",buffer_handle->file_recv_stat.file); + }else{ char filepath[128]={0}; if (get_file_recv_file_path(buffer_handle->file_recv_stat.file_name,strlen(buffer_handle->file_recv_stat.file_name),filepath,sizeof(filepath)) == ERRCODE_SUCC) @@ -5567,6 +5641,7 @@ errcode_t handle_recv_file(ble_read_data *buffer_handle,uint8_t *data, uint16_t return ERRCODE_FAIL; } buffer_handle->file_recv_stat.recv_file_stat = 1; + OTA_FILE_value=0; } if (buffer_handle->file_recv_stat.file == NULL) @@ -5580,6 +5655,7 @@ errcode_t handle_recv_file(ble_read_data *buffer_handle,uint8_t *data, uint16_t buffer_handle->file_recv_stat.lrcvalue = calculate_lrc(data,event_size,buffer_handle->file_recv_stat.lrcvalue); buffer_handle->file_recv_stat.received_size += event_size; printf("handle_recv_file received_size %d\n",buffer_handle->file_recv_stat.received_size); + OTA_FILE_value= ((float) buffer_handle->file_recv_stat.received_size / (float)buffer_handle->file_recv_stat.file_size) *100; }else{ printf("handle_recv_file write file failed! ret %d != %d\n",writtensize,event_size); @@ -5602,6 +5678,8 @@ errcode_t handle_recv_file(ble_read_data *buffer_handle,uint8_t *data, uint16_t buffer_handle->file_recv_stat.recv_file_stat = 2; buffer_handle->receive_file_flag = 0; printf("handle_recv_file received success \n"); + + ble_reply_cmd(FILE_RECV_REPLY_STAT_CMD,1);//接收成功 } 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 3ec0f3cc2..acae1d070 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -700,8 +700,9 @@ typedef struct +uint8_t get_OTA_recv_value(void); - +void Set_OTA_recv_value(void); void revBleOldData(uint8_t *buf, uint16_t event_size,uint16_t handle);//协议接收client下发的数据接口 //02类型的指令数据 diff --git a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h old mode 100755 new mode 100644 index a925ba556..1c94cd48d --- a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h +++ b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h @@ -51,6 +51,7 @@ typedef enum { TOPIC_EVENT_ACTIVITY_UPDATE, TOPIC_EVENT_INACTIVITY_UPDATE, TOPIC_EVENT_BLE_TRAINING, + TOPIC_EVENT_BLE_TRANSMIT, #endif #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION TOPIC_EVENT_CHARGE_PLUG, diff --git a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c old mode 100755 new mode 100644 index 4ad305576..a9e59252a --- a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c +++ b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c @@ -32,6 +32,8 @@ static const TopicToCore topicToCoreArray[] = { {TOPIC_EVENT_ACTIVITY_UPDATE, A_CORE_MASK, 1}, {TOPIC_EVENT_INACTIVITY_UPDATE, A_CORE_MASK, 1}, {TOPIC_EVENT_BLE_TRAINING,A_CORE_MASK,1}, + {TOPIC_EVENT_BLE_TRANSMIT,A_CORE_MASK,1}, + #endif #ifdef SUPPORT_SPO2_NOTIFICATION {TOPIC_EVENT_SPO2_UPDATE, A_CORE_MASK, 1}, diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt old mode 100755 new mode 100644 index 78a32aa88..cdb46e334 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -22,6 +22,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include @@ -109,6 +110,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/system/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/phone/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/config/include @@ -125,6 +127,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/uiservice/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include ${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps ${CMAKE_CURRENT_SOURCE_DIR}/../../CustomUIComponentTool/uicomponents/ @@ -160,6 +163,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/findwatch_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/drinkReminder_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sedentaryReminder_notification.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp ) else() set(SOURCES @@ -173,6 +177,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/findwatch_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/drinkReminder_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/sedentaryReminder_notification.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp ) endif() diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h index a2709247c..ea77f4b32 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/charge_notification.h @@ -10,7 +10,7 @@ namespace OHOS UIViewGroup* lowPowerShow(void); void set_lowpower_falg(uint8_t falg); void FreelowPower(void); - void low_power_paly(); + void low_power_play(); class lowppowrAnimatorStopListener :public OHOS::UIImageAnimatorView::AnimatorStopListener { diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h b/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h old mode 100755 new mode 100644 index d4a772899..a72fb113b --- a/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h @@ -24,6 +24,7 @@ #include "alarm_notification.h" #include "makephone_notification.h" #include "charge_notification.h" +#include "transmitting.h" #include "pairing_notification.h" #include "findwatch_notification.h" #include "drinkReminder_notification.h" diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/transmitting.h b/code/sdk/application/wearable/service/msg_center/include/notify/transmitting.h new file mode 100644 index 000000000..ab79ce3b4 --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/include/notify/transmitting.h @@ -0,0 +1,64 @@ +#ifndef TRANSMITTING_H +#define TRANSMITTING_H +#include "components/ui_image_animator.h" + +namespace OHOS +{ + // UIViewGroup *ChargingStatuShow(void); + // UIView *view_ = nullptr; + + typedef enum transmitting_type_t { + TRANS_DIAL_TRANSMITTING, + TRANS_DIAL_SUCC, + TRANS_DIAL_FAIL, + + TRANS_OTA_TRANSMITTING, + TRANS_OTA_SUCC, + TRANS_OTA_FAIL, + + TRANS_FREE, + } transmitting_type_t; + + UIViewGroup* transmittingShow(void); + void set_transmittingShow_falg(uint8_t falg); + void Freetransmitting(void); + + class transmittingViewEventListener : public OHOS::UIView::OnClickListener, + public OHOS::UIView::OnLongPressListener, + public OHOS::UIView::OnTouchListener, + public OHOS::UIView::OnDragListener + { +public: + transmittingViewEventListener(); + virtual ~transmittingViewEventListener(); + static transmittingViewEventListener *GetInstance(void); + + bool OnClick(OHOS::UIView& view, const OHOS::ClickEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override + { + return true; + } + bool OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event) override + { + return true; + } + virtual bool OnPress(OHOS::UIView& view, const OHOS::PressEvent& event) override + { + return true; + } + virtual bool OnLongPress(OHOS::UIView& view, const OHOS::LongPressEvent& event) override + { + return true; + } + virtual bool OnRelease(OHOS::UIView& view, const OHOS::ReleaseEvent& event) override + { + return true; + } + + virtual bool OnDragStart(OHOS::UIView& view, const OHOS::DragEvent& event) override + { + return true; + } +}; +}; +#endif /* CHARGE_NOTIFICATION_H */ \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 0b69e0ed6..d4830a4ba 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -62,6 +62,7 @@ const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_INACTIVITY_UPDATE,PRIORITY_TWO}, {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO}, + {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_TWO}, #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO}, {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO}, @@ -135,6 +136,8 @@ void MsgCenterSubscribe() MsgCenterSubscribeTopic(TOPIC_EVENT_ACTIVITY_UPDATE); MsgCenterSubscribeTopic(TOPIC_EVENT_INACTIVITY_UPDATE); MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRAINING); + MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRANSMIT); + #endif #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION @@ -238,6 +241,13 @@ static OHOS::UIViewGroup* showSedentaryReminderNotify(void) return OHOS::CreateSedentaryReminderView(); } + +/*显示传输中*/ +static OHOS::UIViewGroup* showtransmitNotify(void) +{ + return OHOS::transmittingShow(); +} + void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) { unused(req); @@ -323,7 +333,7 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req) if(*x==3) { //倒计时结束后,直接执行关机动画 - low_power_paly(); + low_power_play(); } else if(*x==0) { @@ -666,7 +676,7 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); CallerLogModel::GetInstance()->SetNotifyFlag(true); #ifdef FD230 - //NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true); + NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true); #endif @@ -791,7 +801,7 @@ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true); - //low_power_paly(true); + //low_power_play(true); break; case REBOOT: set_lowpower_falg(4); @@ -800,7 +810,7 @@ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(showlowpowerNotify, (uint16_t)topic, true); - //low_power_paly(false); + //low_power_play(false); break; default: @@ -955,6 +965,29 @@ void MsgCenterNotifybleAPPtraining(const Topic topic, Request* req) // unused(req); } + +void MsgCenterNotifybleTransmit(const Topic topic, Request* req) +{ + unused(topic); + uint8_t* data=(uint8_t*)req->data; + + if(data[0]==TRANS_FREE) + { + NotificationManager::GetInstance()->StopNotify(); + } + else + { + set_transmittingShow_falg(data[0]); + + if(NotificationManager::GetInstance()->HasNotifyShowing()) + NotificationManager::GetInstance()->StopNotify(); + + NotificationManager::GetInstance()->ShowNotify(showtransmitNotify, (uint16_t)topic, true); + } + // unused(req); + +} + /* 订阅事件通知逻辑可定制 */ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_ALARM_RING, MsgCenterNotifyAlarmProc}, @@ -970,6 +1003,8 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_ACTIVITY_UPDATE, MsgCenterNotifyActivityProc}, {TOPIC_EVENT_INACTIVITY_UPDATE, MsgCenterNotifyInactivityProc}, {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining}, + {TOPIC_EVENT_BLE_TRANSMIT, MsgCenterNotifybleTransmit}, + #endif #ifdef FD230 #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp index c057d456d..5fe43358b 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/charge_notification.cpp @@ -176,7 +176,7 @@ namespace OHOS } - void low_power_paly() + void low_power_play() { //uapi_poweroff_device(); // 关机 @@ -328,7 +328,7 @@ namespace OHOS if(battery_falg) { osTimerStop(low_power_timer); - low_power_paly(); + low_power_play(); } else diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp index 7878009e2..29c55c339 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp @@ -37,6 +37,8 @@ void NotificationManager::FreeNotifyViews() #ifdef FD230 FreeCalldialView(); #endif + Freetransmitting(); + FreeFindWatchView(); FreelowPower(); FreeDrinkReminderView(); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp new file mode 100644 index 000000000..b76cb6d03 --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/src/notify/transmitting.cpp @@ -0,0 +1,584 @@ +#include "notification_manager.h" +#include "wearable_log.h" +#include "UiConfig.h" +#include "AlarmPopUpPresenter.h" +#include "components/ui_image_view.h" +#include "components/ui_label.h" +#include "components/ui_label_ext.h" +#include "components/ui_label_button_ext.h" +#include "battery_service.h" +#include "NativeAbility.h" +#include "custom_utils.h" +#include "components/ui_slider.h" +// #include "UiConfig.h" +#include "bleEvent.h" + +namespace OHOS +{ + static UIImageView *imageCharge = nullptr; + static UIViewGroup *UIViewGroup_transmitting=nullptr; + + static UIImageView *transmitting_img=nullptr; + + static UISlider *updatasider=nullptr; + + static UILabel *Title=nullptr; + + static UILabel *label_=nullptr; + + static UIImageAnimatorView *downImageAnimatorView=nullptr; + + static constexpr char *ShutDownPaths = "/user/res/down/"; //关机图片路径 + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 24; // 图片帧数 + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150; // 图片更新间隔 + static ImageAnimatorInfo ImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息 + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_X = 183; + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y = 140; + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_W = 100; + static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 100; + static const char **PathsArray{nullptr}; // 关机图片路径数组 + + #define TRANSMITTING_SUCC_PATH PNG_SUCC_IMAGE; + #define TRANSMITTING_FAIL_PATH PNG_ATTENTION_IMAGE; + #define TRANSMITTING_OTA_DOWN "/user/res/system/KUMILOGO.bin" + + + + #define LOW_POWER_BUTTON "LOW_POWER_BUTTON" + + static const char ** CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages) + { + const char **imagePaths = new const char *[numImages]; + char buffer[256]; + for (int i = 0; i < numImages; i++) + { + snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension); + imagePaths[i] = strdup(buffer); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]); + } + return imagePaths; + } + + static void CreatetransmittingAnimator(void) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownAnimatorView::ShowUpShutDownAnimatorView"); + PathsArray = CreateImagePathsArray(ShutDownPaths, "bin", SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + + if (downImageAnimatorView == nullptr) + { + downImageAnimatorView = new UIImageAnimatorView(); + if (downImageAnimatorView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView new downImageAnimatorView fail"); + return; + } + for (uint8_t i = 0; i < SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) + { + ImageInfo[i].imagePath = (PathsArray[i]); + ImageInfo[i].imageType = IMG_SRC_FILE_PATH; + ImageInfo[i].pos.x = SHUTDOWN_IMAGE_ANIMATOR_VIEW_X; + ImageInfo[i].pos.y = SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y; + ImageInfo[i].width = SHUTDOWN_IMAGE_ANIMATOR_VIEW_W; + ImageInfo[i].height = SHUTDOWN_IMAGE_ANIMATOR_VIEW_H; + } + downImageAnimatorView->SetPosition(SHUTDOWN_IMAGE_ANIMATOR_VIEW_X, SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y, SHUTDOWN_IMAGE_ANIMATOR_VIEW_W, SHUTDOWN_IMAGE_ANIMATOR_VIEW_H); + downImageAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + downImageAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + downImageAnimatorView->SetImageAnimatorSrc(ImageInfo, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES, 100); + downImageAnimatorView->SetRepeat(true); + downImageAnimatorView->SetRepeatTimes(1); + + } + downImageAnimatorView->SetVisible(true); + downImageAnimatorView->Start(); + //downImageAnimatorView->Start(); + + return ; + } + + + + + static uint8_t Transmitting_falg=1; + void set_transmittingShow_falg(uint8_t falg) + { + Transmitting_falg=falg; + } + + static osTimerId_t transmitting_timer= NULL; + + void Freetransmitting(void) + { + if (UIViewGroup_transmitting != nullptr) + { + UIViewGroup_transmitting->RemoveAll(); + + if(transmitting_img) + { + delete transmitting_img; + transmitting_img = nullptr; + } + if(Title) + { + delete Title; + Title = nullptr; + } + if(label_) + { + delete label_; + label_ = nullptr; + } + if(downImageAnimatorView) + { + delete downImageAnimatorView; + downImageAnimatorView = nullptr; + } + if(updatasider) + { + delete updatasider; + updatasider = nullptr; + } + if(transmitting_timer) + { + osStatus_t ret = osTimerDelete(transmitting_timer); + if (ret != osOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Disatransmitting_timer failed ret = %lx!", ret); + return; + } + transmitting_timer = nullptr; + } + + + RootView::GetInstance()->Remove(UIViewGroup_transmitting); + delete UIViewGroup_transmitting; + UIViewGroup_transmitting = nullptr; + } + } + static uint8_t timer_falg_low_power=5; + + void OTATimerCallBack(int data) + { + updatasider->SetValue(get_OTA_recv_value()); + RootView::GetInstance()->Invalidate(); + } + + + + void creat_down_OTA() + { + if (Title == nullptr) { + Title = new UILabel(); + } + Title->SetPosition(158, 51); // widget's left position and top position + Title->Resize(800, 88); // widget's width and height + Title->SetViewId("label1");// Set style + Title->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + Title->SetText("OTA下载中"); + Title->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + Title->SetRollSpeed(0); + Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + + // Add to rootView + UIViewGroup_transmitting->Add(Title); + updatasider = new UISlider(); + if (updatasider == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView new fail"); + return ; + } + + updatasider->SetSliderColor(Color::Gray(), Color::Silver()); + updatasider->SetPosition(63, 317, 340, 50); + updatasider->SetViewId("SystemUpdateView_updatasider"); + updatasider->SetRange(0, 100); + + updatasider->SetStyle(STYLE_BORDER_RADIUS, 100); + updatasider->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + updatasider->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + updatasider->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + updatasider->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff); + updatasider->SetDraggable(false); + updatasider->SetTouchable(false); + updatasider->SetValue(0); + UIViewGroup_transmitting->Add(updatasider); + //Add ImageView to App + transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); + return ; + } + transmitting_img->SetPosition(117, 87, 230, 160); + const char *imagesPath = TRANSMITTING_OTA_DOWN; + transmitting_img->SetSrc(imagesPath); + UIViewGroup_transmitting->Add(transmitting_img); + + uint32_t tick; + osStatus_t retTimer; + + Set_OTA_recv_value(); + transmitting_timer = osTimerNew((osTimerFunc_t)OTATimerCallBack, osTimerPeriodic, NULL, NULL); + tick =500;// osMs2Tick(1000); + retTimer = osTimerStart(transmitting_timer, tick); + if (retTimer != osOK && transmitting_timer != NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); + osTimerDelete(transmitting_timer); + transmitting_timer = NULL; + return ; + } + } + + + void creat_down_OTA_FAIL() + { + if (Title == nullptr) { + Title = new UILabel(); + } + Title->SetPosition(143, 51); // widget's left position and top position + Title->Resize(800, 88); // widget's width and height + Title->SetViewId("label1");// Set style + Title->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + Title->SetText("OTA下载失败"); + Title->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + Title->SetRollSpeed(0); + Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + + // Add to rootView + UIViewGroup_transmitting->Add(Title); + if (label_ == nullptr) { + label_ = new UILabel(); + } + label_->SetPosition(60, 281); // widget's left position and top position + label_->Resize(345, 101); // widget's width and height + label_->SetViewId("label2");// Set style + label_->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + label_->SetText("下载升级包失败,请退出或者重新下载"); + + label_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + label_->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff)); + label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_->SetRollSpeed(0); + label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + UIViewGroup_transmitting->Add(label_); + + //Add ImageView to App + transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); + return ; + } + transmitting_img->SetPosition(117, 87, 230, 160); + const char *imagesPath = TRANSMITTING_OTA_DOWN; + transmitting_img->SetSrc(imagesPath); + UIViewGroup_transmitting->Add(transmitting_img); + } + + void creat_down_OTA_SUCC() + { + if (Title == nullptr) { + Title = new UILabel(); + } + Title->SetPosition(143, 51); // widget's left position and top position + Title->Resize(800, 88); // widget's width and height + Title->SetViewId("label1");// Set style + Title->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + Title->SetText("OTA下载成功"); + Title->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + Title->SetRollSpeed(0); + Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + + // Add to rootView + UIViewGroup_transmitting->Add(Title); + + if (label_ == nullptr) { + label_ = new UILabel(); + } + label_->SetPosition(60, 281); // widget's left position and top position + label_->Resize(345, 101); // widget's width and height + label_->SetViewId("label2");// Set style + label_->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + label_->SetText("下载升级包成功,可以开始升级手表"); + label_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + label_->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff)); + label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_->SetRollSpeed(0); + label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + // Add to rootView + UIViewGroup_transmitting->Add(label_); + + + //Add ImageView to App + transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); + return ; + } + transmitting_img->SetPosition(117, 87, 230, 160); + const char *imagesPath = TRANSMITTING_OTA_DOWN; + transmitting_img->SetSrc(imagesPath); + UIViewGroup_transmitting->Add(transmitting_img); + } + + + + + void creat_down_Dial() + { + if (Title == nullptr) { + Title = new UILabel(); + } + Title->SetPosition(158, 51); // widget's left position and top position + Title->Resize(800, 88); // widget's width and height + Title->SetViewId("label1");// Set style + Title->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + Title->SetText("表盘安装中"); + Title->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + Title->SetRollSpeed(0); + Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + // Add to rootView + UIViewGroup_transmitting->Add(Title); + Title->SetVisible(true); + + + if (label_ == nullptr) { + label_ = new UILabel(); + } + label_->SetPosition(60, 281); // widget's left position and top position + label_->Resize(345, 101); // widget's width and height + label_->SetViewId("label2");// Set style + label_->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + label_->SetText("正在安装表盘,请不要做其他操作或关闭手表"); + label_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + label_->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff)); + label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_->SetRollSpeed(0); + label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + // Add to rootView + UIViewGroup_transmitting->Add(label_); + label_->SetVisible(true); + + CreatetransmittingAnimator(); + // UIViewGroup_transmitting->Add(updatasider); + + UIViewGroup_transmitting->Add(downImageAnimatorView); + } + + + + + + + void creat_down_Dial_succ() + { + if (Title == nullptr) { + Title = new UILabel(); + } + Title->SetPosition(173, 51); // widget's left position and top position + Title->Resize(800, 88); // widget's width and height + Title->SetViewId("label1");// Set style + Title->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + Title->SetText("安装成功"); + Title->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + Title->SetRollSpeed(0); + Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + // Add to rootView + UIViewGroup_transmitting->Add(Title); + Title->SetVisible(true); + + + if (label_ == nullptr) { + label_ = new UILabel(); + } + label_->SetPosition(60, 281); // widget's left position and top position + label_->Resize(345, 101); // widget's width and height + label_->SetViewId("label2");// Set style + label_->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + label_->SetText("表盘安装成功正在更新表盘,请稍等"); + label_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + label_->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff)); + label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_->SetRollSpeed(0); + label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + + transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); + return ; + } + transmitting_img->SetPosition(193, 150,80, 80); + const char *imagesPath = TRANSMITTING_SUCC_PATH; + transmitting_img->SetSrc(imagesPath); + UIViewGroup_transmitting->Add(transmitting_img); + + // Add to rootView + UIViewGroup_transmitting->Add(label_); + label_->SetVisible(true); + } + + void creat_down_Dial_fail() + { + if (Title == nullptr) { + Title = new UILabel(); + } + Title->SetPosition(173, 51); // widget's left position and top position + Title->Resize(800, 88); // widget's width and height + Title->SetViewId("label1");// Set style + Title->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + Title->SetText("安装失败"); + Title->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + Title->SetRollSpeed(0); + Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + // Add to rootView + UIViewGroup_transmitting->Add(Title); + Title->SetVisible(true); + + + if (label_ == nullptr) { + label_ = new UILabel(); + } + label_->SetPosition(60, 281); // widget's left position and top position + label_->Resize(345, 101); // widget's width and height + label_->SetViewId("label2");// Set style + label_->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + label_->SetText("表盘安装失败,请退出或重新安装"); + label_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + label_->SetTextColor(Color::GetColorFromRGBA(0xAA, 0xAA, 0xAA, 0xff)); + label_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_->SetRollSpeed(0); + label_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + + transmitting_img = new UIImageView(); + if (transmitting_img == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemUpdateView::KUMILOGOImage new fail!"); + return ; + } + transmitting_img->SetPosition(193, 150,80, 80); + const char *imagesPath = TRANSMITTING_FAIL_PATH; + transmitting_img->SetSrc(imagesPath); + UIViewGroup_transmitting->Add(transmitting_img); + + // Add to rootView + UIViewGroup_transmitting->Add(label_); + label_->SetVisible(true); + + + + } + + + + + UIViewGroup *transmittingShow() + { + + if (UIViewGroup_transmitting == nullptr) { + UIViewGroup_transmitting = new UIViewGroup(); + UIViewGroup_transmitting->SetPosition(0, 0, 466, 466); + //UIViewGroup_transmitting->SetStyle(STYLE_BACKGROUND_OPA, 0); + } + + switch (Transmitting_falg) + { + case TRANS_DIAL_TRANSMITTING: + creat_down_Dial(); + break; + case TRANS_DIAL_SUCC: + creat_down_Dial_succ(); + break; + case TRANS_DIAL_FAIL: + creat_down_Dial_fail(); + break; + case TRANS_OTA_TRANSMITTING: + creat_down_OTA(); + break; + case TRANS_OTA_SUCC: + creat_down_OTA_SUCC(); + break; + case TRANS_OTA_FAIL: + creat_down_OTA_FAIL(); + break; + default: + break; + } + + UIView::OnClickListener *button1Click = static_cast(transmittingViewEventListener::GetInstance()); + UIViewGroup_transmitting->SetOnClickListener(button1Click); + UIViewGroup_transmitting->SetTouchable(true); + + + + + return UIViewGroup_transmitting; + } + + transmittingViewEventListener::transmittingViewEventListener() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallViewEventListener :%p", this); + } + + transmittingViewEventListener::~transmittingViewEventListener() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "~CallViewEventListener"); + } + + transmittingViewEventListener *transmittingViewEventListener::GetInstance(void) + { + static transmittingViewEventListener lowppowrViewEventListene_t; + return &lowppowrViewEventListene_t; + } + + bool transmittingViewEventListener::OnClick(UIView& view, const ClickEvent& event) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick"); + if(Transmitting_falg!=TRANS_DIAL_TRANSMITTING && Transmitting_falg!=TRANS_OTA_TRANSMITTING) + { + NotificationManager::GetInstance()->StopNotify(); + } + return true; + UNUSED(event); + } + +} diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/OK.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/OK.bin new file mode 100644 index 000000000..53b7d17d4 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/OK.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc5b0d633a9631629f6c1521d0c4248901d95418b970085cd6af81d9d5529b9f +size 4504 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/1.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/1.bin new file mode 100644 index 000000000..dec72b052 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8807ede1a6212f95e910b70737e4004bd54fef54d922caa5c628a727efe90791 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/10.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/10.bin new file mode 100644 index 000000000..0e96994df --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/10.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:787ad30d145e5d095e8706aa1b20feedad4a9615595d8733b4b06b2a54848e0f +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/11.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/11.bin new file mode 100644 index 000000000..50d9603b7 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/11.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc0a9c9001aa93c86b586759598a439ea68c89ac3482727c547e5b39b66695b7 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/12.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/12.bin new file mode 100644 index 000000000..f81f97bac --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/12.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0d79fee48e0081d29c1bf9802f9620125528d1ad42200ffcac39414ebd961f4 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/13.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/13.bin new file mode 100644 index 000000000..52d6003ac --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/13.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:371451f404360ed1da36978fd4d2ab4a7b86279bb8fdb669d1127017ec0b69fe +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/14.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/14.bin new file mode 100644 index 000000000..554fc4c38 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/14.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9136a3abe49e20da637a757c712142be7ec34ef9676f35636c6e424f21a8bc60 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/15.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/15.bin new file mode 100644 index 000000000..7af0a9edb --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/15.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:026853ffa7586ddf585038adea3f27c78ac897b844acbd18eb55bb211eebf97b +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/16.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/16.bin new file mode 100644 index 000000000..00f55e2bf --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/16.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91940a1910c3fc9ff0338e6ddec59f0a48123da3a2519942f08ebef9e9a69974 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/17.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/17.bin new file mode 100644 index 000000000..eafd4bf7b --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/17.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:516314d3f4e77486d3f53744a5f266399f3d867535224bcaa4f2fe2e42f1aa5c +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/18.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/18.bin new file mode 100644 index 000000000..39eeb0955 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/18.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3833e23269ab013046832288985e787f991b71b8148fe83dcf96dff40b321444 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/19.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/19.bin new file mode 100644 index 000000000..a826e705a --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/19.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b78a444a260e653e5dc33da43e220bfe5b301dba89468bb05c3c997e38304c6 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/2.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/2.bin new file mode 100644 index 000000000..c2ac36b41 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8c4ba29c472c82d4f150506d3d36bd920052077708bf2e075705539985abb45 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/20.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/20.bin new file mode 100644 index 000000000..af536bfbf --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/20.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b644390b4b92e3e83e7ab764b7751ffb6fc92bd49e2f3f102bcdf0451753be49 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/21.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/21.bin new file mode 100644 index 000000000..50560e70c --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/21.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:032997a1a5fdd98e8a8f5bbb8b2b045da56f7a8b1e58494cf0a994019da4c09f +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/22.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/22.bin new file mode 100644 index 000000000..56c552aa1 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/22.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59dbc6f05152c7148cda791103e6dbc4c488790ae3c99616d83010339b4dab71 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/23.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/23.bin new file mode 100644 index 000000000..dec72b052 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/23.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8807ede1a6212f95e910b70737e4004bd54fef54d922caa5c628a727efe90791 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/24.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/24.bin new file mode 100644 index 000000000..dec72b052 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/24.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8807ede1a6212f95e910b70737e4004bd54fef54d922caa5c628a727efe90791 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/3.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/3.bin new file mode 100644 index 000000000..a57d24713 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/3.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:456bdc5ed33b1837e32e0820f84b173a24c45f0fcffea3f33a54dbbb30f45546 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/4.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/4.bin new file mode 100644 index 000000000..3467b132b --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/4.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b767067f6c657b617a180e229e158387cebbeacb2d1be4c91d250cf3c2d00e05 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/5.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/5.bin new file mode 100644 index 000000000..7a692f609 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/5.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:042574b3c95ce05c09c89ac8565fa18b15f17a7a99c8155d3e11eb5718529fea +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/6.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/6.bin new file mode 100644 index 000000000..27b4d9a8f --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/6.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2cf48d14d6a0fdfdf1073daa205bf0f1a57edf10343b30237512cbf98afaac2 +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/7.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/7.bin new file mode 100644 index 000000000..0590c549c --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/7.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f8d2931c97c8252721ad125c07e0bb87c54ed3aebbb82ca76baf55bb6e17dbc +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/8.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/8.bin new file mode 100644 index 000000000..f57c6de28 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/8.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd7fd5376eecdf2d1cd884abb6c71792250bff5e4b324848cfa50e5dbb3ff34f +size 7640 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/9.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/9.bin new file mode 100644 index 000000000..6a15ca5b9 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/down/9.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e87efc50c7f443333a8aa0437eabe46862b7c81ffd9e29381141c8c618600b11 +size 7640 diff --git a/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c b/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c index 08d736883..df7fe1ba2 100644 --- a/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c +++ b/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c @@ -330,6 +330,34 @@ void CWM_OS_saveData_history(int* new_data,int *history ,uint32_t len){ fclose(fp); } +#define CWM_HISTORY_STAND_DATA_PATH "/user/userdata/stand_" + +void CWM_OS_saveData_STAND_history(int *time ,uint32_t len){ + char path_[64]={0}; + char timeday[12] = {0}; + uapi_get_YYMMDD_Time(timeday, '_'); + + sprintf_s(path_,64,"%s%s.bin",CWM_HISTORY_STAND_DATA_PATH,timeday); + CWM_OS_dbgPrintf(" save path %s \n",path_); + + FILE * fp = fopen(path_,"ab+"); + if(fp==NULL) + { + CWM_OS_dbgPrintf("open fail\n"); + return; + } + + int ret =fwrite(time,1,len,fp); + if(ret==0) + { + CWM_OS_dbgPrintf("fwrite failed %d\n",ret); + } + //CWM_OS_dbgPrintf("fwrite data %d\n",data); + + *time=0; + + fclose(fp); +} diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 2ceb17497..c6aab10dc 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -798,6 +798,37 @@ errcode_t uapi_get_YYMMDD_Time(char *p_time, char separator) time(&currtime); timeinfo = localtime(&currtime); + // 根据传入的分隔符参数选择中间分隔符 + char sep[2] = {separator, '\0'}; + + // 将年月日信息存储到 p_time 变量中,使用指定的分隔符 + sprintf(p_time, "%02d%s%02d%s%02d", timeinfo->tm_year + 1900, sep, timeinfo->tm_mon + 1, sep, timeinfo->tm_mday); + + return ERRCODE_SUCC; +} + +/** + * @param {char} *p_time + * @param {char} 隔断符 + * @param {uint8_t} n天前 + * @brief 获取日期 + */ +errcode_t uapi_get_YYMMDD_Time_extend(char *p_time, char separator,uint8_t day) +{ + if (p_time == NULL) + { + return ERRCODE_FAIL; // 返回空指针错误码 + } + + time_t currtime; + struct tm *timeinfo; + time(&currtime); + currtime=currtime-day*24*60*60; + // printf("uapi_get_YYMMDD_Time_extend : %d\r\n",currtime); + + timeinfo = localtime(&currtime); + + // 根据传入的分隔符参数选择中间分隔符 char sep[2] = {separator, '\0'}; diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 625f34e58..46863f55f 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -67,6 +67,11 @@ errcode_t uapi_get_yyyymmddhhmmss_Date(char *date); /*获取日期*/ errcode_t uapi_get_YYMMDD_Time(char *p_time, char separator); + +/*获取日期扩展版*/ + +errcode_t uapi_get_YYMMDD_Time_extend(char *p_time, char separator,uint8_t day); + /*获取时间*/ errcode_t uapi_get_HHMMSS_Time(char *p_time, char separator, bool include_seconds); /*获取星期*/ -- 2.17.1