#if 0
/*
 * @Description:
 * @Date: 2022-01-27 12:55:28
 * @LastEditTime: 2023-06-16 11:29:41
 */
#ifndef __LV_COMMON_FUNCTION_H__
#define __LV_COMMON_FUNCTION_H__

#define lv_log_on printf
#include "fr_watch.h"
#include "language_table.h"
#include "fr_lv_public_func.h"

LV_FONT_DECLARE(Number_HarmonyOS_bpp4_180px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_128px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_92px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_80px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_62px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_50px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_46px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_44px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_36px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_20px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_28px);

LV_FONT_DECLARE(Number_HarmonyOS_bpp4_16px);
LV_FONT_DECLARE(Number_HarmonyOS_bpp4_12px);

LV_FONT_DECLARE(MXC_WRYH_CT_bpp4_10px);
LV_FONT_DECLARE(MXC_WRYH_CT_bpp4_16px);
LV_FONT_DECLARE(MXC_WRYH_CT_bpp4_20px);
LV_FONT_DECLARE(MXC_WRYH_CT_bpp4_22px);
LV_FONT_DECLARE(MXC_WRYH_CT_bpp4_30px);
LV_FONT_DECLARE(MXC_WRYH_CT_bpp4_72px);


LV_FONT_DECLARE(arialuni_field_bbp2_32px);

#define     LV_FONT_MXC_WRYH_CT_10PX      &MXC_WRYH_CT_bpp4_10px
#define     LV_FONT_MXC_WRYH_CT_16PX      &MXC_WRYH_CT_bpp4_16px
#define     LV_FONT_MXC_WRYH_CT_20PX      &MXC_WRYH_CT_bpp4_20px
#define     LV_FONT_MXC_WRYH_CT_22PX      &MXC_WRYH_CT_bpp4_22px
#define     LV_FONT_MXC_WRYH_CT_30PX      &MXC_WRYH_CT_bpp4_30px
#define     LV_FONT_MXC_WRYH_CT_72PX      &MXC_WRYH_CT_bpp4_72px


#define     LV_FONT_BIG_NUMBER_180PX      &Number_HarmonyOS_bpp4_180px
#define     LV_FONT_BIG_NUMBER_128PX      &Number_HarmonyOS_bpp4_128px
#define     LV_FONT_BIG_NUMBER_92PX       &Number_HarmonyOS_bpp4_92px
#define     LV_FONT_BIG_NUMBER_80PX       &Number_HarmonyOS_bpp4_80px
#define     LV_FONT_BIG_NUMBER_62PX       &Number_HarmonyOS_bpp4_62px
#define     LV_FONT_BIG_NUMBER_50PX       &Number_HarmonyOS_bpp4_50px
#define     LV_FONT_BIG_NUMBER_46PX       &Number_HarmonyOS_bpp4_46px
#define     LV_FONT_BIG_NUMBER_44PX       &Number_HarmonyOS_bpp4_44px
#define     LV_FONT_MEDIUM_NUMBER_36PX    &Number_HarmonyOS_bpp4_36px
#define     LV_FONT_SMALL_NUMBER_20PX     &Number_HarmonyOS_bpp4_20px
#define     LV_FONT_MEDIUM_NUMBER_28PX    &Number_HarmonyOS_bpp4_28px
#define     LV_FONT_SMALL_NUMBER_16PX     &Number_HarmonyOS_bpp4_16px
#define     LV_FONT_SMALL_NUMBER_12PX     &Number_HarmonyOS_bpp4_12px

#define     LV_FONT_ARIALUNI_ALL_32PX      &arialuni_field_bbp2_32px

typedef void (*ui_func)(lv_obj_t *parent,lv_point_t *top);


uint8_t get_pri_ui_group_index(pri_ui_entry func);


void layer_add_right_main_cont(lv_obj_t *parent, ui_entry f_cont1);
bool fr_app_UI_return_flag(void);


extern void UI_return_click_cb(lv_event_t *e);

