feat(network): add LAN static IP/subnet/gateway configuration (closes #205)#211
Conversation
…205) Extend NetworkConfiguration with nullable StaticIP/SubnetMask/Gateway, add SetLanAddress/Mask/Gateway producers (and Get/GetConfigured query variants), and stage the static-IP commands in UpdateNetworkConfigurationAsync between password and APPLY so the firmware's runtime WiFi settings hold them when LAN:APPLY runs. Null fields are skipped so DHCP-only flows are unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Review Summary by QodoAdd LAN static IP/subnet/gateway configuration support
WalkthroughsDescription• Add nullable StaticIP, SubnetMask, Gateway properties to NetworkConfiguration with 7-arg constructor and Clone() support • Implement SetLanAddress, SetLanMask, SetLanGateway SCPI producers with null-argument guards • Add GetLanAddress, GetLanMask, GetLanGateway and GetLanConfigured* query variants for reading LAN settings • Stage static IP commands in UpdateNetworkConfigurationAsync between password and APPLY, skipping null fields for DHCP-only flows • Update INetworkConfigurable docstring to document static IP configuration step Diagramflowchart LR
NC["NetworkConfiguration<br/>+ StaticIP?<br/>+ SubnetMask?<br/>+ Gateway?"]
SCPI["ScpiMessageProducer<br/>+ SetLanAddress<br/>+ SetLanMask<br/>+ SetLanGateway<br/>+ Get* queries"]
DSD["DaqifiStreamingDevice<br/>UpdateNetworkConfigurationAsync"]
FW["Firmware<br/>SYSTem:COMMunicate:LAN"]
NC -- "7-arg ctor + Clone" --> SCPI
SCPI -- "quoted form commands" --> DSD
DSD -- "stage before APPLY" --> FW
File Changes1. src/Daqifi.Core/Device/Network/NetworkConfiguration.cs
|
Code Review by Qodo
1. NetworkConfiguration copy constructor missing
|
…IPv4 Address Qodo review on PR #211: - Bug: UpdateNetworkConfigurationAsync was unconditionally overwriting the cached _networkConfiguration.StaticIP/SubnetMask/Gateway with the caller's input, which clobbered previously-set values when the caller passed null ("leave unchanged"). Only overwrite when non-null. - SetLanAddress/Mask/Gateway now reject non-IPv4 IPAddress inputs via AddressFamily.InterNetwork — firmware's inet_addr is IPv4-only and silently mis-sets on IPv6 strings, matching the IPv4-only convention already enforced by WiFiDeviceFinder. - Tests: add IPv6-rejection cases for the three setters, a cache-preservation regression test for partial-update semantics, and extend the apply-order test to assert SAVE follows the static-IP setters as well as APPLY. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Response to remaining Qodo summary items#4 — Static-IP tests don't assert SAVE ordering ✅ Fixed in de52892. Extended #5 — Null clears cached IPs (real bug) ✅ Fixed in de52892. #1 + #2 — Copy constructor ❌ Pushing back (replied inline). There is no copy constructor on #3 — IPv4 enforcement ✅ Fixed in de52892 (replied inline). All three setters now reject non-IPv4 inputs via |
Update the Network Configuration feature bullet and add a NetworkConfiguration example showing StaticIP/SubnetMask/Gateway, including the null = "leave unchanged" semantic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
StaticIP/SubnetMask/Gateway(IPAddress?) toNetworkConfiguration, with a 7-arg constructor andClone()carrying them; null = "leave unchanged" so DHCP-only callers see no behavior change.ScpiMessageProducer.SetLanAddress / SetLanMask / SetLanGateway(quoted form) plusGet*andGetLanConfigured*query variants matching the firmware'sSYSTem:COMMunicate:LAN:{ADDRess,MASK,GATEway}and:CONFigure:endpoints.DaqifiStreamingDevice.UpdateNetworkConfigurationAsyncbetween password andAPPLY(firmware reads runtime WiFi settings at APPLY time — see SCPILAN.c#L531). Only non-null fields are emitted.INetworkConfigurablestep-list docstring.Closes #205. Parent: #52 (Phase 7.1).
Firmware verification
Cross-checked against
daqifi-nyquist-firmware:SCPI_LANAddrSet/MaskSet/GatewaySetaccept the address as aSCPI_SafeParamStringpayload (quoted form is what existing SSID code uses and what the firmware accepts).SCPI_LANSettingsApplycallswifi_manager_UpdateNetworkSettings(pRunTimeWifiSettings), so the setters MUST run beforeAPPLY— not just beforeSAVEas the issue text loosely states.Test plan
dotnet build Daqifi.Core.sln— clean (no new warnings).dotnet test Daqifi.Core.sln— 986 passed / 0 failed on net9.0 and net10.0.NetworkConfigurationtests (defaults, full ctor, assign/clear, Clone with and without static IPs).INetworkConfigurabletests (full static IP, none → no static commands, partial → only non-null commands, local-cache update, ordering: ADDRess/MASK/GATEway all precede APPLY).UpdateNetworkConfigurationAsyncagainst a real Nyquist device and confirm the device comes back up on the requested address after restart.🤖 Generated with Claude Code