From 37f7cd148145d9cefe19a99dfdf5011944e3099c Mon Sep 17 00:00:00 2001 From: xiaojiazhu Date: Fri, 10 Nov 2023 16:37:10 +0800 Subject: [PATCH] Add sending picture message in ui. --- .../cardv/SrcCode/UIApp/Photo/UIAppPhoto.h | 8 +++ .../UIFlowPhoto/UIFlowPhotoEventCallback.c | 56 ++++++++++++++++++- .../source/sf_app/code/source/4gMng/sf_ftp.c | 1 + .../lib/source/sifar/code/include/sf_common.h | 9 +++ .../sifar/code/source/common/sf_common.c | 20 +++++++ 5 files changed, 92 insertions(+), 2 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto.h b/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto.h index 765bf8335..4f7017cf6 100755 --- a/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto.h +++ b/code/application/source/cardv/SrcCode/UIApp/Photo/UIAppPhoto.h @@ -270,11 +270,19 @@ typedef enum { /* INSERT NEW EVENT HRER */ //Event post from WifTask CB UIAPPPHOTO_CB_UCTRL_UPDATE_UI = 0x14002f40, + NVT_SIFAR_MSG_SCREEN, /* INSERT NEW EVENT HRER */ NVTEVT_PHOTO_EVT_END = APPUSER_PHOTO_BASE + 0x1000 - 1, ///< Max value = 0x14002fff } CUSTOM_PHOTO_EVENT; +// typedef enum { +// NVT_SIFAR_START = NVTEVT_PHOTO_EVT_END, +// NVT_SIFAR_MSG_SCREEN, +// NVT_SIFAR_END +// } NVT_SIFAR_EVENT; + + #define UIAPPPHOTO_CB_MAX UIAPPPHOTO_CB_NULL #if(PHOTO_MODE==ENABLE) diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c index 388f8c573..a0c59718d 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIFlowLVGL/UIFlowPhoto/UIFlowPhotoEventCallback.c @@ -55,6 +55,10 @@ static void task_update_icons_timer_cb(lv_task_t* task); static unsigned long KeyLeftPressingTimeMs = 0; static unsigned long KeyDownPressingTimeMs = 0; +#define SENDING_KEEP_SHOW -1 +#define SENDING_NOT_SHOW 0 +static int SendMsgShow = SENDING_NOT_SHOW; + static BOOL g_PhotoBgInitFileSys = FALSE; @@ -388,7 +392,15 @@ static void update_4g_module_icon(void) { // Nothing changed. // printf(" nothing changed.\n"); - } + } + if (SENDING_NOT_SHOW < SendMsgShow) + { + SendMsgShow--; + if (SENDING_NOT_SHOW == SendMsgShow) + { + lv_obj_set_hidden(label_sim_scr_uiflowphoto, true); + } + } const int EMPTY_IMAGE = 0; lv_plugin_res_id res[] = { EMPTY_IMAGE, @@ -1430,7 +1442,42 @@ void UIFlowPhoto_UpdateInfo(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* msg) return ; } - +static void sf_show_send_text(lv_obj_t* obj, const unsigned short status) +{ + #define SENDING_KEEP_SHOW_TIME_S 3 + switch (status) + { + case FILE_SENDING_GUI_START_SENDING: + { + lv_obj_set_hidden(label_sim_scr_uiflowphoto, false); + lv_label_set_text(label_sim_scr_uiflowphoto, "Sending ... "); + SendMsgShow = SENDING_KEEP_SHOW; + break; + } + case FILE_SENDING_GUI_STOP_SENDING: + { + lv_obj_set_hidden(label_sim_scr_uiflowphoto, true); + SendMsgShow = SENDING_NOT_SHOW; + break; + } + case FILE_SENDING_GUI_SEND_SUCCEED: + { + lv_obj_set_hidden(label_sim_scr_uiflowphoto, false); + lv_label_set_text(label_sim_scr_uiflowphoto, "Success"); + SendMsgShow = SENDING_KEEP_SHOW_TIME_S; + break; + } + case FILE_SENDING_GUI_SEND_FAILED: + { + lv_obj_set_hidden(label_sim_scr_uiflowphoto, false); + lv_label_set_text(label_sim_scr_uiflowphoto, "Fail"); + SendMsgShow = SENDING_KEEP_SHOW_TIME_S; + break; + } + default: + break; + } +} static void UIFlowPhoto_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* msg) { @@ -1480,6 +1527,11 @@ static void UIFlowPhoto_NVTMSG(lv_obj_t* obj, const LV_USER_EVENT_NVTMSG_DATA* m break; } } + case NVT_SIFAR_MSG_SCREEN: + { + sf_show_send_text(obj, msg->paramArray[0]); + break; + } default: break; diff --git a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c index db6f2b4a7..b33b3b98b 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_ftp.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_ftp.c @@ -17,6 +17,7 @@ * Ver: 1.0.0 2021.04.12 * Description: creat **************************************************************************/ +#include "NvtUser/NvtUser.h" #include #include #include diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index e577e8e5a..01dff5240 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -23,6 +23,14 @@ typedef enum sfBLE_STATUS_E SF_BLE_BUTT, } SF_BLE_STATUS_E; +typedef enum{ + FILE_SENDING_GUI_START_SENDING = 0, + FILE_SENDING_GUI_STOP_SENDING, + FILE_SENDING_GUI_SEND_SUCCEED, + FILE_SENDING_GUI_SEND_FAILED, + FILE_SENDING_GUI_END +} FILE_SENDING_GUI_E; + void sf_mode_detect(void); int sf_pir_statu_read(void); void sf_set_pir_power_off_flag(BOOL flag); @@ -110,6 +118,7 @@ UINT8 sf_cardv_get_is_esim(void); void sf_cardv_set_operationSelectResp(UINT8 resp); UINT8 sf_cardv_get_operationSelectResp(void); void sf_set_send_statu(BOOL is); +void sf_ui_sending_show(unsigned short status); BOOL sf_get_send_statu(void); void sf_cardv_set_mcu_rtc_flag(void); void sf_hd_flag_init(void); diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index 992467000..c35b43845 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -1780,6 +1780,9 @@ static SINT32 sf_cardv_proccess_cmd_file(SF_MESSAGE_BUF_S *pMessageBuf) case SF_PARA_CMD_UPDATE: sf_share_mem_file_init(); sf_set_send_statu(FALSE); + #define SEND_SUCCEED 0 + #define SEND_FAILED -1 + sf_ui_sending_show(SEND_SUCCEED == pMessageBuf->arg1 ? FILE_SENDING_GUI_SEND_SUCCEED : FILE_SENDING_GUI_SEND_FAILED); if(sf_get_mode_flag()) { sf_wifi_server_stop_shoot_respond((UINT8)pMessageBuf->arg2); @@ -2010,8 +2013,25 @@ BOOL sf_is_preview(void) void sf_set_send_statu(BOOL is) { IsSend = is; + if (TRUE == is) + { + sf_ui_sending_show(FILE_SENDING_GUI_START_SENDING); + } + else + { + sf_ui_sending_show(FILE_SENDING_GUI_STOP_SENDING); + } printf("[%s]:%d IsSend:%d\n", __FUNCTION__, __LINE__,IsSend); } +void sf_ui_sending_show(unsigned short status) +{ +// #define GUI_SHOW_SENDING 1 +// if (TRUE == is) + { + Ux_PostEvent(NVT_SIFAR_MSG_SCREEN, 1, status); + // Ux_PostEvent(NVTEVT_CB_ZOOM, 1, status); + } +} BOOL sf_get_send_statu(void) {