1.6 KiB
1.6 KiB
Host LGC Rebuild
Goal
Keep the logic layer small, readable, and teachable.
The logic layer should:
- own connection state
- own handshake state
- call DRI for bytes
- call COM for frame and packet parsing
- expose a small interface to APP
The logic layer should not:
- parse serial bytes by itself
- enumerate devices directly
- own widget code
Completed Nodes
Node 1: function executor shell
Files:
KeyBorad/KeyBorad/LOGIC/Lgc_FunctionExecutor.hKeyBorad/KeyBorad/LOGIC/Lgc_FunctionExecutor.cpp
Design notes:
- keep function execution out of session code
- reserve one place for OS-specific actions
- keep the initial implementation small
Node 2: state model
Files updated in this step:
KeyBorad/KeyBorad/LOGIC/Lgc_State.h
Design notes:
- state is plain data
- connection text and last action text live here
- handshake result fields live here
Node 3: session handshake path
Files completed in this step:
KeyBorad/KeyBorad/LOGIC/Lgc_Session.hKeyBorad/KeyBorad/LOGIC/Lgc_Session.cpp
Implemented behavior:
- try CDC handshake
- send
HelloReq - wait for
HelloRsp - store the active transport
- keep a stream buffer for CDC bytes
- return the next parsed packet to upper layers
Node 4: core facade
Files completed in this step:
KeyBorad/KeyBorad/LOGIC/Lgc_Core.hKeyBorad/KeyBorad/LOGIC/Lgc_Core.cpp
Implemented behavior:
- give APP one small entry point
- start CDC handshake through session
- expose
Start / Poll / Close / GetState - refresh state from
HelloRsp - update a simple action text when packets arrive