mcu_ab568x/app/projects/AB5682C_128/functions/func_bt_end.c
2025-05-30 18:03:10 +08:00

154 lines
4.0 KiB
C

#include "include.h"
#include "func.h"
#if TRACE_EN
#define TRACE(...) printf(__VA_ARGS__)
#else
#define TRACE(...)
#endif
#define BT_END_CARD_WIDTH_ORG 128
#define BT_END_CARD_HEIGHT_ORG 60
typedef struct f_bt_endt_ {
u32 enter_tick;
} f_bt_endt;
enum {
COMPO_ID_TXT_NUMBER = 0xee, //避免id被覆盖
// COMPO_ID_CALL_ICON,
// COMPO_ID_TXT_TIME,
// COMPO_ID_BTN_REJECT,
// COMPO_ID_BTN_MIC,
// COMPO_ID_CALL_VOLUME,
// COMPO_ID_CALL_VOLUME_BG,
};
static void func_bt_call_back_to(void)
{
u8 last_func = func_directly_back_to();
if (last_func == FUNC_BT_RING) {
func_back_to();
}
}
//创建logo窗体
compo_form_t *func_bt_end_form_create(void)
{
//新建窗体
compo_cardbox_t *cardbox;
compo_form_t *frm = compo_form_create(true);
//大背景
compo_picturebox_t *pic;
pic = compo_picturebox_create(frm, UI_BUF_CALL_CALL_BG_BIN);
compo_picturebox_set_pos(pic, GUI_SCREEN_CENTER_X, 7+32);
int name_len = 0;
//电话号码
compo_textbox_t *number_txt = compo_textbox_create(frm, 20);
compo_textbox_set_location(number_txt, GUI_SCREEN_CENTER_X, GUI_SCREEN_CENTER_Y, GUI_SCREEN_WIDTH, 50);
compo_textbox_set_autosize(number_txt, true);
// if (bt_cb.number_sta) {
name_len = phonebook_get_name_by_number(hfp_get_last_call_number(0),sys_cb.outgoing_name);
if(name_len > 0)
compo_textbox_set(number_txt, sys_cb.outgoing_name);
else
compo_textbox_set(number_txt, hfp_get_last_call_number(0));
// }
//通话结束
compo_textbox_t *number_name = compo_textbox_create(frm, 20);
compo_textbox_set_location(number_name, GUI_SCREEN_CENTER_X, GUI_SCREEN_CENTER_Y+20, GUI_SCREEN_WIDTH, 50);
compo_textbox_set_forecolor(number_name, make_color(163,163,163));
compo_textbox_set(number_name,i18n[STR_CALL_ENDING]);
// cardbox = compo_cardbox_create(frm, 1, 1, 2, BT_END_CARD_WIDTH_ORG, BT_END_CARD_HEIGHT_ORG);
// compo_cardbox_set_pos(cardbox, GUI_SCREEN_CENTER_X,GUI_SCREEN_CENTER_Y+20);
// compo_cardbox_rect_set_location(cardbox, 0, 0, 0, BT_END_CARD_WIDTH_ORG, BT_END_CARD_HEIGHT_ORG, 20);
// compo_cardbox_rect_set_color(cardbox, 0, make_color(163,163,163));
// compo_cardbox_text_set(cardbox, 0, i18n[STR_CALL_ENDING]); //通话结束
// compo_cardbox_text_set_location(cardbox, 0, 0, 0 , BT_END_CARD_WIDTH_ORG, 20);
//挂断按钮
compo_form_add_image(frm, UI_BUF_CALL_HANG_UP_CLICK_BIN, GUI_SCREEN_CENTER_X, 117+16);
return frm;
}
void func_bt_end_number_update(void)
{
}
static void func_bt_end_animation(void)
{
f_bt_endt *f_bt_end = (f_bt_endt *)func_cb.f_cb;
if(tick_check_expire(func_cb.enter_tick, 3000)) {
func_bt_call_back_to();
}
}
//logo事件处理
static void func_bt_end_process(void)
{
func_bt_end_animation();
func_process();
}
//logo消息处理
static void func_bt_end_message(size_msg_t msg)
{
switch (msg) {
case MSG_CTP_CLICK:
break;
case MSG_CTP_SHORT_UP:
break;
case MSG_CTP_SHORT_DOWN:
break;
case MSG_CTP_LONG:
break;
default:
func_message(msg);
break;
}
}
//进入logo
static void func_bt_end_enter(void)
{
func_cb.f_cb = func_zalloc(sizeof(f_bt_endt));
func_cb.frm_main = func_bt_end_form_create();
func_cb.enter_tick = tick_get();
}
//退出logo
static void func_bt_end_exit(void)
{
func_cb.last = FUNC_BT_END;
}
//logo
void func_bt_end(void)
{
printf("%s\n", __func__);
func_bt_end_enter();
task_stack_del(task_stack_find(FUNC_BT_RING));
task_stack_del(task_stack_find(FUNC_BT_CALL));
// task_stack_del(task_stack_find(FUNC_BT_END));
while (func_cb.sta == FUNC_BT_END) {
func_bt_end_process();
func_bt_end_message(msg_dequeue());
}
func_bt_end_exit();
}