#include "ui_page_devinfo.h"
#include "ui_cont.h"
#include "data_config.h"

const char *dev_info[] = {
    "智能分布式终端",
    "CSP6000",
    "AE86",
    "SV01.002",
    "NW24_DC_20251125_001",
    "珠海欧力配网自动化股份有限公司"
};

lv_obj_t *dv_labeldis[6];

void ui_dev_info_create(void)
{
    u8 i = 0, len;
    char buf[55] = {0};
    //RMT_FIXED_TABLE tfixedset;
    
    Draw_counteara();

    for (i = 0; i < 6; i++)
    {
        dv_labeldis[i] = lv_label_create(ui_get_cont(), NULL);
        lv_obj_set_style_local_text_font(dv_labeldis[i], LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, &GBhzk22);
        lv_obj_set_style_local_text_color(dv_labeldis[i], LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, Default_HZ_color); // 设置颜色
        if (i == 0)
        {
            memset(buf, 0, sizeof(buf));
            strcat(&buf[0], AboutDevice_disp[0]);
            len = strlen(AboutDevice_disp[0]);
            strcpy(&buf[0] + len, dev_info[0]);
            lv_label_set_text(dv_labeldis[i], buf);         //TODO 暂时数据写死 
        }
        else if (i == 1)
        {
            memset(buf, 0, sizeof(buf));
            strcat(&buf[0], AboutDevice_disp[1]);
            len = strlen(AboutDevice_disp[1]);
            strcpy(&buf[0] + len, dev_info[1]);
            lv_label_set_text(dv_labeldis[i], buf);
        }
        else if (i == 2)
        {
            memset(buf, 0, sizeof(buf));
            strcat(&buf[0], AboutDevice_disp[2]);
            len = strlen(AboutDevice_disp[2]);
            strcpy(&buf[0] + len, dev_info[2]);
            lv_label_set_text(dv_labeldis[i], buf);
        }
        else if (i == 3)
        {
            memset(buf, 0, sizeof(buf));
            strcat(&buf[0], AboutDevice_disp[3]);
            len = strlen(AboutDevice_disp[3]);
            strcpy(&buf[0] + len, dev_info[3]);
            lv_label_set_text(dv_labeldis[i], buf);
        }
        else if (i == 4)
        {
            memset(buf, 0, sizeof(buf));
            strcat(&buf[0], AboutDevice_disp[4]);
            strcat(&buf[0], dev_info[4]);
            lv_label_set_text(dv_labeldis[i], buf);
        }
        else if (i == 5)
        {
            memset(buf, 0, sizeof(buf));
            strcat(&buf[0], AboutDevice_disp[5]);
            len = strlen(AboutDevice_disp[5]);
            strcpy(&buf[0] + len, dev_info[5]);
            lv_label_set_text(dv_labeldis[i], buf);
        }
        else
            lv_label_set_text(dv_labeldis[i], AboutDevice_disp[i]); //
        lv_obj_set_pos(dv_labeldis[i], 15, 45 + i * 30);            // 设置坐标
    }
}