Skip to content

Commit

Permalink
Wording typos
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlK90 committed Nov 8, 2022
1 parent f3e36bf commit e3f0177
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All serialization from Rust structs into JSON objects is done automatically with

In order to keep the backend structs and frontend TS types in synchronization and automatically propagate changes in the datatype [ts-rs](https://github.com/Aleph-Alpha/ts-rs) is used to generate matching Typescript interface definitions from the Rust structs.

As an example the `RGBMatrixConfig` and `RGBMatrixInfo` structs are annotated with the [`derive`](https://doc.rust-lang.org/book/appendix-03-derivable-traits.html) attribute and specifically shall derive serde's `Serialize` and ts-rs's `TS` Trait.
As an example the `RGBMatrixConfig` struct is annotated with the [`derive`](https://doc.rust-lang.org/book/appendix-03-derivable-traits.html) attribute and specifically derive serde's `Serialize` and ts-rs's `TS` Trait.

```Rust
#[derive(BinWrite, BinRead, Debug, TS, Serialize, Deserialize)]
Expand Down Expand Up @@ -73,16 +73,16 @@ export async function getConfig(id: string): Promise<RGBMatrixConfig> {
}
```

Both the backend and frontend handler have to written manually at this point, but should ideally be auto generated where it makes sense e.g. whenever data is passed directly from the XAP device to the frontend. Other handlers that involve aggregation and processing of data from the XAP device at least need to be implemented by hand in the backend.
Both the backend and frontend handler have to be written manually at this point, but should ideally be auto generated where it makes sense e.g. whenever data is passed directly from the XAP device to the frontend. Other handlers that involve aggregation and processing of data from the XAP device at least need to be implemented by hand in the backend.

**(2) USB HID:**

To communicate with attached XAP devices over USB RAW HID the backend uses the [hidapi-rs](https://github.com/ruabmbua/hidapi-rs) library. The client supports multiple simultaneous connected devices and distinguishes these by attaching an [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) when opening a new device.

The two main structs two mention here are:

* `XAPDevice` represents exactly on physically attached XAP device. Every device spawns an capturing thread that reacts to incoming responses for requests or passes broadcast messages to an event loop.
* `XAPClient` manages and forwards Request to the individual devices.
* `XAPDevice` represents exactly one physically attached XAP device. Every device spawns a capturing thread that reacts to incoming responses for requests or passes broadcast messages to an event loop.
* `XAPClient` detects new XAP devices and manages existing ones. It also forwards requests to the individual devices with the help of an UUID identifier.

The parsing of the RAW XAP HID packets into Rust structs is done with the help of the [binrw](https://binrw.rs/) crate which derives C-ABI compatible binary readers and writers from the Rust struct layout or can be implemented by hand for special cases like the XAP `Token` and `String` types.

Expand Down

0 comments on commit e3f0177

Please sign in to comment.