Files
KeyBoard_QT/docs/host_dri_rebuild.md

2.4 KiB

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

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

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

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

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