typedef enum
{
	UI_MAIN_FLOAT = 0,
	UI_APP_START_SKY,
	UI_APP_OTA,
	UI_APP_INCOMING,
	UI_APP_MSG_FLOAT,
	UI_APP_SPORT_DETAIL,

	//up
	UI_APP_VOL_SETTING,
	UI_APP_LIGHTING,

	// left
	UI_APP_MUSIC,
	UI_APP_HEART_DECT,
	UI_APP_BLOODPRESS,
	UI_APP_BLOODOXYGEN,
	UI_APP_SPORT_MAIN,
	UI_APP_BREATHE,
	UI_APP_DIAL_MAIN,
	// UI_APP_QRCODE,

	//setting
	UI_APP_SETTING_MAIN,
	//------------
	UI_APP_DISPLAY_WATCHFACE,
	UI_APP_DISPLAY_MENU_VIEW,
	UI_APP_ABOUT_QRCODE,

	UI_APP_SETTING_DISPLAY,
	UI_APP_RAISETOWAKE,
	UI_APP_PHONE_SEARCH,

	UI_APP_SETTING_VIOCE,
	UI_APP_CONTROL_RESTART,
	UI_APP_CONTROL_POWER_OFF,

	UI_APP_CONTROL_FACTORY_RESET,
	UI_APP_ABOUT_VERSION,
	UI_APP_PASSWORD,

	UI_APP_SETTING_LANGUAGE,
	UI_APP_LOWPOWER,
	//-------------------------------------
	//第3级界面
	UI_APP_DISPLAY_BRIGHT,
	UI_APP_DISPLAY_TIME,//熄屏与常亮意义一样
	//-------------------------------------
	UI_APP_CHARGE,
	UI_APP_TAKE_PIC,
	//UI_APP_PHONE_SEARCH,
	UI_APP_CALL,
	UI_APP_CALL_LIST,

	UI_APP_MESSAGE,
	UI_APP_TODAY_SLEEP,
	UI_APP_STOPWATH,
	UI_APP_WEATHER,
	UI_APP_CALENDAR,

	UI_APP_TODAY_DATA,
	UI_APP_ALARM,
	UI_APP_COUNTDOWN,
	UI_APP_COUNTING,
	UI_APP_COUNTDOWN_USERDEFINED,
	//-------------------
	UI_APP_POP_STEP_TARGET,
	UI_APP_POP_ALARM,
	UI_APP_POP_LONGSIT,
	UI_APP_POP_DRINK,
	//-------------------
	UI_APP_ALARM_CLOCK_EDIT,
	UI_APP_ALARM_REPEAT_SELECT,
	UI_APP_CALCULATOR,
	//---------------------------------
	UI_APP_PHONE_BOOK,

	//=================================
	#if ALIPAY_FUNC_ENABLE
	UI_APP_UPAY_BIND_POTOL,
	UI_APP_UPAY_BIND_GUIDE,
	UI_APP_UPAY_BIND_QRCODE,
	UI_APP_UPAY_BIND_POLLING,
	UI_APP_UPAY_BIND_RESULT,
	UI_APP_UPAY_PAY_BARCODE,
	UI_APP_UPAY_PAY_QRCODE,
	UI_APP_UPAY_SET,
	UI_APP_UPAY_UNBIND,
	UI_FAST_UPAY_AGREE_POTOL,
	UI_FAST_UAPY_PAYCODE,
	#endif
	UI_SPORT_RESULT,


	UI_APP_UI_MAX,

} ui_type_t;

