Skip to content

Add LAN disconnect/reconnect UI and clean shutdown (#17)#34

Merged
adecarolis merged 2 commits intomasterfrom
lan-disconnect-reconnect-ui
Apr 19, 2026
Merged

Add LAN disconnect/reconnect UI and clean shutdown (#17)#34
adecarolis merged 2 commits intomasterfrom
lan-disconnect-reconnect-ui

Conversation

@adecarolis
Copy link
Copy Markdown
Owner

Summary

  • Resolves Missing UI element to disconnect LAN after radio Power Down. #17: adds a web-only UI to release the radio's LAN slot so other apps (RS-BA1/wfview) can take over, and sends the 0x05 disconnect packet on clean shutdown.
  • New Disconnect/Connect button on the power-off overlay (LAN only); state flows via a lanStatus WebSocket message plus isLan/lanConnected fields in /api/v1/radio/{info,status}.
  • Fixes the follow-on bug where LAN reconnect left rigCaps unpopulated, causing "Unsupported command received from rig" spam and dead UI — resets modelID/haveRigCaps in commonSetup() and clears the queue's rigCaps pointer in closeComm() so rigCapsUpdated re-emits.

Test plan

  • LAN-connect to IC-7610, power off via UI, click Disconnect — verify 0x05 packet is sent and RS-BA1/wfview can then connect.
  • Click Connect again, power on, confirm commands work and no "Unsupported command" log spam.
  • Repeat disconnect/reconnect several times to confirm no QThread leaks and polling resumes each cycle.
  • Quit wfweb while LAN-connected and confirm the radio releases the slot (clean shutdown).
  • Non-LAN (serial) connection: confirm the Disconnect/Connect button is hidden.

🤖 Generated with Claude Code

Alain De Carolis and others added 2 commits April 17, 2026 22:18
Resolves #17: a web-only UI to release the radio's LAN slot (so other
apps like RS-BA1/wfview can use it) and ensures clean teardown sends
the 0x05 disconnect packet when wfweb exits.

Shutdown path: ~servermain() now calls icomCommander::closeComm() on
each rig synchronously (BlockingQueuedConnection) before quit'ing the
rig thread, so the udpHandlerThread finish -> udp deleteLater chain
runs and ~icomUdpBase() gets to emit the 0x05 packet. closeComm() now
also deletes its udpHandlerThread after wait() to avoid leaking QThread
objects on reconnect, and commonSetup() uses UniqueConnection so a
reconnect doesn't stack duplicate receiveCommand dispatches.

UI: new Disconnect/Connect button on the power-off overlay, shown only
when the connection type is LAN. When disconnected the overlay is
forced visible (so the Connect button is reachable), the Power On
button is hidden until reconnected, and the message flips to
"Disconnected from radio". State flows via a new lanStatus WebSocket
message plus isLan/lanConnected fields in /api/v1/radio/{info,status}.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After a LAN disconnect/reconnect cycle, every CI-V response from the
rig would log "Unsupported command received from rig" and UI commands
would stop working within seconds of power-up. Two causes in the
reconnect path of icomCommander:

- commonSetup() cleared rigCaps.commands but left rigCaps.modelID set
  from the previous session. parseCommand() only calls
  determineRigCaps() when modelID == 0, so on reconnect the command
  map was never repopulated and incoming responses failed to match.

- determineRigCaps() calls queue->setRigCaps(&rigCaps), but
  cachingQueue::setRigCaps is guarded by a pointer-equality check.
  Since the rigCaps instance is reused across reconnects, the signal
  rigCapsUpdated was suppressed — so servermain::receiveRigCaps never
  fired, AutoInformation stayed disabled and initPeriodicPolling()
  never ran.

Reset modelID and haveRigCaps in commonSetup() so determineRigCaps()
re-runs on the reconnect handshake, and clear the queue's rigCaps
pointer in closeComm() so the subsequent setRigCaps(&rigCaps) actually
re-emits rigCapsUpdated. Guard servermain::receiveRigCaps against the
resulting nullptr emission.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@adecarolis adecarolis merged commit d955999 into master Apr 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing UI element to disconnect LAN after radio Power Down.

1 participant