Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions display.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,28 @@ func updateDisplayUsbState() {

func updateDisplay() {
if networkManager != nil {
nativeInstance.UpdateLabelIfChanged("home_info_ipv4_addr", networkManager.IPv4String())
nativeInstance.UpdateLabelAndChangeVisibility("home_info_ipv6_addr", networkManager.IPv6String())
nativeInstance.UpdateLabelIfChanged("home_info_mac_addr", networkManager.MACString())
var ipv6String string
ipv4String := networkManager.IPv4String()
ipv6Addrs := networkManager.GetIPv6Addresses()
ipv6Addrs = append(ipv6Addrs, networkManager.GetIPv6LinkLocalAddress())

if len(ipv6Addrs) > 0 {
ipv6String = strings.Join(ipv6Addrs, "\n")
}

nativeInstance.UpdateLabelAndChangeVisibility(
"home_info_ipv4_addr",
ipv4String,
)

nativeInstance.UpdateLabelAndChangeVisibility(
"home_info_ipv6_addr",
ipv6String,
)
nativeInstance.UpdateLabelIfChanged(
"home_info_mac_addr",
networkManager.MACString(),
)
}

_, _ = nativeInstance.UIObjHide("menu_btn_network")
Expand Down
215 changes: 148 additions & 67 deletions internal/native/eez/jetkvm.eez-project

Large diffs are not rendered by default.

30 changes: 14 additions & 16 deletions internal/native/eez/jetkvm.eez-project-ui-state
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"navigation": {
"selectedUserPageObject": "[jetkvm.eez-project]:/userPages/6",
"selectedUserPageObject": "[jetkvm.eez-project]:/userPages/2",
"selectedActionObject": "[jetkvm.eez-project]:/actions/0",
"selectedGlobalVariableObject": "[jetkvm.eez-project]:/variables/globalVariables/3",
"selectedStyleObject": "[jetkvm.eez-project]:/lvglStyles/styles/8",
Expand Down Expand Up @@ -77,7 +77,7 @@
},
{
"type": "border",
"selected": 0,
"selected": 1,
"location": "bottom",
"children": [
{
Expand Down Expand Up @@ -196,16 +196,17 @@
"type": "tabset",
"id": "EDITORS",
"weight": 49.64170733710455,
"selected": 1,
"enableDeleteWhenEmpty": false,
"enableClose": false,
"children": [
{
"type": "tab",
"id": "#f70195bf-98bb-4fe3-acbf-f8580cb4fd56",
"name": "NetworkInfoScreen",
"name": "MenuScreen",
"component": "editor",
"config": {
"objectPath": "[jetkvm.eez-project]:/userPages/6",
"objectPath": "[jetkvm.eez-project]:/userPages/3",
"permanent": false
},
"icon": "svg:page"
Expand Down Expand Up @@ -244,7 +245,8 @@
},
"icon": "svg:page"
}
]
],
"active": true
},
{
"type": "row",
Expand All @@ -264,8 +266,7 @@
"enableClose": false,
"icon": "svg:properties"
}
],
"active": true
]
},
{
"type": "tabset",
Expand Down Expand Up @@ -1128,7 +1129,10 @@
}
},
"1": {
"0": {}
"0": {},
"1": {
"$selected": true
}
},
"2": {},
"3": {
Expand Down Expand Up @@ -1281,14 +1285,8 @@
"0": {
"0": {
"0": {},
"1": {}
},
"1": {
"0": {
"1": {
"$selected": true
}
}
"1": {},
"$selected": true
}
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/native/eez/src/ui/fonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ extern const lv_font_t ui_font_font_book16;
extern const lv_font_t ui_font_font_book18;
extern const lv_font_t ui_font_font_book20;
extern const lv_font_t ui_font_font_book24;
extern const lv_font_t ui_font_inter9black;


#ifdef __cplusplus
Expand Down
60 changes: 40 additions & 20 deletions internal/native/eez/src/ui/screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,31 +308,51 @@ void create_screen_home_screen() {
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_radius(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE|LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_OFF);
add_style_flex_column_start(obj);
{
lv_obj_t *parent_obj = obj;
{
// HomeInfoIPv4Addr
lv_obj_t *obj = lv_label_create(parent_obj);
objects.home_info_ipv4_addr = obj;
lv_obj_set_pos(obj, LV_PCT(0), LV_PCT(0));
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
add_style_label_font_bold30(obj);
lv_label_set_text(obj, "169.254.169.254");
}
{
// HomeInfoIPv6Addr
lv_obj_t *obj = lv_label_create(parent_obj);
objects.home_info_ipv6_addr = obj;
lv_obj_set_pos(obj, LV_PCT(0), LV_PCT(0));
lv_obj_set_size(obj, LV_PCT(98), 17);
lv_label_set_long_mode(obj, LV_LABEL_LONG_DOT);
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
add_style_label_font16(obj);
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "fe80::ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff");
// IPinfo
lv_obj_t *obj = lv_obj_create(parent_obj);
objects.ipinfo = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_PCT(100), LV_PCT(75));
lv_obj_set_style_pad_left(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_radius(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO);
add_style_flex_column_start(obj);
{
lv_obj_t *parent_obj = obj;
{
// HomeInfoIPv4Addr
lv_obj_t *obj = lv_label_create(parent_obj);
objects.home_info_ipv4_addr = obj;
lv_obj_set_pos(obj, LV_PCT(0), LV_PCT(0));
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
add_style_label_font_bold30(obj);
lv_obj_set_style_margin_bottom(obj, -10, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "169.254.169.254");
}
{
// HomeInfoIPv6Addr
lv_obj_t *obj = lv_label_create(parent_obj);
objects.home_info_ipv6_addr = obj;
lv_obj_set_pos(obj, LV_PCT(0), LV_PCT(0));
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_long_mode(obj, LV_LABEL_LONG_SCROLL);
add_style_label_font16(obj);
lv_obj_set_style_text_font(obj, &ui_font_inter9black, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "2001:0db8:0000:0000:0000:0000:0000:0000--\n2001:0db8:0000:0000:0000:0000:0000:0000--\n3fff::\n3fff::\n3fff::\n3fff::");
}
}
}
{
// HomeInfoMACAddr
Expand Down
1 change: 1 addition & 0 deletions internal/native/eez/src/ui/screens.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef struct _objects_t {
lv_obj_t *cloud_status_icon;
lv_obj_t *cloud_status_label;
lv_obj_t *home_info_container;
lv_obj_t *ipinfo;
lv_obj_t *home_info_ipv4_addr;
lv_obj_t *home_info_ipv6_addr;
lv_obj_t *home_info_mac_addr;
Expand Down
12 changes: 12 additions & 0 deletions pkg/nmlite/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,18 @@ func (im *InterfaceManager) GetIPv6Addresses() []string {
return addresses
}

// GetIPv6LinkLocalAddress returns the IPv6 link-local address of the interface
func (im *InterfaceManager) GetIPv6LinkLocalAddress() string {
im.stateMu.RLock()
defer im.stateMu.RUnlock()

if im.state == nil {
return ""
}

return im.state.IPv6LinkLocal
}

// GetMACAddress returns the MAC address of the interface
func (im *InterfaceManager) GetMACAddress() string {
im.stateMu.RLock()
Expand Down
7 changes: 7 additions & 0 deletions pkg/nmlite/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ func (nm *NetworkManager) GetIPv6Addresses() []string {
return []string{}
}

func (nm *NetworkManager) GetIPv6LinkLocalAddress() string {
for _, iface := range nm.interfaces {
return iface.GetIPv6LinkLocalAddress()
}
return ""
}

func (nm *NetworkManager) GetMACAddress() string {
for _, iface := range nm.interfaces {
return iface.GetMACAddress()
Expand Down