Skip to content

feat(modem): dial over the phone's Bluetooth serial port with AT commands - #3

Merged
DeepDiver1975 merged 2 commits into
feat/domain-to-mainfrom
feat/modem-at-dialer
Oct 26, 2026
Merged

DeepDiver1975 merged 2 commits into
feat/domain-to-mainfrom
feat/modem-at-dialer

Conversation

@DeepDiver1975

@DeepDiver1975 DeepDiver1975 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #5 (merge #5 into main first), review only the commits after it.

AtDialer — one dial is one connection: open the port, AT → OK, ATD <number> → OK, wait up to 5 s for CONNECT, close. The DL500A keeps the call up on the base after the link closes (verified by hand on 2026-10-26).

  • Connect timeout 10 s (opening the port brings up the Bluetooth link), dial timeout 15 s, both on an injected TimeProvider.
  • A silent phone → NoResponse. That is what the DL500A does while the PC also holds its audio connection, so the UI can name that cause.
  • ERROR / +CME ERROR → Rejected, BUSY → LineBusy, NO CARRIER / NO ANSWER → NoCarrier, NO DIALTONE; echo, blank lines, RING, CLIP: skipped.
  • ATD is never sent before the phone answered AT; cancellation closes the port and throws.
  • ProbeAsync sends AT only, for "Verbindung testen".

SerialPorts — lists ports per OS (macOS: /dev/cu.* without the two built-in ones; Linux: /dev/rfcomm* first; Windows: COM in numeric order), opens them off the caller's thread, and classifies failures: missing / busy (or no permission) / unreachable.

StreamAtChannel — CR LF out, CR/LF/CR LF in, and refuses to write anything that is not one line of printable ASCII (defence in depth behind TelUri).

43 tests (a link that breaks mid-dial — IOException — is NoResponse too, second commit); a handwritten ScriptedAtChannel replays the recorded DL500A transcript, FakeTimeProvider drives every timeout. Not yet run against the hardware through System.IO.Ports — that comes with the app.

🤖 Generated with Claude Code

DeepDiver1975 and others added 2 commits October 26, 2026 21:48
…ands

AtDialer runs one dial as one connection: open the port, AT, ATD, close.
A silent phone times out after 10 s on connect and 15 s on the dial and
reports NoResponse, which is what the DL500A does while the PC holds its
audio connection. ERROR/+CME ERROR, BUSY, NO CARRIER and NO DIALTONE map
to their own results; echo lines, RING and CLIP: are skipped. A probe
sends AT only.

SerialPorts opens the OS's SPP port (COM on Windows, /dev/cu.* on macOS,
/dev/rfcomm* on Linux) off the caller's thread and classifies why it did
not open; StreamAtChannel frames the lines and refuses to write anything
but one line of printable ASCII.

Tests replay the transcript recorded from a DL500A on 2026-10-26.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>
A serial stream throws IOException once the Bluetooth link behind it is
gone — phone switched off, out of range, RFCOMM dropped. AtDialer let it
escape; it now closes the port and reports NoResponse like a silent
phone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>
Base automatically changed from feat/domain-tel-uri to chore/bootstrap October 26, 2026 20:48
@DeepDiver1975
DeepDiver1975 changed the base branch from chore/bootstrap to feat/domain-to-main October 26, 2026 20:49
@DeepDiver1975
DeepDiver1975 merged commit afdc186 into feat/domain-to-main Oct 26, 2026
3 checks passed
@DeepDiver1975
DeepDiver1975 deleted the feat/modem-at-dialer branch October 26, 2026 20:53
DeepDiver1975 added a commit that referenced this pull request Oct 26, 2026
…c) (#4)

* feat(domain): parse tel: links and normalise the number to dial

TelUri reduces an RFC 3966 link to 0-9 * # with an optional leading +,
dropping visual separators, the printed "(0)" and all parameters. Since
whatever follows ATD is executed by the phone, a link carrying a line
break, a semicolon or any other character is refused, as is one longer
than 32 digits or 256 characters.

DialNumber turns +<home country> into a leading 0, any other + into 00,
and prepends the Amtsholung prefix from DialSettings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>

* fix(domain): refuse * and # in tel: links

On a landline a supplementary-service code such as *21*<number># sets up
call forwarding at the exchange. A link carrying one would divert every
call to the Feuerwehr's line, behind a confirm window that shows what
looks like a number. Links, and the Amtsholung prefix, are now digits
only; the attack is replayed in plain and percent-encoded form.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>

* feat(modem): dial over the phone's Bluetooth serial port with AT commands (#3)

* feat(modem): dial over the phone's Bluetooth serial port with AT commands

AtDialer runs one dial as one connection: open the port, AT, ATD, close.
A silent phone times out after 10 s on connect and 15 s on the dial and
reports NoResponse, which is what the DL500A does while the PC holds its
audio connection. ERROR/+CME ERROR, BUSY, NO CARRIER and NO DIALTONE map
to their own results; echo lines, RING and CLIP: are skipped. A probe
sends AT only.

SerialPorts opens the OS's SPP port (COM on Windows, /dev/cu.* on macOS,
/dev/rfcomm* on Linux) off the caller's thread and classifies why it did
not open; StreamAtChannel frames the lines and refuses to write anything
but one line of printable ASCII.

Tests replay the transcript recorded from a DL500A on 2026-10-26.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>

* fix(modem): report a link that breaks mid-dial as no response

A serial stream throws IOException once the Bluetooth link behind it is
gone — phone switched off, out of range, RFCOMM dropped. AtDialer let it
escape; it now closes the port and reports NoResponse like a silent
phone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>

---------

Signed-off-by: Thomas Müller <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

* feat(applogic): confirm-before-dial and settings view models

DialViewModel is the window a tel: click opens: it shows the number that
will follow ATD and dials only when confirmed, closes two seconds after a
successful dial, and stays open with the reason otherwise. A link that
TelUri refuses shows no number and cannot be dialled.

SettingsViewModel picks the phone's port (keeping a stored one the OS
does not list right now), the Ländervorwahl and the Amtsholung, tests
the connection with AT only, places a test call, and asks the OS to make
Wählhilfe the tel: handler.

DialMessages holds the German status for every DialResult, naming the
audio-connection trap for a phone that does not answer. JsonSettingsStore
keeps the settings in the user's profile and drops hand-edited values the
settings window would refuse.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>

* fix(applogic): ignore a confirm in the dial window's first second

A tel: link can arrive while the Lagebuchführer is typing in another
program. The dial window comes to the front and takes focus, so an Enter
meant for that program would confirm the call — the one thing the
confirm window is there to prevent. Wählen now arms one second after the
window opens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Thomas Müller <[email protected]>

---------

Signed-off-by: Thomas Müller <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant