59 lines
1.4 KiB
Markdown
59 lines
1.4 KiB
Markdown
|
|
# Host COM Rebuild
|
||
|
|
|
||
|
|
## Goal
|
||
|
|
|
||
|
|
Keep the protocol layer small and explicit.
|
||
|
|
|
||
|
|
The COM layer should:
|
||
|
|
|
||
|
|
- define packet-facing helpers
|
||
|
|
- own frame parsing and packet building
|
||
|
|
- avoid transport concerns
|
||
|
|
- avoid UI and session concerns
|
||
|
|
|
||
|
|
## Completed Nodes
|
||
|
|
|
||
|
|
### Node 1: legacy protocol baseline
|
||
|
|
|
||
|
|
Files already present before this step:
|
||
|
|
|
||
|
|
- `KeyBorad/KeyBorad/COM/Com_Cdc.h`
|
||
|
|
- `KeyBorad/KeyBorad/COM/Com_CdcEncode.h`
|
||
|
|
- `KeyBorad/KeyBorad/COM/Com_CdcEncode.cpp`
|
||
|
|
- `KeyBorad/KeyBorad/COM/Com_CdcDecode.h`
|
||
|
|
- `KeyBorad/KeyBorad/COM/Com_CdcDecode.cpp`
|
||
|
|
|
||
|
|
Design notes:
|
||
|
|
|
||
|
|
- these files preserve the old packet format
|
||
|
|
- they already encode and decode complete CDC frames
|
||
|
|
- they also contain per-packet payload helpers
|
||
|
|
|
||
|
|
### Node 2: unified protocol entry
|
||
|
|
|
||
|
|
Files added in this step:
|
||
|
|
|
||
|
|
- `KeyBorad/KeyBorad/COM/Com_ProtoCodec.h`
|
||
|
|
- `KeyBorad/KeyBorad/COM/Com_ProtoCodec.cpp`
|
||
|
|
|
||
|
|
Design notes:
|
||
|
|
|
||
|
|
- provides a thin and readable entry point for higher layers
|
||
|
|
- keeps `DRI` from depending on packet parsing
|
||
|
|
- keeps `LGC` from depending on low-level byte layout details
|
||
|
|
- starts from the smallest useful handshake path
|
||
|
|
|
||
|
|
Implemented behavior:
|
||
|
|
|
||
|
|
- build `HelloReq` frame
|
||
|
|
- validate whether a parsed packet is `HelloRsp`
|
||
|
|
- decode `HelloRsp`
|
||
|
|
- forward frame parsing and stream extraction to the existing low-level codec
|
||
|
|
|
||
|
|
## Next COM nodes
|
||
|
|
|
||
|
|
- bitmap encode/decode helper
|
||
|
|
- ack/error helper
|
||
|
|
- time sync and theme helper
|
||
|
|
- replace direct `Com_Cdc*` calls in higher layers with `Com_ProtoCodec*`
|