Skip to content

Commit

Permalink
documentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkarpov-ui committed Nov 8, 2023
1 parent a15f07b commit d1bdaf5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Test-Rack-Software/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ The way that peripherals are implemented and detected is left as an exercise to

As of now, all connections between systems are made with serial, this may be modified later on to allow for more board peripherals (since one of the serial ports is used for server communication).

#### Packets
#### Communication

##### Communication interfaces
Datastreamer provides an interface for implementing serial-like communication interfaces through the `./util/communication/communication_interface.py` interface. The definition of "serial-like" communication is quite abstract, but in short, the communication protocol you are trying to implement must be able to send and recieve strings in some manner. Whether the strings are encoded or not matters not, you must simply be able to implement `read()`, which will return a `str`, and `write(data: str)`, which takes in a string. The other methods are helper methods to work with string buffers.

To see a simple example of a communication interface, take a look at `./util/communication/serial_channel.py`.

##### Packets
The datastreamer communicates to the Kamaji server through a system of packets. The purpose of each packet is well documented within `packets.py`, so it is recommended to check out what each packet does. In general, each packet has a **packet header** and an optional **raw_data** parameter. The packet header is encoded using JSON, while `raw_data` is usually encoded as a UTF-8 string.

Packets are encoded to the serial buffer in the following manner as a string: `{packet_header}[[raw==>]]{raw_data}[[pkt_end]]`. This string can then be decoded back into the relevant packet, assuming that no data corruption happens.
Expand Down
11 changes: 10 additions & 1 deletion Test-Rack-Software/util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,18 @@ A helper file for handling all job-related functions (Hooks into datastreamer fu
`handle_packets.py`
A helper file for handling all server packets (Hooks into datastreamer functionality)

`packets.py`
`communication/packets.py`
Establishes packet communication protocol for datastreamer.

`communication/communication_interface.py`
Provides communication channel interfaces to be implemented for communication with Kamaji.

`communication/serial_channel.py`
Communication channel class for Serial (USB) communication

`communication/ws_channel.py`
Communication channel class for websocket communication

`pio_commands.py`
Wrapper for **platformio**

Expand Down

0 comments on commit d1bdaf5

Please sign in to comment.