typedef enum
{
	STYLE_TYPE_ABOUT = 0,
	STYLE_TYPE_ALARM,
	// STYLE_TYPE_ALIPAY,
	STYLE_TYPE_BREATHE,
	STYLE_TYPE_BRIGHTNESS,
	STYLE_TYPE_CALLOG,
	STYLE_TYPE_CAMERA,
	STYLE_TYPE_WATCHFACE,
	STYLE_TYPE_CODE,
	STYLE_TYPE_SPORT,
	STYLE_TYPE_FIND,
	STYLE_TYPE_FLASHLIGHT,
	STYLE_TYPE_GAME,
	STYLE_TYPE_HR,
	STYLE_TYPE_LANGUAGE,
	STYLE_TYPE_MESSAGES,
	STYLE_TYPE_MUSIC,
	STYLE_TYPE_CALL,
	STYLE_TYPE_PHONEBOOK,
	STYLE_TYPE_POWEROFF,
	STYLE_TYPE_RESART,
	STYLE_TYPE_RESET_FACTORY,
	STYLE_TYPE_SLEEP,
	STYLE_TYPE_STEP,
	STYLE_TYPE_STOPWATCH,
	STYLE_TYPE_TIMER,			//倒计�?
	STYLE_TYPE_WEALTHER,
	STYLE_TYPE_RAISETOWAKE,	//翻腕
	STYLE_TYPE_CALENDAR,
}style_type_enum;

extern const uint8_t style_func_id[];
extern const pri_ui_entry style_func_arry[];
#define UI_LAYER_ACTIVE_TAG 0x80
// layer_page
//     page = (UI_lAYER1_lEVEL_TAG | page_id)
void dsp_store_ui_scene(uint8_t mode, uint8_t layer, uint8_t page, uint16_t page_cur_x, uint16_t page_cur_y);
void dsp_set_ui_scene_default_style(uint8_t type);
uint8_t dsp_get_ui_scene_default_style(void);
uint8_t dsp_get_ui_scene_mode(void);
uint8_t dsp_get_ui_scene_prev_mode(void);
uint8_t dsp_get_ui_scene_layer(void);
uint8_t dsp_get_ui_scene_page_by_layer(uint8_t layer);
uint16_t dsp_get_ui_scene_cur_x(void);
uint16_t dsp_get_ui_scene_cur_y(void);

void dsp_turn_on_ble(void);
void dsp_turn_off_ble(void);
void dsp_turn_on_bt(void);
void dsp_turn_off_bt(void);
void dsp_op_system_shut_down(void);
void dsp_op_system_reset(void);
void dsp_op_system_reboot(void);

void dsp_op_system_music_play(void);
void dsp_op_system_music_stop(void);
void dsp_op_system_music_prev(void);
void dsp_op_system_music_next(void);

void dsp_op_system_call_out(uint8_t *number, uint8_t len);

void dsp_op_get_current_call(call_info_t *call);
uint8_t dsp_op_dial_from_book(uint16_t id);
void dsp_op_get_call_from_story(call_info_t *call, uint16_t id);
void dsp_op_get_call_from_book(call_info_t *call, uint16_t id);
void dsp_op_sync_phone_book(void);
uint16_t dsp_op_get_phone_book_id_offset(void);
uint16_t dsp_op_set_phone_book_id_offset(uint16_t id_offset);
void dsp_op_system_call_ok(void);
void dsp_op_system_call_reject(void);
void dsp_op_read_cm3_record_list(void);
void dsp_op_get_call_from_record_list(call_info_t * call,uint8_t *call_context);
//void dsp_op_get_call_from_record_list(call_info_t *call, uint8_t *number, uint8_t number_len);
uint8_t dsp_get_system_record_total(void);

void dsp_op_sports_start(uint8_t mode);
void dsp_op_sports_stop(uint8_t mode);
void dsp_op_sports_pause(uint8_t mode);
void dsp_op_read_cm3_msg(void);
void dsp_op_system_timer_delay(uint16_t n);
void dsp_op_system_hrm_start(void);
void dsp_op_system_hrm_stop(void);

// data
uint16_t dsp_get_system_time_year(void);
uint8_t dsp_get_system_time_month(void);
uint8_t dsp_get_system_time_date(void);
uint8_t dsp_get_system_time_hour(void);
uint8_t dsp_get_system_time_minute(void);
uint8_t dsp_get_system_time_second(void);
uint8_t dsp_get_system_time_week(void);


