Expand logic state model
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
enum class Lgc_TransportType : quint8
|
||||
@@ -14,6 +15,13 @@ struct Lgc_State
|
||||
bool IsConnected = false;
|
||||
bool IsHandshakeDone = false;
|
||||
Lgc_TransportType ActiveTransport = Lgc_TransportType::None;
|
||||
QString ActiveEndpointName;
|
||||
QString ConnectionText = QStringLiteral("Disconnected");
|
||||
QString LastActionText = QStringLiteral("Idle");
|
||||
quint32 ProtocolVersion = 0;
|
||||
quint32 CapabilityFlags = 0;
|
||||
quint16 VendorId = 0;
|
||||
quint16 ProductId = 0;
|
||||
quint8 FirmwareMajor = 0;
|
||||
quint8 FirmwareMinor = 0;
|
||||
};
|
||||
|
||||
72
docs/host_logic_rebuild.md
Normal file
72
docs/host_logic_rebuild.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# 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.h`
|
||||
- `KeyBorad/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 planned next:
|
||||
|
||||
- `KeyBorad/KeyBorad/LOGIC/Lgc_Session.h`
|
||||
- `KeyBorad/KeyBorad/LOGIC/Lgc_Session.cpp`
|
||||
|
||||
Target behavior:
|
||||
|
||||
- try CDC handshake
|
||||
- store the active transport
|
||||
- read next parsed packet
|
||||
|
||||
### Node 4: core facade
|
||||
|
||||
Files planned after session:
|
||||
|
||||
- `KeyBorad/KeyBorad/LOGIC/Lgc_Core.h`
|
||||
- `KeyBorad/KeyBorad/LOGIC/Lgc_Core.cpp`
|
||||
|
||||
Target behavior:
|
||||
|
||||
- give APP one small entry point
|
||||
- forward start/poll/close to session
|
||||
- refresh state from handshake results
|
||||
Reference in New Issue
Block a user