jacdac.jacscript_manager
Submodules
Package Contents
Classes
Allows for deployment and control over Jacscript virtual machine. |
- class jacdac.jacscript_manager.JacscriptManagerClient(bus: jacdac.bus.Bus, role: str)
Bases:
jacdac.bus.Client
- Allows for deployment and control over Jacscript virtual machine.
Programs start automatically after device restart or uploading of new program.
You can stop programs until next reset by setting the running register to 0.
TODO - debug interface:
read-globals command/register
globals-changed pipe
breakpoint command
some performance monitoring?
Implements a client for the Jacscript Manager service.
- property running Optional[bool]
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 Optional[bool]
Indicates wheather the program should be re-started upon reboot() or panic(). Defaults to true.,
- property logging Optional[bool]
log_message reports are only sent when this is true. It defaults to false.,
- 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.