| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- --[[
- @module tsb_ywy_2_page
- @summary 液位仪透传页面
- @version 1.0
- @date 2026.03.16
- @author 李一玮
- @usage
- 本文件是液位仪透传页面,展示液位仪的透传功能。
- ]]
- local tsb_ywy_2_page = {}
- local common_ui = require("tsb_common_page")
- -- 页面UI元素
- local main_container = nil
- -- 创建UI
- function tsb_ywy_2_page.create_ui()
- main_container = airui.container({
- x = 0,
- y = 0,
- w = 480,
- h = 320,
- color = 0xF5F5F5,
- })
- --------------------- 标题栏 ------------------------
- local title_bar = airui.container({
- parent = main_container,
- x = 0,
- y = 0,
- w = 480,
- h = 30,
- color = 0x4CAF50,
- })
- airui.label({
- parent = title_bar,
- text = "液位仪透传",
- x = 200,
- y = 8,
- w = 120,
- h = 20,
- font_size = 16,
- color = 0xFFFFFF,
- })
- -- 标题栏公共信息展示
- common_ui.add_battery_display(title_bar)
- common_ui.create_back_button(title_bar, tsb_ywy_2_page.cleanup)
- ---------------------------------------------------
- -- 滚动容器
- local scroll_container = airui.container({
- parent = main_container,
- x = 0,
- y = 30,
- w = 480,
- h = 290,
- color = 0xFFFFFF,--0xF5F5F5
- })
- ---------------------------------------------------
- --------------------- 分页内容区 ------------------------
- -- 液位仪透传页面
- local passthrough_page = airui.container({
- parent = scroll_container,
- x = 0,
- y = 0,
- w = 480,
- h = 290,
- color = 0xF0F7E8,--0xF1F8E9
- })
- --------------------- A口接收数据 ------------------------
- -- A口标签
- airui.label({
- parent = passthrough_page,
- text = "A口接收数据",
- x = 65,
- y = 10,
- w = 120,
- h = 20,
- font_size = 16,
- })
- -- A口数据容器
- local a_port_container = airui.container({
- parent = passthrough_page,
- x = 2,
- y = 30,
- w = 240,
- h = 250,
- color = 0xFFFFFF,
- })
- -- A口数据显示
- local a_port_data = airui.textarea({
- parent = a_port_container,
- x = 5,
- y = 5,
- w = 230,
- h = 245,
- text = "00 01 02 03 04 05 06 07\n" ..
- "08 09 0A 0B 0C 0D 0E 0F\n"
- })
- ---------------------------------------------------
- --------------------- B口接收数据 ------------------------
- -- B口标签
- airui.label({
- parent = passthrough_page,
- text = "B口接收数据",
- x = 310,
- y = 10,
- w = 120,
- h = 20,
- font_size = 16,
- })
- -- B口数据容器
- local b_port_container = airui.container({
- parent = passthrough_page,
- x = 238,
- y = 30,
- w = 240,
- h = 250,
- color = 0xFFFFFF,
- })
- -- B口数据显示
- local b_port_data = airui.textarea({
- parent = b_port_container,
- x = 5,
- y = 5,
- w = 230,
- h = 245,
- text = "40 41 42 43 44 45 46 47\n" ..
- "48 49 4A 4B 4C 4D 4E 4F\n"
- })
- ---------------------------------------------------
- -- 底部信息
- --common_ui.create_status_bar(main_container)
- end
- -- 初始化页面
- function tsb_ywy_2_page.init(params)
- tsb_ywy_2_page.create_ui()
- end
- -- 清理页面
- function tsb_ywy_2_page.cleanup()
- -- 停止定时器
- common_ui.cleanup()
- if main_container then
- main_container:destroy()
- main_container = nil
- end
- end
- return tsb_ywy_2_page
|