static void qrcode_prepare_destory(lv_obj_t * activity_obj);
static lv_obj_t * qrcode_create_content(lv_obj_t * par);
+#ifdef __MMI_APP_QRCODE_MENU_SUPPORT__
+static void app_qrcode_prepare_destory(lv_obj_t * activity_obj);
+#endif
+#ifdef __MMI_APP_QRCODE_AND_DEVICE_QRCODE_IN_ONE_SUPPORT__
+static void mmi_app_and_device_qrcode_prepare_destory(lv_obj_t * activity_obj);
+#endif
/**********************
* STATIC VARIABLES
**********************/
}
+#ifdef __MMI_APP_QRCODE_FROM_SERVER_SUPPORT__
+
+static uint8_t s_app_qrcode_get_flag = 0;
+
+uint8_t mmi_app_qrcode_get_flag_get(void)
+{
+ return s_app_qrcode_get_flag;
+}
+
+void mmi_app_qrcode_get_flag_set(uint8_t flag)
+{
+ if(0 != flag && 1 != flag)
+ return;
+
+ s_app_qrcode_get_flag = flag;
+}
+
+char * mmi_app_qrcode_file_get(void)
+{
+ return MMI_APP_QRCODE_PNG_FILE;
+}
+
+void mmi_app_qrcode_content_buffer_set(char * qrcode_content, uint32_t content_len)
+{
+ lv_fs_file_t file_p;
+ lv_fs_res_t res;
+ uint32_t bytes_write = 0;
+ uint32_t file_size = 0;
+
+ lv_fs_remove(MMI_APP_QRCODE_PNG_FILE);
+ res = lv_fs_open(&file_p, MMI_APP_QRCODE_PNG_FILE, LV_FS_MODE_WR);
+ if(LV_FS_RES_OK != res)
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: errno=%d\n", __FUNCTION__, __LINE__, res);
+ }
+ else
+ {
+ res = lv_fs_write(&file_p, qrcode_content, content_len, &bytes_write);
+ if(LV_FS_RES_OK == res)
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: file_size=%d,write_size=%d\n", __FUNCTION__, __LINE__, content_len, bytes_write);
+ mmi_app_qrcode_get_flag_set(1);
+ }
+ }
+ lv_fs_close(&file_p);
+}
+
+bool mmi_app_qrcode_refresh_prompt(void)
+{
+ lv_fs_file_t file_p;
+ lv_fs_res_t res;
+ uint32_t file_size = 0;
+
+ res = lv_fs_open(&file_p, MMI_APP_QRCODE_PNG_FILE, LV_FS_MODE_RD);
+ if(LV_FS_RES_OK == res)
+ {
+ lv_fs_size(&file_p, &file_size);
+ lv_fs_close(&file_p);
+ printf("[@CHENG_DEBUG][%s][%d]: file_size=%d\n", __FUNCTION__, __LINE__, file_size);
+ if(128 < file_size)
+ {
+ printf("[@CHENG_DEBUG][%s][%d]: exist\n", __FUNCTION__, __LINE__);
+ return false;
+ }
+ }
+ lv_fs_close(&file_p);
+
+ return true;
+}
+
+void mmi_app_qrcode_refresh_action(lv_obj_t * cont, lv_event_t e)
+{
+ if(LV_EVENT_CLICKED != e)
+ {
+ return;
+ }
+
+ mmi_app_qrcode_get_flag_set(0);
+ mmi_protocol_fzd_action_get_app_qrcode();
+
+ lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_APP_QRCODE);
+ if(NULL != activity_obj)
+ {
+ #ifdef __MMI_APP_QRCODE_MENU_SUPPORT__
+ app_qrcode_prepare_destory(activity_obj);
+ #endif
+ #ifdef __MMI_APP_QRCODE_AND_DEVICE_QRCODE_IN_ONE_SUPPORT__
+ mmi_app_and_device_qrcode_prepare_destory(activity_obj);
+ #endif
+ lv_obj_del(activity_obj);
+ }
+}
+#endif
+
+
#ifdef __MMI_APP_QRCODE_MENU_SUPPORT__
static void app_qrcode_prepare_destory(lv_obj_t * activity_obj)
{
lv_obj_set_click(content, false);
lv_obj_align(content, NULL, LV_ALIGN_CENTER, 0, 0);
+#ifdef __MMI_APP_QRCODE_FROM_SERVER_SUPPORT__
+ if(true == mmi_app_qrcode_refresh_prompt())
+ {
+ lv_obj_set_click(content, true);
+ lv_obj_set_event_cb(content, mmi_app_qrcode_refresh_action);
+
+ lv_obj_t * label = lv_label_create(content, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26);
+ lv_label_set_text_id(label, WATCH_TEXT_ID_APP_QRCODE_REFRESH);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, -10);
+ }
+ else
+ {
+ // img
+ lv_obj_t * img = lv_img_create(content, NULL);
+ lv_img_set_src(img, mmi_app_qrcode_file_get());
+ #ifdef USE_LV_WATCH_UI_CIRCLE
+ #ifdef USE_LV_WATCH_UI_240_240
+ lv_img_set_zoom(img, LV_IMG_ZOOM_NONE * 3 / 4);
+ #else
+
+ #endif
+ #endif
+ lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, -10);
+ lv_obj_set_click(img, false);
+
+ //
+ lv_obj_t * label = lv_label_create(content, NULL);
+ lv_obj_add_style(label, LV_OBJ_PART_MAIN, &lv_watch_font20);
+ lv_label_set_text_id(label, WATCH_TEXT_ID_APP_DOWNLOAD_PROMPT);
+ lv_obj_align(label, img, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
+ lv_obj_set_click(label, false);
+ }
+#else
// img
lv_obj_t * img = lv_img_create(content, NULL);
lv_img_set_src(img, ICON_APP_QRCODE);
lv_label_set_text_id(label, WATCH_TEXT_ID_APP_DOWNLOAD_PROMPT);
lv_obj_align(label, img, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
lv_obj_set_click(label, false);
+#endif
return obj;
}
char imei[16] = {0};
app_adp_get_imei_req(imei);
+#ifdef __MMI_APP_QRCODE_FROM_SERVER_SUPPORT__
+ if(true == mmi_app_qrcode_refresh_prompt())
+ {
+ lv_obj_set_click(content, true);
+ lv_obj_set_event_cb(content, mmi_app_qrcode_refresh_action);
+
+ lv_obj_t * label = lv_label_create(content, NULL);
+ lv_obj_add_style(label, LV_LABEL_PART_MAIN, &lv_watch_font26);
+ lv_label_set_text_id(label, WATCH_TEXT_ID_APP_QRCODE_REFRESH);
+ lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
+ lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, -10);
+ }
+ else
+ {
+ // img
+ lv_obj_t * img = lv_img_create(content, NULL);
+ lv_img_set_src(img, mmi_app_qrcode_file_get());
+ #ifdef USE_LV_WATCH_UI_CIRCLE
+ #ifdef USE_LV_WATCH_UI_466_466
+ lv_img_set_zoom(img, LV_IMG_ZOOM_NONE * 3 / 2);
+ #else
+ lv_img_set_zoom(img, LV_IMG_ZOOM_NONE * 3 / 4);
+ #endif
+ #endif
+ lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, -10);
+ lv_obj_set_click(img, false);
+ }
+#else
char str_qrcode[256] = {0};
sprintf(str_qrcode, "%s%s", MMI_QRCODE_CONTENT_PREFIX, imei);
lv_obj_t * qrcode = qrcode_gen(content, str_qrcode, 0, 0, QRCODE_WIDTH);
lv_obj_align(qrcode, content, LV_ALIGN_CENTER, 0, 0);
+#endif
lv_obj_t * label = lv_label_create(obj, NULL);
#if USE_LV_WATCH_UI_CIRCLE