feat: Add SD card operations to core library - #99
Conversation
Add ISdCardOperations interface and implementation on DaqifiStreamingDevice for SD card file listing, logging start/stop. Includes: - SdCardFileInfo model and SdCardFileListParser for device responses - ISdCardOperations interface (GetSdCardFilesAsync, Start/StopSdCardLoggingAsync) - ExecuteTextCommandAsync on DaqifiDevice for temporary text consumer switching - Full unit test coverage for parser, model, and operations Implements issue #52, sub-task 7.2. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to 671ee60
Previous suggestions✅ Suggestions up to commit 2e96955
|
||||||||||||||||||||||||||||||||
- Add null-guard to ParseFileList for defensive input validation - Validate SD card filenames to prevent SCPI command injection - Use string.IsNullOrWhiteSpace for fileName to handle empty/whitespace - Use StopStreaming() abstraction in StopSdCardLoggingAsync - Replace fixed delay with inactivity-based timeout in ExecuteTextCommandAsync Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…accessible DaqifiDeviceFactory.ConnectWithTransportAsync was creating DaqifiDevice, which meant the ISdCardOperations interface on DaqifiStreamingDevice was unreachable for factory-created devices. Add a transport constructor to DaqifiStreamingDevice and change the factory to create it instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
/improve |
|
Persistent suggestions updated to latest commit 671ee60 |
User description
Summary
ISdCardOperationsinterface and implementation onDaqifiStreamingDevicefor SD card file listing and logging controlSdCardFileInfomodel andSdCardFileListParserfor parsing device file list responsesExecuteTextCommandAsynconDaqifiDevicefor temporarily switching from protobuf to text consumer to collect text responsesImplements issue #52, sub-task 7.2 (SD card operations migration from desktop to core).
Test plan
dotnet build Daqifi.Core.slncompiles with 0 errorsdotnet testpasses all 441 tests on net8.0 and net9.0--sd-list,--sd-log-start,--sd-log-stop)🤖 Generated with Claude Code
PR Type
Enhancement
Description
Add
ISdCardOperationsinterface with file listing and logging controlImplement SD card operations on
DaqifiStreamingDeviceclassAdd
SdCardFileInfomodel andSdCardFileListParserfor parsing device responsesAdd
ExecuteTextCommandAsyncmethod for temporary text consumer switchingComprehensive unit test coverage for all new components
Diagram Walkthrough
File Walkthrough
ISdCardOperations.cs
SD card operations interface definitionsrc/Daqifi.Core/Device/SdCard/ISdCardOperations.cs
SdCardFileInfo.cs
SD card file information modelsrc/Daqifi.Core/Device/SdCard/SdCardFileInfo.cs
SdCardFileListParser.cs
SD card file list response parsersrc/Daqifi.Core/Device/SdCard/SdCardFileListParser.cs
Daqifi/directory prefix from file pathslog_YYYYMMDD_HHMMSS.binDaqifiDevice.cs
Add text command execution capabilitysrc/Daqifi.Core/Device/DaqifiDevice.cs
ExecuteTextCommandAsyncprotected method for text-based commandexecution
DaqifiStreamingDevice.cs
Implement SD card operations on streaming devicesrc/Daqifi.Core/Device/DaqifiStreamingDevice.cs
ISdCardOperationsinterface on streaming device classIsLoggingToSdCardproperty andSdCardFilescollectionGetSdCardFilesAsyncwith SD interface preparation andrestoration
StartSdCardLoggingAsyncwith auto-generated timestampedfilenames
StopSdCardLoggingAsyncwith proper state managementSdCardFileInfoTests.cs
Unit tests for file info modelsrc/Daqifi.Core.Tests/Device/SdCard/SdCardFileInfoTests.cs
ArgumentNullExceptionSdCardFileListParserTests.cs
Unit tests for file list parsersrc/Daqifi.Core.Tests/Device/SdCard/SdCardFileListParserTests.cs
Daqifi/directory prefixSdCardOperationsTests.cs
Comprehensive unit tests for SD card operationssrc/Daqifi.Core.Tests/Device/SdCard/SdCardOperationsTests.cs
TestableSdCardStreamingDevicemock for capturing sent messages