Skip to content

Commit

Permalink
Add readme for custom monitoring script
Browse files Browse the repository at this point in the history
  • Loading branch information
Krisjanis Veinbahs committed Jan 8, 2022
1 parent 34f19ac commit d9c3e7e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/monitor_serial_hexbytes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Custom serial port monitoring script `hexbytes`
This folder contains a Python module which can be imported by the DIP Testbed Client `hardware-serial-monitor` command.

Module contents:
- `mock.py` - Mocks of all DIP Testbed related Python classes needed to implement a custom monitoring solution,
this is added for doing type checking in IDEs.
- `monitor.py` - The actual monitoring script, which exports a `monitor` variable containing the monitoring class with a method `run`

The monitoring script gets run with an instance of `socketlike: Socketlike`, which allows receiving/transmitting monitoring messages to/from the backend.

This specific `hexbytes` implementation is a copy-paste of the original `hardware-serial-monitor` monitoring type `hexbytes`, simply implemented as an external script/module.

This script does the following:
- receives bytes from the `socketlike`, formats and prints them out to `STDOUT`
- captures/supresses `STDIN` from printing to `STDOUT`
- redirects all `STDIN` bytes to transmit through `socketlike`
- on error conditions or exit signals reverts the capture of `STDIN`, closes the `socketlike` connection, returns an exit result

0 comments on commit d9c3e7e

Please sign in to comment.