2026-04-11 09:31:49 +08:00
|
|
|
# Host DRI Rebuild
|
|
|
|
|
|
|
|
|
|
## Goal
|
|
|
|
|
|
|
|
|
|
Keep the device runtime layer small and transport-only.
|
|
|
|
|
|
|
|
|
|
The DRI layer should:
|
|
|
|
|
|
|
|
|
|
- enumerate endpoints
|
|
|
|
|
- open and close connections
|
|
|
|
|
- read raw bytes
|
|
|
|
|
- write raw bytes
|
|
|
|
|
|
|
|
|
|
The DRI layer should not:
|
|
|
|
|
|
|
|
|
|
- parse frames
|
|
|
|
|
- manage protocol state
|
|
|
|
|
- decide handshake success
|
|
|
|
|
|
|
|
|
|
## Completed Nodes
|
|
|
|
|
|
|
|
|
|
### Node 1: GATT placeholder
|
|
|
|
|
|
|
|
|
|
Files:
|
|
|
|
|
|
|
|
|
|
- `KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.h`
|
|
|
|
|
- `KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp`
|
|
|
|
|
|
|
|
|
|
Design notes:
|
|
|
|
|
|
|
|
|
|
- reserves the BLE transport position early
|
|
|
|
|
- keeps the implementation small for now
|
|
|
|
|
- avoids mixing GATT transport with logic concerns
|
|
|
|
|
|
2026-04-11 10:42:13 +08:00
|
|
|
Implemented behavior:
|
|
|
|
|
|
|
|
|
|
- keep the same surface shape as CDC:
|
|
|
|
|
- `Enum`
|
|
|
|
|
- `Open`
|
|
|
|
|
- `Close`
|
|
|
|
|
- `ReadBytes`
|
|
|
|
|
- `WriteBytes`
|
|
|
|
|
- stay transport-only
|
|
|
|
|
- keep real BLE implementation for a later node
|
|
|
|
|
|
2026-04-11 10:51:29 +08:00
|
|
|
### Node 2: BLE device discovery
|
|
|
|
|
|
|
|
|
|
Files updated in this step:
|
|
|
|
|
|
|
|
|
|
- `KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp`
|
|
|
|
|
- `KeyBorad/KeyBorad/KeyBorad.vcxproj`
|
|
|
|
|
|
|
|
|
|
Design notes:
|
|
|
|
|
|
|
|
|
|
- use Qt Bluetooth directly
|
|
|
|
|
- keep discovery synchronous for now so the first teaching step stays small
|
|
|
|
|
- only collect low-energy devices
|
|
|
|
|
|
|
|
|
|
Implemented behavior:
|
|
|
|
|
|
|
|
|
|
- start BLE discovery with `QBluetoothDeviceDiscoveryAgent`
|
|
|
|
|
- collect device name and address
|
|
|
|
|
- filter to `LowEnergyCoreConfiguration`
|
|
|
|
|
- stop after a short timeout
|
2026-04-11 13:53:34 +08:00
|
|
|
|
|
|
|
|
### Node 3: GATT open and raw byte transport
|
|
|
|
|
|
|
|
|
|
Files updated in this step:
|
|
|
|
|
|
|
|
|
|
- `KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.h`
|
|
|
|
|
- `KeyBorad/KeyBorad/DRI/GATT/Dri_Gatt.cpp`
|
|
|
|
|
|
|
|
|
|
Design notes:
|
|
|
|
|
|
|
|
|
|
- keep transport-only responsibility
|
|
|
|
|
- use Qt Bluetooth instead of custom Win32 BLE code
|
|
|
|
|
- connect, discover service, subscribe, then pass raw bytes upward
|
|
|
|
|
|
|
|
|
|
Implemented behavior:
|
|
|
|
|
|
|
|
|
|
- connect to a BLE device by address
|
|
|
|
|
- discover the target custom service
|
|
|
|
|
- resolve RX/TX characteristics
|
|
|
|
|
- enable notify on TX
|
|
|
|
|
- queue raw bytes from TX notify
|
|
|
|
|
- write raw bytes to RX characteristic
|
|
|
|
|
|
|
|
|
|
### Node 4: CDC transport cleanup
|
2026-04-11 09:31:49 +08:00
|
|
|
|
|
|
|
|
Files updated in this step:
|
|
|
|
|
|
|
|
|
|
- `KeyBorad/KeyBorad/DRI/Dri_Cdc.h`
|
|
|
|
|
- `KeyBorad/KeyBorad/DRI/Dri_Cdc.cpp`
|
|
|
|
|
|
|
|
|
|
Design notes:
|
|
|
|
|
|
|
|
|
|
- remove frame parsing from the driver
|
|
|
|
|
- remove handshake ownership from the driver
|
|
|
|
|
- keep only enumerate/open/close/read-bytes/write-bytes
|
|
|
|
|
|
|
|
|
|
Implemented behavior:
|
|
|
|
|
|
|
|
|
|
- list ports with `Dri_Cdc_Enum()`
|
|
|
|
|
- open one port with `Dri_Cdc_Open()`
|
|
|
|
|
- close one port with `Dri_Cdc_Close()`
|
|
|
|
|
- read raw bytes with timeout
|
|
|
|
|
- write raw bytes with timeout
|
|
|
|
|
|
|
|
|
|
## Next DRI nodes
|
|
|
|
|
|
|
|
|
|
- implement real GATT discovery and notify/write path
|
|
|
|
|
- provide one simple connection summary for logic layer
|