1.4 KiB
1.4 KiB
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.hKeyBorad/KeyBorad/COM/Com_CdcEncode.hKeyBorad/KeyBorad/COM/Com_CdcEncode.cppKeyBorad/KeyBorad/COM/Com_CdcDecode.hKeyBorad/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.hKeyBorad/KeyBorad/COM/Com_ProtoCodec.cpp
Design notes:
- provides a thin and readable entry point for higher layers
- keeps
DRIfrom depending on packet parsing - keeps
LGCfrom depending on low-level byte layout details - starts from the smallest useful handshake path
Implemented behavior:
- build
HelloReqframe - 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 withCom_ProtoCodec*