uint8_t dsp_get_system_cm3_ver(void);
uint8_t dsp_get_system_dsp_ver(void);
uint8_t * dsp_get_system_mac_address(void);


void dsp_set_system_Wirst_Awake(uint8_t state);
uint8_t dsp_get_system_Wirst_Awake(void);
void dsp_set_system_no_disturb(uint8_t state);
uint8_t dsp_get_system_no_disturb(void);
void dsp_set_system_low_power(uint8_t state);
uint8_t dsp_get_system_low_power(void);
void dsp_set_system_panel_on_time(uint8_t value);
uint8_t dsp_get_system_panel_on_time(void);

void dsp_set_system_language(uint8_t id);
uint8_t dsp_get_system_language(void);
void dsp_set_system_backlight(uint8_t id);
uint8_t dsp_get_system_backlight(void);
void dsp_set_system_watch_face(uint8_t id);
uint8_t dsp_get_system_watch_face(void);
void dsp_set_system_menu_style(uint8_t id);
uint8_t dsp_get_system_menu_style(void);

void dsp_set_system_backlight_on( uint8_t id);
uint8_t dsp_get_system_backlight_on(void);


void dsp_set_system_volume_media(uint8_t value);
uint8_t dsp_get_system_volume_media(void);
void dsp_set_system_volume_hfp(uint8_t value);
uint8_t dsp_get_system_volume_hfp(void);
void dsp_set_system_volume_tone(uint8_t value);
uint8_t dsp_get_system_volume_tone(void);
uint8_t *dsp_get_system_music_context(void);
uint8_t dsp_get_system_music_state(void);

uint8_t dsp_get_system_ble_state(void);
uint8_t dsp_get_system_ble_on_off(void);
uint8_t dsp_get_system_bt_on_off(void);
uint8_t dsp_get_system_bt_state(void);
uint8_t dsp_get_system_battery_state(void);
uint8_t dsp_get_system_battery_value(void);
uint32_t dsp_get_system_step(void);
uint32_t dsp_get_system_calorie(void);
uint32_t dsp_get_system_distance(void);
uint8_t dsp_get_system_hrm(void);
void  dsp_clear_system_hrm(void);
uint8_t dsp_get_system_hrm_warning_h(void);
uint8_t dsp_get_system_hrm_warning_l(void);
uint8_t dsp_get_system_o2_sbp(void);
uint8_t dsp_get_system_o2_dbp(void);
uint8_t dsp_get_system_o2_spo2(void);
uint8_t dsp_get_system_blood_h(void);
uint8_t dsp_get_system_blood_l(void);
uint8_t *dsp_get_system_hrm_distory(void);
uint8_t *dsp_get_system_sleep_distory(void);
uint16_t dsp_get_system_sleep_total_time(void);
uint16_t dsp_get_system_sleep_d_time(void);
uint16_t dsp_get_system_sleep_l_time(void);

uint8_t dsp_get_system_msg_total(void);
void dsp_get_system_msg_time(uint8_t msg_id, uint8_t *buffer);
uint8_t dsp_get_system_msg_type(uint8_t msg_id);
void dsp_get_system_msg_title(uint8_t msg_id, uint8_t *buffer);
void dsp_get_system_msg_context(uint8_t msg_id, uint8_t *buffer);

uint8_t dsp_get_system_day1_weather_type(void);
int16_t dsp_get_system_day1_weather_temp(void);
int16_t dsp_get_system_day1_weather_temp_m(void);
int16_t dsp_get_system_day1_weather_temp_n(void);

uint8_t dsp_get_system_day2_weather_type(void);
int16_t dsp_get_system_day2_weather_temp(void);
int16_t dsp_get_system_day2_weather_temp_m(void);
int16_t dsp_get_system_day2_weather_temp_n(void);

