feat(device): SetFriendlyNameAsync (part of #345) - #355
Conversation
Adds the device-level friendly-name composition that #302 left to consumers: validate (ScpiMessageProducer.IsFriendlyNameValid) -> SYSTem:DEVice:NAME "name" -> SYSTem:DEVice:NAME:SAVE -> optimistic Metadata.FriendlyName update. Deletes the reason for desktop's hand-rolled SetFriendlyName (its "no producer helper exists" note is stale). Addresses acceptance-criterion 2 of #345 (the PWM skip-if-unchanged and SCPI error-code consolidation items remain). - 8 unit tests: null/invalid/too-long/quote/backslash rejection (nothing sent), not-connected throws, valid name sends both commands + updates metadata, max-length accepted, cancellation throws and sends nothing. Bench-validated on Nq1 (FW 3.7.2): set the device's current name to itself (non-destructive) over serial; command executed and metadata updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
/agentic_review |
PR Summary by Qodofeat(device): Add DaqifiStreamingDevice.SetFriendlyNameAsync
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
Context used 1.
|
… semantics Addresses a Qodo observation on #355 ("async completion misleading"). Documents that the returned task completes when the commands are enqueued to the outbound producer, not when the device has applied/persisted the name (the firmware does not acknowledge these commands) — the same fire-and-forget contract as LoadNetworkConfigurationAsync / FactoryResetNetworkAsync. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Re: Async completion misleading — this is a deliberate, codebase-consistent design rather than a defect. I've made the semantics explicit in the doc (be74dbd): the returned task completes once the commands are enqueued to the outbound producer, not when the device has applied/persisted the name. Behavior unchanged. |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit be74dbd |
|
Latest Qodo pass clean (Bugs 0, updated to be74dbd), CI green, full suite 1644 pass, bench-validated on Nq1. Bench-verified, ready for review. |
Summary
Adds the device-level
SetFriendlyNameAsyncthat #302 left to consumers — addressing item 2 of the #345 batch. Composes the producer commands already in Core into the validate → set → save → optimistic-update sequence desktop currently hand-rolls (its "no producer helper exists" comment is now stale and its copy can be deleted on the next Core bump).Changes
DaqifiStreamingDevice.SetFriendlyNameAsync(string name, CancellationToken):ScpiMessageProducer.IsFriendlyNameValid(throwsArgumentExceptionbefore sending anything).SYSTem:DEVice:NAME "name"thenSYSTem:DEVice:NAME:SAVE, then optimistically setsMetadata.FriendlyName(the device doesn't echo the name back synchronously).Testing
dotnet test— 1644 passed / 0 failed / 2 skipped (net9.0 + net10.0).ArgumentNullException; invalid/too-long/"/\→ArgumentExceptionwith nothing sent; not-connected →InvalidOperationException; valid → sends both commands in order + updates metadata; max-length (31) accepted; pre-cancelled token → throws and sends nothing.Scope note
This closes acceptance-criterion 2 of #345 only. The other two items — PWM
SetPwmFrequencyskip-if-unchanged (+ removing the MCP_lastSentPwmFrequencyHzworkaround) and consolidating SCPI error-code extraction intoScpiResponseClassifier— are intentionally left for separate focused PRs. Does not close #345.Not merging — for review.
🤖 Generated with Claude Code