feat(simulator): add local socket backend for aux serial ports#7285
Draft
raphaelcoeffic wants to merge 3 commits intofix-7283from
Draft
feat(simulator): add local socket backend for aux serial ports#7285raphaelcoeffic wants to merge 3 commits intofix-7283from
raphaelcoeffic wants to merge 3 commits intofix-7283from
Conversation
Contributor
|
Very cool, this was long on my whish-list. Did not do any testing but it sounds very good. |
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>
0c92db5 to
3242687
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 aHostSerialBackendinterface; the existingQSerialPortpath 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
AF_UNIXclient at/tmp/edgetx-sim-aux1.