Skip to content

feat(simulator): add local socket backend for aux serial ports#7285

Draft
raphaelcoeffic wants to merge 3 commits intofix-7283from
feat-simulator-socket-aux
Draft

feat(simulator): add local socket backend for aux serial ports#7285
raphaelcoeffic wants to merge 3 commits intofix-7283from
feat-simulator-socket-aux

Conversation

@raphaelcoeffic
Copy link
Copy Markdown
Member

@raphaelcoeffic raphaelcoeffic commented Apr 11, 2026

Summary

Lets simulator aux serial ports talk to a local socket (QLocalServer — AF_UNIX on macOS / Linux, named pipes on Windows), so user scripts can stand in for hardware without a USB-serial adapter. Backends are now pluggable behind a HostSerialBackend interface; the existing QSerialPort path is the other implementation. Configure via Settings → Configure Serial Ports; the dialog gains a per-port type selector and shows the resolved socket path.

Stacked on #7284 — review that first.

Test plan

  • Pick Local socket for an AUX port, exchange bytes with a Python AF_UNIX client at /tmp/edgetx-sim-aux1.
  • Switch back to Serial port, confirm a real USB-serial device still works (refactor regression check).
  • Re-open the dialog and confirm the current type + spec round-trip.

@raphaelcoeffic raphaelcoeffic changed the title eat(simulator): add local socket backend for aux serial ports feat(simulator): add local socket backend for aux serial ports Apr 11, 2026
@wimalopaan
Copy link
Copy Markdown
Contributor

Very cool, this was long on my whish-list. Did not do any testing but it sounds very good.

raphaelcoeffic and others added 3 commits April 11, 2026 19:13
Phase 1 of pluggable host serial backends. Introduces an abstract
HostSerialBackend QObject interface and extracts the existing
QSerialPort handling into a QSerialPortBackend implementation.

HostSerialConnector becomes a thin per-port owner of a backend
pointer. Per-port encoding and baudrate are cached on the connector
so they survive backend swaps and reconnects.

Error reporting moves out of the connector: backends emit
errorOccurred, the connector forwards via a backendError signal,
and SimulatorMainWindow shows the message box.

No behaviour change. Sets up the next phase, which adds a
QLocalSocketBackend so user scripts can stand in for hardware on
simulator aux ports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds QLocalSocketBackend so user scripts can stand in for hardware
on simulator aux serial ports. Backed by QLocalServer, which uses
AF_UNIX on macOS / Linux and named pipes on Windows — no #ifdefs
on our side. Single-client semantics: a second connection while
one is active is rejected.

The Configure Serial Ports dialog grows a per-port type selector
(Not assigned / Serial port / Local socket) with a context-
dependent input widget — combo for serial, line edit prefilled
with edgetx-sim-aux<N> for sockets. While a socket is listening
the dialog shows the resolved native path so users know where
to point their script.

HostSerialConnector::connectSerialPort is replaced with a
generic connectBackend(index, kind, spec). Per-port encoding /
baudrate are still cached on the connector and re-applied across
backend swaps; setEncoding/setBaudrate are no-ops on the socket
backend.

Qt Network is now an explicit find_package COMPONENTS entry and
linked into the common library. It was previously pulled in
transitively by QNetworkAccessManager in updates/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
QLocalServer's default TempLocation on macOS is a per-user
$TMPDIR like /var/folders/.../T/, which is awkward to find when
the other end of the socket is a Python script driven from a
shell. Resolve bare names to /tmp/<name> on Unix so the path is
predictable and matches Linux. Absolute paths supplied by the
user pass through unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@raphaelcoeffic raphaelcoeffic force-pushed the feat-simulator-socket-aux branch from 0c92db5 to 3242687 Compare April 11, 2026 17:13
@raphaelcoeffic raphaelcoeffic added the enhancement ✨ New feature or request label Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants