jacdac.device_script_manager
Submodules
Package Contents
Classes
Allows for deployment and control over DeviceScript virtual machine. |
- class jacdac.device_script_manager.DeviceScriptManagerClient(bus: jacdac.bus.Bus, role: str)
Bases:
jacdac.bus.Client
- Allows for deployment and control over DeviceScript virtual machine.
Programs start automatically after device restart or uploading of new program.
You can stop programs until next reset by setting the running and autostart registers to false.
Implements a client for the DeviceScript Manager service.
- property running: bool | None
Indicates if the program is currently running. To restart the program, stop it (write 0), read back the register to make sure it’s stopped, start it, and read back.,
- property autostart: bool | None
Indicates wheather the program should be re-started upon reboot() or panic(). Defaults to true.,
- property runtime_version: Tuple[int, int, int] | None
(Optional) Returns the runtime version number compatible with [Semver](https://semver.org/). When read as 32-bit little endian integer a version 7.15.500 would be 0x07_0F_01F4.,
- property program_name: str | None
The name of currently running program. The compiler takes is from package.json.,
- property program_version: str | None
The version number of currently running program. The compiler takes is from package.json and git.,
- on_program_panic(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
Emitted when the program calls panic(panic_code) or reboot() (panic_code == 0 in that case). The byte offset in byte code of the call is given in program_counter. The program will restart immediately when panic_code == 0 or in a few seconds otherwise.
- on_program_change(handler: jacdac.bus.EventHandlerFn) jacdac.bus.UnsubscribeFn
Emitted after bytecode of the program has changed.
- deploy_bytecode(bytecode_size: int) None
Open pipe for streaming in the bytecode of the program. The size of the bytecode has to be declared upfront. To clear the program, use bytecode_size == 0. The bytecode is streamed over regular pipe data packets. The bytecode shall be fully written into flash upon closing the pipe. If autostart is true, the program will start after being deployed. The data payloads, including the last one, should have a size that is a multiple of 32 bytes. Thus, the initial bytecode_size also needs to be a multiple of 32.