
#include "Drv/pages/AppInfo/view.h"
#include <stdio.h>



static const PageRenderPort *s_port = NULL;




void AppInfoView_ShowTerminalInfo(void)
{
    uint8_t *context[] = {
        "终端类型 ： F30",
        "终端型号 ： F30",
        "软件版本 ： SV0.010",
        "硬件版本 ： HW0.010",
        "软件校验 ： 4454",
        "程序日期 ： 2024.08.27"
    };
    s_port->show_str(32, 26, "馈线自动化终端");
    for(uint8_t index = 0; index < 6; index++ )
    {
        s_port->show_str(6, 26 + (index + 1) * (s_port->get_ascii_height() + 3), context[index]);
    }
}

void AppInfoView_ShowTopName(uint8_t *name)
{
    uint16_t wLen =  s_port->get_utf8_len(name) * s_port->get_ascii_width();

    s_port->fill_rect(0, 0, s_port->get_size_x() - 1, s_port->get_size_y() - 1, s_port->get_color_back());
    /* 显示顶部名称,居中显示 */
    s_port->show_str((s_port->get_size_x() - wLen) / 2, 3, name);
    s_port->draw_meitou(18, 2);
    s_port->show_info_page(10, 1);
    AppInfoView_ShowTerminalInfo();
}
void AppInfoView_Init(appinfo_view_t *view)
{
    s_port = PageRenderer_Lcd();
    view->show_top_name = AppInfoView_ShowTopName;
}