matheuswhite / scope-rs

Multiplatform Serial Monitor made in Rust
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

Add Plugin system #17

Closed matheuswhite closed 7 months ago

matheuswhite commented 1 year ago

Support load lua scripts to augument the program features. This script must have 2 functions:

  1. serial_rx(msg: bytes): This function will be called when a new message is received from device. Its arguments are: b. msg: A byte stream with the message received from device.
  2. user_command(arg_list: List[str]): This function will be called when the user invokes this script using ! notation. Its arguments are: b. args: A list of arguments passed by user

The plugins can be installed or loaded in runtime. Plugins installed are copied to config folder and loaded at each start-up.

The current system commands, using ! notation, must be replaced by plugin system. At the start-up, the program will check the integrity of system plugins. If there are missing plugins or some plugins are broken, then the program will download this plugins. The system plugins have the following names: sys.lua and serial.lua.