connectcore-demo-example: dashboard: implement get video resolution

https://onedigi.atlassian.net/browse/DEL-7742

Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
Tatiana Leon 2022-05-17 12:54:09 +02:00
parent 02c160b34b
commit 226a64285d
1 changed files with 15 additions and 0 deletions

View File

@ -100,6 +100,7 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler):
"mca_fw_version": mca_versions[0],
"memory_total": mem_info.get("MemTotal", NOT_AVAILABLE) if mem_info else NOT_AVAILABLE,
"flash_size": get_storage_size(),
"video_resolution": get_video_resolution(),
"bluetooth_mac": get_bt_mac("hci0"),
"wifi_mac": read_file("/sys/class/net/wlan0/address").strip().upper() if "wlan0" in list_net_ifaces() else ZERO_MAC,
"wifi_ip": get_iface_ip("wlan0") if "wlan0" in list_net_ifaces() else ZERO_IP,
@ -458,6 +459,20 @@ def get_storage_size():
return -1
def get_video_resolution():
"""
Gets the video resolution.
Returns:
String: Video resolution.
"""
res = read_file("/sys/class/graphics/fb0/modes")
if res == NOT_AVAILABLE:
return "-"
return res.split(":")[1].strip()
def get_mem_info():
"""
Gets a dictionary with memory info.