feat: Add theme toggle, implement interactive simulator menu, and enhance dashboard stats API.

This commit is contained in:
2025-12-22 23:34:27 -05:00
parent 2e415d1897
commit dae7926eaa
12 changed files with 483 additions and 280 deletions

View File

@@ -107,32 +107,52 @@ def generate_mock_hdmi_test():
}
if __name__ == "__main__":
import sys
hu = HeadUnit()
if len(sys.argv) < 2:
print("Usage: python simulator.py [register|test|mode-dev|mode-prod|swap|loop]")
sys.exit(1)
cmd = sys.argv[1]
if cmd == "register":
hu.register()
elif cmd == "test":
hu.report_test(generate_mock_hdmi_test())
elif cmd == "mode-dev":
hu.switch_mode("DEV")
elif cmd == "mode-prod":
hu.switch_mode("PROD")
elif cmd == "swap":
hu.switch_slot()
elif cmd == "loop":
print("[*] Starting simulator loop. Ctrl+C to exit.")
while True:
def print_menu():
print("\n" + "="*45)
print(f" HDMI TESTER - HARDWARE SIMULATOR (v1.2.0)")
print("="*45)
print(f" Status: [{hu.status}]")
print(f" Mode: [{hu.mode}]")
print(f" Active: [Slot {hu.active_slot}]")
print(f" Serial: [{hu.serial_number}]")
print("-" * 45)
print(" 1. Register / Sync Device")
print(" 2. Report Mock HDMI Test")
print(" 3. Switch to DEV Mode")
print(" 4. Switch to PROD Mode")
print(" 5. Swap Active Slot (A/B)")
print(" 6. Start Automated Loop")
print(" 0. Exit Orchestrator")
print("-" * 45)
while True:
print_menu()
choice = input("Select operation [0-6] >> ").strip()
if choice == "1":
hu.register()
if hu.status == "ENROLLED":
hu.report_test(generate_mock_hdmi_test())
time.sleep(10)
else:
print("Unknown command.")
elif choice == "2":
hu.report_test(generate_mock_hdmi_test())
elif choice == "3":
hu.switch_mode("DEV")
elif choice == "4":
hu.switch_mode("PROD")
elif choice == "5":
hu.switch_slot()
elif choice == "6":
print("\n[*] Entering automated telemetry loop. Press Ctrl+C to return to menu.")
try:
while True:
hu.register()
if hu.status == "ENROLLED":
hu.report_test(generate_mock_hdmi_test())
time.sleep(5)
except KeyboardInterrupt:
print("\n[!] Loop interrupted by user.")
elif choice == "0":
print("[*] Powering down head unit...")
break
else:
print("[!] Invalid selection.")