uint8_t dsp_get_system_day3_weather_type(void);
int16_t dsp_get_system_day3_weather_temp(void);
int16_t dsp_get_system_day3_weather_temp_m(void);
int16_t dsp_get_system_day3_weather_temp_n(void);
uint32_t dsp_get_system_sport_time(void);
uint8_t dsp_get_system_sport_type(void);
uint16_t dsp_get_system_sport_speed(void);
uint16_t dsp_get_system_sport_step(void);
uint16_t dsp_get_system_sport_carlorie(void);
uint16_t dsp_get_system_sport_distcace(void);
uint8_t dsp_get_system_sport_state(void);
uint8_t dsp_get_system_sport_hrm(void);
uint8_t dsp_get_system_sport_hrm_max(void);
uint8_t dsp_get_system_sport_hrm_min(void);
uint8_t dsp_get_system_sport_oxygen(void);

uint8_t dsp_get_system_panel_show_time(void);
uint8_t dsp_set_system_panel_show_time(uint8_t time);

void dsp_op_enable_mic(void);
void dsp_op_disable_mic(void);
void dsp_get_system_alarm(_clockTime *alarm,uint8_t alarm_id);
void dsp_op_set_system_alarm(_clockTime * alarm,uint8_t alarm_id);


//-----------------------------------------------
void dsp_clear_system_light_time(void);
void dsp_take_picture(void);
void dsp_search_phone(void);
uint8_t* dsp_get_system_custom_card_mode(void);
void dsp_set_system_custom_card_mode(uint8_t index,uint8_t data_mode);

void dsp_set_system_sleep_history_cmd(void);
sleep_history_stru *dsp_get_system_sleep_history(void);
uint16_t dsp_get_system_step_target(void);
void dsp_set_system_new_language( uint8_t id);
uint8_t dsp_get_system_panel_state(void);
void dsp_set_system_countdown_timer(uint8_t cmd,uint32_t time_value);
uint32_t dsp_get_system_countdown_timer(void);
uint8_t dsp_get_system_countdown_timer_state(void);
void alarm_clock_edit_ui(lv_obj_t *parent);
void btn_repeat_select_ui(lv_obj_t *parent);
uint8_t dsp_get_system_temperature_format(void);
void fr_app_UI_Raisetowake_func(lv_obj_t *parent);
uint32_t dsp_get_system_sport_total_time(void);
uint16_t dsp_get_system_sport_total_carlorie(void);
uint8_t dsp_get_system_sport_avg_hrm(void);
uint8_t dsp_get_system_watch_hrm_value(void);
uint8_t dsp_get_ui_remind_index(void);
void dsp_get_system_win_title(uint8_t msg_id,uint8_t * buffer);
void dsp_get_system_win_context(uint8_t msg_id,uint8_t * buffer);
void dsp_set_system_test_cmd(uint8_t cmd);
void dsp_set_system_stopwatch_status(uint8_t cmd_status);
uint8_t dsp_get_system_distance_format(void);
void dsp_set_breathe_work(uint8_t breathe_work);
void dsp_breathe_state_cut(uint8_t breathe_state);
void dsp_send_data_ble(uint8_t *data,uint8_t len);

extern const lv_font_t arialuni_48;
extern const lv_font_t arialuni_32;
extern const lv_font_t arialuni_36;
extern const lv_font_t arialuni_20;
extern const lv_font_t arialuni_14;
extern const lv_font_t arialuni_120;

#define FONT_BIN_ARIALUNI_20 &bin_font


uint8_t get_pri_ui_group_index(pri_ui_entry func);
uint8_t jump_to_target_ui(pri_ui_entry target);
uint8_t save_the_previous_ui(pri_ui_entry func);
uint8_t return_to_previous_ui(void);
//===================================================================
//app ui define

//===================================================================


#define UI_PARENT_INIT(PARENT)	    do{lv_obj_set_size(PARENT,LV_PCT(100),LV_PCT(100));\
    lv_obj_set_style_bg_color(PARENT,lv_color_black(),0); \
    lv_obj_set_style_pad_all(PARENT,0,0); \
	lv_obj_set_style_border_width(PARENT, 0, 0); \
	lv_obj_set_scrollbar_mode(PARENT, LV_SCROLLBAR_MODE_OFF);}while(0)


#endif

#endif
