Quick Start

Prepare the APP

Create a file named hello.py with the following content:

print("hello")

Upload the APP

  1. First, go to the Other page and navigate to the Micro APP section.

  2. Click the Select file button and choose the hello.py file.

  3. Click the Upload button to upload the APP file.

  4. Wait for the prompt indicating that the upload was successful.

../_images/image.png

Run the APP

  1. Click the Start button to run the APP.

../_images/image-2.png

View the Results

  1. Check the Results Box to see the normal execution output.

../_images/image-3.png

Stop the APP

  1. Click the Stop button to stop the APP.

../_images/image-4.png

Run on Startup

  1. Set Run at Startup to Yes.

  2. Click the Apply button to save the configuration.

  3. Wait for the gateway to complete startup, then check the results.

Caution

  • The gateway will automatically restart for configuration changes to take effect.

  • The gateway will automatically run the APP 30 seconds after reboot.

  • Enable it only after completing the stability test in the app.

../_images/image-5.png

Call API

The following example demonstrates using the gateway to scan nearby BLE devices. For more examples and detailed explanations, please refer to the API section.

import asyncio
import cassiablue


async def main():
    print("start scan")

    ok, _ = await cassiablue.start_scan("active=1&filter_duplicates=1000")
    print(type(ok), ok)

    if not ok:
        return

    async for dev in cassiablue.scan_result():
        print(type(dev), dev)
        await asyncio.sleep_ms(5)


asyncio.run(main())