communication guide and quick ref added, command syntax verfied and corrected

This commit is contained in:
serversdwn
2025-12-23 20:32:05 +00:00
parent dac731f912
commit db6fd56673
9 changed files with 735 additions and 96 deletions

View File

@@ -24,16 +24,28 @@ The original code generated by Codex was functional and well-structured, but lac
### 2. Response Validation & Error Handling ([services.py](app/services.py))
**Issue**: DOD response parsing had no validation and silently failed on malformed data.
**Issue**: DOD response parsing had no validation and silently failed on malformed data. Additionally, the code only read the first line (result code) and didn't read the second line containing actual data. Start/Stop commands had incorrect syntax with spaces after commas.
**Fix**:
- Implemented proper two-line protocol handling:
- Line 1: Result code (R+0000 for success, or error codes 0001-0004)
- Line 2: Actual data (for query commands ending with `?`)
- Parse and validate result codes with specific error messages:
- R+0001: Command error
- R+0002: Parameter error
- R+0003: Spec/type error
- R+0004: Status error
- Fixed command syntax to match NL43 protocol:
- Setting commands: `$Command,Param` (NO space after comma)
- Changed `$Measure, Start` to `$Measure,Start`
- Changed `$Measure, Stop` to `$Measure,Stop`
- Validate response is not empty
- Check minimum field count (at least 2 data points)
- Remove leading `$` prompt if present
- Proper exception handling with logging
- Raise `ValueError` for invalid responses
**Impact**: Better debugging and prevents silent failures.
**Impact**: Now correctly receives and parses actual measurement data instead of just the success code. Start/Stop commands now work correctly. Better debugging and prevents silent failures.
### 3. TCP Enabled Check ([routers.py](app/routers.py))