update protocol
This commit is contained in:
@@ -2,8 +2,26 @@
|
|||||||
|
|
||||||
This document introduce the protocol used between Basalt Presenter and Basalt Trainer.
|
This document introduce the protocol used between Basalt Presenter and Basalt Trainer.
|
||||||
|
|
||||||
If there is no specific description, the endian of data is **native endian**, and the alignment also is native.
|
## Data Format
|
||||||
Because all data are transmitted in local machine, so we use native layout.
|
|
||||||
|
If there is no specific description, the endian of data is **native endian**.
|
||||||
|
Because all data are transmitted in local machine, so we use native endian.
|
||||||
|
|
||||||
|
During the transmission, you may faced with some weired types which is obviously don't have fixed size or not common.
|
||||||
|
I will introduce them in there about how to transmit them.
|
||||||
|
|
||||||
|
### String
|
||||||
|
|
||||||
|
When transmitting string, it will transmit an `usize` at first to indicate the length of string in **character**, NOT in **byte**.
|
||||||
|
Then we transmit the string itself without NULL terminator.
|
||||||
|
All transmitted string is UTF-8.
|
||||||
|
|
||||||
|
### BSString
|
||||||
|
|
||||||
|
Transmitting BSString is similar with String.
|
||||||
|
The only difference between String and BSString is that the char type of BSString is platform-dependent.
|
||||||
|
In Windows, it is `wchar_t` (aka. `u16`), and in POSIX, it is `char` (aka. `u8`).
|
||||||
|
So the encoding of BSString is UTF-16 on Windows and UTF-8 on POSIX.
|
||||||
|
|
||||||
## Command Protocol
|
## Command Protocol
|
||||||
|
|
||||||
@@ -35,13 +53,22 @@ Trainer should attach some values following it to indicate some essential proper
|
|||||||
which instruct Representer how to generate data.
|
which instruct Representer how to generate data.
|
||||||
There is a table introduce these properties:
|
There is a table introduce these properties:
|
||||||
|
|
||||||
|Data Type|Comment|
|
|Data Type|Mnemonic|Comment|
|
||||||
|:---|:---|
|
|:---|:---|:---|
|
||||||
|u8|The pixel kind of image|
|
|u8|HEADLESS|True for headless mode. `0` for false and any other value for true.|
|
||||||
|u32|The width of image|
|
|u8|PIXEL_KIND|The pixel kind of image|
|
||||||
|u32|The height of image|
|
|u32|WIDTH|The width of image|
|
||||||
|
|u32|HEIGHT|The height of image|
|
||||||
|
|BSString|ENGINE_NAME|The name of used engine.|
|
||||||
|
|u32|ENGINE_DEVICE|The index of device used by engine.|
|
||||||
|
|BSString|DELIVER_NAME|The name of used deliver.|
|
||||||
|
|u32|DELIVER_DEVICE|The index of device used by deliver.|
|
||||||
|
|BSString|OBJECT_LOADER_NAME|The name of used object loader.|
|
||||||
|
|BSString|OBJECT_LOADER_FILE|The path to file loaded by object loader.|
|
||||||
|
|BSString|ANIME_LOADER_NAME|The name of used anime loader.|
|
||||||
|
|BSString|ANIME_LOADER_FILE|The path to file loaded by anime loader.|
|
||||||
|
|
||||||
For the all possible values of "pixel kind" in above table, there is also a table:
|
For the all possible values of "PIXEL_KIND" in above table, there is also a table:
|
||||||
|
|
||||||
|Value|Comment|
|
|Value|Comment|
|
||||||
|:---|:---|
|
|:---|:---|
|
||||||
|
|||||||
Reference in New Issue
Block a user