diff --git a/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..d5756be5 --- /dev/null +++ b/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.JSON @@ -0,0 +1,12 @@ +{ +"name": "BTC Ticker", +"publisher": "ACME Inc", +"short_description": "Bitcoin Price Ticker", +"long_description": "Uses a websocket to show the current price of Bitcoin in US Dollar.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.btcticker_0.0.1.mpk", +"fullname": "com.example.btcticker", +"version": "0.0.1", +"entrypoint": "assets/bitcoin_price.py" +} + diff --git a/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.MF b/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.MF deleted file mode 100644 index 7f4afaf0..00000000 --- a/internal_filesystem/apps/com.example.btcticker/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: BTCTicker -Start-Script: assets/bitcoin_price.py -Version: 0.0.1 diff --git a/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..02768061 --- /dev/null +++ b/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.JSON @@ -0,0 +1,12 @@ +{ +"name": "Camera Tester", +"publisher": "ACME Inc", +"short_description": "Simple test of the camera", +"long_description": "A simple test of the camera makes it possible to validate the hardware.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.2.mpk", +"fullname": "com.example.camtest", +"version": "0.0.2", +"entrypoint": "assets/camtest.py" +} + diff --git a/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.MF b/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.MF deleted file mode 100644 index fe3c1221..00000000 --- a/internal_filesystem/apps/com.example.camtest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: CamTest -Start-Script: assets/camtest.py -Version: 0.0.2 diff --git a/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..2722304a --- /dev/null +++ b/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.JSON @@ -0,0 +1,12 @@ +{ +"name": "CPU Tester", +"publisher": "ACME Inc", +"short_description": "Testing the CPU speed", +"long_description": "Experimentally determines how many idle loops and sha256-hashing loops the CPU can perform per second.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.cputest_0.0.1.mpk", +"fullname": "com.example.cputest", +"version": "0.0.1", +"entrypoint": "assets/cputest.py" +} + diff --git a/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.MF b/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.MF deleted file mode 100644 index eee429e9..00000000 --- a/internal_filesystem/apps/com.example.cputest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: CPUTest -Start-Script: assets/cputest.py -Version: 0.0.1 diff --git a/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..e5b8978a --- /dev/null +++ b/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.JSON @@ -0,0 +1,11 @@ +{ +"name": "HelloWorld", +"publisher": "ACME Inc", +"short_description": "Minimal app", +"long_description": "Demonstrates the simplest app.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.helloworld_0.0.1.mpk", +"fullname": "com.example.memtest", +"version": "0.0.1", +"entrypoint": "assets/hello.py" +} diff --git a/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.MF b/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.MF deleted file mode 100644 index 8976e5cc..00000000 --- a/internal_filesystem/apps/com.example.helloworld/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: HelloWorld -Start-Script: assets/hello.py -Version: 0.0.1 diff --git a/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..1d02d79a --- /dev/null +++ b/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.JSON @@ -0,0 +1,11 @@ +{ +"name": "IMU Tester", +"publisher": "ACME Inc", +"short_description": "Test the Inertial Measurement Unit", +"long_description": "It is always good to make sure the accelerometer is working properly. How else can you measure acceleration and position?", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk", +"fullname": "com.example.imutest", +"version": "0.0.1", +"entrypoint": "assets/imutest.py" +} diff --git a/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.MF b/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.MF deleted file mode 100644 index ad061307..00000000 --- a/internal_filesystem/apps/com.example.imutest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: IMUTest -Start-Script: assets/imutest.py -Version: 0.0.1 diff --git a/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..18dcf17e --- /dev/null +++ b/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.JSON @@ -0,0 +1,12 @@ +{ +"name": "Animation Tester", +"publisher": "ACME Inc", +"short_description": "Testing on-display animations", +"long_description": "Stress testing multiple concurrent animations on the display by adding more and more spinners", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk", +"fullname": "com.example.lvgltest", +"version": "0.0.1", +"entrypoint": "assets/lvgltest.py" +} + diff --git a/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.MF b/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.MF deleted file mode 100644 index e5d72f50..00000000 --- a/internal_filesystem/apps/com.example.lvgltest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: LVGLTest -Start-Script: assets/lvgltest.py -Version: 0.0.1 diff --git a/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..15e7b975 --- /dev/null +++ b/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.JSON @@ -0,0 +1,11 @@ +{ +"name": "Memory Tester", +"publisher": "ACME Inc", +"short_description": "RAM Memory Test", +"long_description": "Experimentally determines how many RAM memory buffers can be allocated.", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.memtest_0.0.1.mpk", +"fullname": "com.example.memtest", +"version": "0.0.1", +"entrypoint": "assets/memtest.py" +} diff --git a/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.MF b/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.MF deleted file mode 100644 index d79f107e..00000000 --- a/internal_filesystem/apps/com.example.memtest/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: MemTest -Start-Script: assets/memtest.py -Version: 0.0.1 diff --git a/internal_filesystem/boot.py b/internal_filesystem/boot.py index 46e2efbb..4e2f01d1 100644 --- a/internal_filesystem/boot.py +++ b/internal_filesystem/boot.py @@ -1,4 +1,4 @@ -print("boot.py: version 0.0.2 running") +print("boot.py: version 0.0.3 running") from machine import Pin, SPI import st7789 diff --git a/internal_filesystem/builtin/apps/com.example.appstore/META-INF/MANIFEST.JSON b/internal_filesystem/builtin/apps/com.example.appstore/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..346b5eb1 --- /dev/null +++ b/internal_filesystem/builtin/apps/com.example.appstore/META-INF/MANIFEST.JSON @@ -0,0 +1,13 @@ +{ +"name": "AppStore", +"publisher": "ACME Inc", +"short_description": "Store for App(lication)s", +"long_description": "" +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.appstore_0.0.1.mpk", +"fullname": "com.example.appstore", +"version": "0.0.1", +"entrypoint": "assets/appstore.py", +"category": "appstore" +} + diff --git a/internal_filesystem/builtin/apps/com.example.appstore/META-INF/MANIFEST.MF b/internal_filesystem/builtin/apps/com.example.appstore/META-INF/MANIFEST.MF deleted file mode 100644 index 7f12b35a..00000000 --- a/internal_filesystem/builtin/apps/com.example.appstore/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: AppStore -Start-Script: assets/appstore.py -Version: 0.0.1 diff --git a/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py b/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py index dede733e..002dcc29 100644 --- a/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py +++ b/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py @@ -17,8 +17,9 @@ progress_bar = None action_label_install = "Install Latest Version" action_label_uninstall = "Uninstall" + class App: - def __init__(self, name, publisher, short_description, long_description, icon_url, download_url, fullname, version): + def __init__(self, name, publisher, short_description, long_description, icon_url, download_url, fullname, version, entrypoint): self.name = name self.publisher = publisher self.short_description = short_description @@ -27,9 +28,11 @@ class App: self.download_url = download_url self.fullname = fullname self.version = version + self.entrypoint = entrypoint self.image = None self.image_dsc = None + def is_installed_by_path(dir_path): try: if os.stat(dir_path)[0] & 0x4000: diff --git a/internal_filesystem/builtin/apps/com.example.launcher/META-INF/MANIFEST.JSON b/internal_filesystem/builtin/apps/com.example.launcher/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..5428e94a --- /dev/null +++ b/internal_filesystem/builtin/apps/com.example.launcher/META-INF/MANIFEST.JSON @@ -0,0 +1,13 @@ +{ +"name": "Launcher", +"publisher": "ACME Inc", +"short_description": "Simple launcher to start apps.", +"long_description": "", +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.launcher_0.0.1.mpk", +"fullname": "com.example.launcher", +"version": "0.0.1", +"entrypoint": "assets/launcher.py", +"category": "launcher" +} + diff --git a/internal_filesystem/builtin/apps/com.example.launcher/META-INF/MANIFEST.MF b/internal_filesystem/builtin/apps/com.example.launcher/META-INF/MANIFEST.MF deleted file mode 100644 index 2bc1680d..00000000 --- a/internal_filesystem/builtin/apps/com.example.launcher/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: Launcher -Start-Script: assets/launcher.py -Version: 0.0.1 diff --git a/internal_filesystem/builtin/apps/com.example.launcher/assets/launcher.py b/internal_filesystem/builtin/apps/com.example.launcher/assets/launcher.py index e1b30072..523c70d0 100644 --- a/internal_filesystem/builtin/apps/com.example.launcher/assets/launcher.py +++ b/internal_filesystem/builtin/apps/com.example.launcher/assets/launcher.py @@ -62,7 +62,7 @@ for dir_path in [apps_dir, apps_dir_builtin]: # Should we skip 'Launcher' apps from the list here? for app_dir_fullpath in app_dirs: - app_name, main_script = parse_manifest(f"{app_dir_fullpath}/META-INF/MANIFEST.MF") + app_name, main_script = parse_manifest(f"{app_dir_fullpath}/META-INF/MANIFEST.JSON") # Create a container for each app (icon + label) app_cont = lv.obj(cont) app_cont.set_size(iconcont_width, iconcont_height) diff --git a/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.JSON b/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..fbbce7f5 --- /dev/null +++ b/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.JSON @@ -0,0 +1,13 @@ +{ +"name": "OSUpdate", +"publisher": "ACME Inc", +"short_description": "Operating System Updater", +"long_description": "" +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.osupdate_0.0.1.mpk", +"fullname": "com.example.osupdate", +"version": "0.0.1", +"entrypoint": "assets/osupdate.py", +"category": "osupdate" +} + diff --git a/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.MF b/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.MF deleted file mode 100644 index 861c1852..00000000 --- a/internal_filesystem/builtin/apps/com.example.osupdate/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Name: OSUpdate -Start-Script: assets/osupdate.py -Version: 0.0.1 diff --git a/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.JSON b/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.JSON new file mode 100644 index 00000000..e04b623b --- /dev/null +++ b/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.JSON @@ -0,0 +1,13 @@ +{ +"name": "WiFiConf", +"publisher": "ACME Inc", +"short_description": "Wireless Network Configuration", +"long_description": "" +"icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk_icon_64x64.png", +"download_url": "http://demo.lnpiggy.com:2121/apps/com.example.wificonf_0.0.2.mpk", +"fullname": "com.example.wificonf", +"version": "0.0.2", +"entrypoint": "assets/wificonf.py", +"category": "wificonf" +} + diff --git a/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.MF b/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.MF deleted file mode 100644 index 9516f466..00000000 --- a/internal_filesystem/builtin/apps/com.example.wificonf/META-INF/MANIFEST.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -Name: WiFiConf -Start-Script: assets/wificonf.py -WiFi-Connect-Script: assets/auto_connect.py -WiFi-Configure-Script: assets/wificonf.py -Version: 0.0.2 diff --git a/internal_filesystem/main.py b/internal_filesystem/main.py index 9becda93..a8b51e4a 100644 --- a/internal_filesystem/main.py +++ b/internal_filesystem/main.py @@ -137,6 +137,7 @@ def update_time(timer): seconds = (ticks // 1000) % 60 milliseconds = ticks % 1000 time_label.set_text(f"{hours:02d}:{minutes:02d}:{seconds:02d}") + import network def update_wifi_icon(timer): try: @@ -146,13 +147,16 @@ def update_wifi_icon(timer): wifi_icon.add_flag(lv.obj.FLAG.HIDDEN) except lv.LvReferenceError: print("update_wifi_icon caught LvReferenceError") + import esp32 def update_temperature(timer): temp_label.set_text(f"{esp32.mcu_temperature():.2f}°C") + import gc def update_memfree(timer): gc.collect() memfree_label.set_text(f"{gc.mem_free()}") + timer1 = lv.timer_create(update_time, CLOCK_UPDATE_INTERVAL, None) timer2 = lv.timer_create(update_temperature, TEMPERATURE_UPDATE_INTERVAL, None) timer3 = lv.timer_create(update_memfree, MEMFREE_UPDATE_INTERVAL, None) @@ -269,24 +273,39 @@ import _thread import traceback import uio import time +import ujson + +class App: + def __init__(self, name, publisher, short_description, long_description, icon_url, download_url, fullname, version, entrypoint): + self.name = name + self.publisher = publisher + self.short_description = short_description + self.long_description = long_description + self.icon_url = icon_url + self.download_url = download_url + self.fullname = fullname + self.version = version + self.entrypoint = entrypoint + self.image = None + self.image_dsc = None + def is_launcher(app_name): - # Simple check, could be more elaborate by checking the MANIFEST.MF for the app... + # Simple check, could be more elaborate by checking the MANIFEST.JSON for the app... return "launcher" in app_name def parse_manifest(manifest_path): name = "Unknown" start_script = "assets/start.py" try: - with uio.open(manifest_path, 'r') as f: - for line in f: - line = line.strip() - if line.startswith("Name:"): - name = line.split(":", 1)[1].strip() - elif line.startswith("Start-Script:"): - start_script = line.split(":", 1)[1].strip() + with open(manifest_path,'r') as f: + app_info=ujson.load(f) + name = app_info.get("name") + start_script = app_info.get("entrypoint") + print(f"parse_manifest: got app_info: {app_info}") except OSError: - print(f"Error reading {manifest_path}") + access_points={} + print(f"parse_manifest: error loading manifest_path: {manifest_path}") return name, start_script def long_path_to_filename(path): @@ -384,7 +403,7 @@ def start_app(app_dir, is_launcher=False): print(f"/main.py start_app({app_dir},{is_launcher}") global foreground_app_name foreground_app_name = app_dir # would be better to store only the app name... - manifest_path = f"{app_dir}/META-INF/MANIFEST.MF" + manifest_path = f"{app_dir}/META-INF/MANIFEST.JSON" app_name, start_script = parse_manifest(manifest_path) start_script_fullpath = f"{app_dir}/{start_script}" execute_script_new_thread(start_script_fullpath, True, is_launcher, True)