Remove legacy COM codec
This commit is contained in:
@@ -20,69 +20,25 @@ The COM layer should not:
|
||||
|
||||
## Current file roles
|
||||
|
||||
### `Com_Cdc.h`
|
||||
### `Com_PbCodec.h/.cpp`
|
||||
|
||||
Owns the packet model:
|
||||
Owns the protobuf-side wrapper:
|
||||
|
||||
- packet types
|
||||
- fixed payload lengths
|
||||
- payload structs
|
||||
- full protobuf frame serialize / parse
|
||||
- checksum validation
|
||||
- typed helper entry points like hello request / response
|
||||
|
||||
### `Com_CdcEncode.h/.cpp`
|
||||
### `keyboard.pb.h/.cc`
|
||||
|
||||
Owns the write direction:
|
||||
Own the generated protocol model:
|
||||
|
||||
- checksum
|
||||
- full frame build
|
||||
- typed payload encode
|
||||
|
||||
### `Com_CdcDecode.h/.cpp`
|
||||
|
||||
Owns the read direction:
|
||||
|
||||
- full frame parse
|
||||
- stream extraction
|
||||
- typed payload decode
|
||||
- outer `CdcFrame`
|
||||
- business `CdcPacketBody`
|
||||
- all message definitions
|
||||
|
||||
## Completed nodes
|
||||
|
||||
### Node 1: legacy frame encode baseline
|
||||
|
||||
Already present before this step:
|
||||
|
||||
- build full frame
|
||||
- build all typed packets
|
||||
|
||||
### Node 2: typed packet decode completion
|
||||
|
||||
Files updated in this step:
|
||||
|
||||
- `KeyBorad/KeyBorad/COM/Com_CdcDecode.h`
|
||||
- `KeyBorad/KeyBorad/COM/Com_CdcDecode.cpp`
|
||||
|
||||
Design notes:
|
||||
|
||||
- keep decode logic flat and explicit
|
||||
- one helper for little-endian reads
|
||||
- one helper for type + length validation
|
||||
- one decode function per packet type
|
||||
|
||||
Implemented behavior:
|
||||
|
||||
- parse frame header and checksum
|
||||
- extract frames from a byte stream
|
||||
- decode:
|
||||
- `HelloReq`
|
||||
- `HelloRsp`
|
||||
- `Bitmap`
|
||||
- `FunctionKeyEvent`
|
||||
- `LedState`
|
||||
- `TimeSync`
|
||||
- `ThemeRgb`
|
||||
- `Ack`
|
||||
- `Error`
|
||||
|
||||
### Node 3: protobuf thin wrapper
|
||||
### Node 1: protobuf thin wrapper
|
||||
|
||||
Files added in this step:
|
||||
|
||||
@@ -102,16 +58,32 @@ Implemented behavior:
|
||||
- build `HelloReq` using generated protobuf types
|
||||
- parse `HelloRsp` using generated protobuf types
|
||||
|
||||
Current limit:
|
||||
### Node 2: remove legacy manual codec
|
||||
|
||||
- not wired into the project yet
|
||||
- protobuf runtime include and link setup is still pending
|
||||
Files removed in 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:
|
||||
|
||||
- no dual path
|
||||
- no hand-written payload encode/decode path left behind
|
||||
- protobuf is now the only packet encode/decode direction
|
||||
|
||||
Implemented behavior:
|
||||
|
||||
- checksum moved into `Com_PbCodec.cpp`
|
||||
- old manual packet structs and old codec files removed
|
||||
|
||||
## COM done criteria
|
||||
|
||||
For the current project stage, COM is considered done when:
|
||||
|
||||
1. every supported packet can be built
|
||||
2. every supported packet can be parsed
|
||||
3. stream extraction is stable
|
||||
4. higher layers no longer need to know byte offsets
|
||||
1. the protocol source is the `.proto` file
|
||||
2. generated `.pb.*` files exist
|
||||
3. `Com_PbCodec` provides thin project-facing helpers
|
||||
4. no legacy hand-written packet codec remains
|
||||
|
||||
Reference in New Issue
Block a user