Commit Graph
18 Commits
Author SHA1 Message Date
Claude 7e1eb444cc PeerLoopbackTest: what C got when its BUSY doesn't come
It has failed now and then ("no C's BUSY") in a full run, not since in
14 alone: the failure now says C's events, its line's state and error,
and A's and B's events, for the next time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-25 08:03:19 +00:00
Claude 00b335a9d3 File transfers: plain text, verbatim
Protocol TEXT: a file's bytes sent exactly as they are (no line ending
changed, nothing added), as if typed, to an editor, a BBS, cat > a file;
received, what comes saved as it is until the line has been quiet for
10 s (a cancel ends it, what came kept). No cancel bytes: no protocol.
TextTransfer; the terminal's dialogs say what it does; iOS's transfers
have it too.

TextTransferTest (JVM and native): CR, LF, CR LF, tabs, UTF-8 and every
byte value sent unchanged and received as sent; through Transfer, its
end, nothing sent on cancel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-25 07:43:39 +00:00
Claude d699982f2e File transfers: Intel HEX and Motorola S-records
Two more ways to send and receive a file, for EPROM programmers, monitor
ROMs and boot loaders on a plain serial line: HexRecords encodes an image
as Intel HEX (16-byte data records, an extended linear address at each
64 KB, the end record) or S-records (an S0 header of the file's name,
S1/S2/S3 by the image's end, S5's count, S7/S8/S9) and decodes them back,
checksums and lengths checked, other lines (prompts, echoes) passed over,
gaps as an erased EPROM's 0xFF. HexTransfer sends a file a record a line
(a file of the format's records already, as it is), and receives the
records until the end record (or a 10 s pause once they've come) into
the image they hold. Protocol INTEL_HEX and SREC: the terminal's send and
receive dialogs (with what each does), iOS's transfers too. A cancel sends
nothing: there's no protocol to tell.

HexRecordsTest (JVM and native): Intel's and the S-record examples, images
there and back at three base addresses, address sizes, gaps, wrong
checksums, and sent and received on a line through Transfer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-25 07:25:04 +00:00
Claude e999857e57 Call tones without pops; the line chosen from a menu
The tones popped: the player asks for 50 ms at a time, and each piece
ramped its start in from silence (a counter that began at 0 each time),
some 20 dips a second. A burst's ramps now come from where the sample is
in the tone's cadence (Tone.burst), so the pieces are exactly one sound
(CountryTonesTest.inPiecesAsInOne: the same samples in pieces as in
one, and no jump bigger than the tone's own slope).

Settings: the line (SIP, Wi-Fi, Bluetooth, mobile calls) is a drop-down
menu instead of four radio buttons (PeerShotsTest.theLineFromItsMenu).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-18 23:45:14 +00:00
Claude 7a986263e6 The country's call progress tones: dial, ringing, busy, congestion
D-Modem-RE's ITU table (dsp/tones.cpp, 192 countries after E.180) in
the shared Kotlin (tones/: generated by tools/country_tones.py, checked
against the submodule by CountryTonesSourceTest), with a synthesizer
for its tones (two frequencies, or one modulated; the cadence, its
edges ramped).

Android:
- Settings: the country picked from the list (searched, each with its
  tones, a button to hear them), for the modem (its line settings, how
  it hears busy) and the tones; "Call progress tones" on or off
- dialling a directory entry plays a second of the country's dial tone
  before ATD
- CallProgress plays the busy tone on BUSY, the congestion tone for a
  dial that ends (NO CARRIER, NO DIALTONE) before the far end answered,
  and the ringing tone while the other phone rings on the phone-to-phone
  line (no network there to play one); a handshake stops them
- CallTones plays them on the phone's speaker, in their own stream

iOS: the country picker in Settings (it had the setting, not the UI).

Tests: CountryTonesTest (the table, each tone's frequencies and cadence,
on the JVM and natively), CallTonesTest (when each plays; a second of
the UK's dial tone, stopping, the preview).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-18 23:24:55 +00:00
Claude 1ff80c180f Shared jobs for iOS: fax calls, file transfers, dial-up internet
The modem's DTE lent to a job as Swift drives it: octets as Latin-1
strings, callbacks through fun interfaces (DteOut, LogOut, Changed)
rather than Kotlin lambdas, state read when it says it changed.

- FaxJob: send pages to a number, or answer and save the pages as a PDF
- TransferJob: ZMODEM/YMODEM/XMODEM/Kermit on the shared Transfer, now
  in common code (the Android terminal uses the same one)
- DialUpJob: ISP dialled, login script, PPP, packets to a PacketTunnel
- FaxImage: grey pixels as fax pages, at a threshold or dithered
- nativeMain: PosixFiles/PosixFolderIncoming for files by path, and
  UdpPacketTunnel relaying packets to iOS's packet tunnel extension
- PeerHost takes LogOut for its events and log (Swift can't pass a
  Unit-returning Kotlin lambda as a plain closure)

JobsTest runs each job on the JVM and natively (the fax both ways on
the fake class 1 line, ZMODEM between two jobs, PPP to a fake ISP);
NativeJobsTest covers the files and the UDP relay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-18 04:17:40 +00:00
Claude befcd0d5ef iOS: the line to another phone over Wi-Fi, found with Bonjour
shared (Kotlin/Native, iOS and Linux): FdDuplex (a socket: the engine's
line, a TCP connection; closing it wakes a blocked read), PosixTcpTransport
(calls taken on a port, polled so close() always ends it; host[:port] and
[IPv6]:port called within 5 s; no SIGPIPE: Linux's send flag, Apple's
socket option), and PeerHost: PeerLine on it from plain values for Swift
(no default arguments or flows there), its state as text. PosixPeerTest
(native): two phones over real TCP on the loopback, the modems socket
pairs: a call rung, answered and heard both ways, busy, the hang-up, a
wrong PIN turned away, nobody there.

DModemKit: ModemSession.onLine, the peer line's modem off hook to the
app (tested: a dial reaches it, its FAILED a NO CARRIER).

The app: the settings' line (a SIP account or another phone on Wi-Fi:
whom ATD calls, the port, the PIN, taking calls), phones found with
Bonjour (_dmodem._tcp, as the Android app's NSD offers them), this one
offered while it takes calls; Home's line its state and last failure.
And a start fixed: the modem's log while it started ended the
background audio (and now the line) before it was running.

The Swift and appleMain's Kotlin aren't built here (no Xcode); the
Kotlin is built and tested for Linux native.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-18 02:27:41 +00:00
Claude 133d5acb61 iOS app: SwiftUI on DModemKit and the shared terminal
ios/DModem (XcodeGen's project.yml, iOS 16): Home (the modem's state, the
rates and what the CONNECT was, the call's time, start, hang up, stop, an
AT command line and its last words), the terminal (the shared Kotlin
emulator through TerminalBridge, drawn run by run in a Canvas; CP437 and
the VGA colours; the keyboard and a hardware one's arrows and Esc; Esc,
a sticky Ctrl, Tab and the arrows on a bar; pinch for the font), the log
(shared as text) and the settings (the SIP account or user:password@host,
incoming calls, T.38, the speaker, the AT commands at start, the log
levels). The modem's speaker on AVAudioEngine; the audio session (its
sound, or quiet) keeps a call going in the background. The DNS servers
from the resolver's state (SystemDNS.c: iOS has no resolv.conf for the
engine).

shared: TerminalBridge, the terminal for Swift (octets as Latin-1 strings
both ways, rows as runs, keys, replies, the title, the look and the
character set), tested on the JVM and natively; the framework also as an
XCFramework (assembleDModemSharedXCFramework).

CI: the macOS job builds the shared XCFramework, runs DModemKit's tests
and builds the app for the simulator; the Linux job runs DModemKit's
tests on the host engine. Not built here: no Xcode on Linux (DModemKit,
TerminalBridge and SystemDNS.c are).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-18 02:15:16 +00:00
Claude 7db2a88b79 iOS: DModemKit, the app's modem apart from its views; terminal rows as runs
ios/DModemKit (Swift package): the engine (dmodem_engine.h) from Swift
(Engine: its config, its callbacks to a listener), its DTE (read on a
thread of its own, written), the settings (ModemSettings, as the Android
app's: the SIP account or the Wi-Fi peer line, user:password@host, kept in
UserDefaults, read leniently), ConnectInfo ("V.cvm · LAPM"), and
ModemSession (started from the settings: status, log, console, the DTE's
data, the speaker) for the views to watch. On Apple's systems the engine
is the XCFramework; on Linux the host build's libraries
(DMODEM_HOST_BUILD), so its tests run there: a session on a peer line
answering AT commands, a dial handed to the app and turned down busy.

shared: TerminalEmulator.runs(), a screen row as styled runs with their
colours resolved as TerminalView has them (the remote's palette, bold as
bright, iCE colours, inverse, faint), for a view that draws text (the iOS
app's); tested on the JVM and natively.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-18 02:09:13 +00:00
Claude 0f43be88a5 ZMODEM receiving: a noisy fast line's leftovers aren't errors
After a damaged subpacket our ZRPOS reaches sz at once, but what it
streamed before it still comes; broken headers in that data counted as
errors in a row, each with a ZRPOS of its own (each a restart, with
leftovers of its own), until ten of them gave up on the line. For a
second after a ZRPOS a broken header is let go by; 8 KB without a
header is one missing, asked for again; a stale ZEOF is asked for again
only after the second. A ZDATA not where we are still always gets one
(sz waits for our ACKs now and then: ignoring it, both sides waited).

Found by the interop tests once they stopped tracing every byte (the
trace had slowed the line). The cancel test reads the line slowly, so sz
is mid-file when cancelled, not done with all 2 MB queued here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 21:41:05 +00:00
Claude 7642aaa59f Shared io: background() on threads as many as the work, not I/O's 64
Blocking reads held on coroutines' I/O dispatcher (64 threads at most)
could leave the next background job waiting for a thread that never
came free: PeerLoopbackTest's PIN call hung in the full suite, after the
other tests' readers. The peer line, PPP and the transfers each hold a
few such threads in the app too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 19:31:55 +00:00
Claude b534be0dbc Fax: error correction mode (T.30 Annex A), sending and receiving
ECM when both machines have it (DIS/DCS bits 24 and 27): the page in
blocks of up to 256 FCD frames of 256 octets on the fast modulation,
RCP three times, then PPS; the receiver's MCF, or PPR with a map of the
frames that didn't come, sent again; after four PPRs CTC at a rate lower
(with the long training), after three CTCs EOR; RR for RNR; a PPS again
for an MCF lost. A class 1 modem carries ECM's HDLC as bits, so the
framing is ours (EcmHdlc: flags, zero stuffing, FCS-16).

A setting (on by default); FaxProgress.ecm. Tests: common Kotlin on
two class 1 modems in memory that spoil what they're told (PPR, CTC,
EOR, no ECM); the real modems with and without ECM; efax (no ECM) still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 18:30:42 +00:00
Claude 7b60aedd9d Phone-to-phone line: an optional PIN, as a challenge and response
With a PIN set, the phone called answers RING with CHALLENGE <nonce>
(16 random octets), the caller AUTH <md5("DMODEM/1:" nonce ":" PIN)>:
the PIN never goes on the connection. A wrong PIN (or none) gets DENIED
before the phone rings, the caller's modem NO CARRIER (FAILED 403), and
each failure in a row a longer wait (1 s doubling, up to a minute) before
the next PIN is checked. Mobile calls have none of it.

The setting in the Wi-Fi and Bluetooth line's fields; secureRandomBytes
in the shared io (SecureRandom, /dev/urandom natively); tests in common
Kotlin and with the real modems (peer_host).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 18:13:13 +00:00
Claude 8e85d1a465 Shared Kotlin: the line to another phone (PeerLine), the fax test page
PeerLine moves to shared/'s common Kotlin: its connections (Duplex) on
Source and Sink, its threads coroutines' I/O threads (background()), a
latch, atomicfu's locks and atomics; the transports (TCP, Bluetooth, the
mobile call) and the native modem's line stay the app's, on the same
interface.

The fax test page (a frame, bars, dashes, a checkerboard) is shared code
(FaxTestPage): the app's fax tests and T4Test both have it. (The fax
move left the app's fax tests without it: they compile again.)

PeerLoopbackTest (common: the JVM and native): two phones' lines in
memory, each modem answering every sample with its own; the call rung,
answered and heard both ways after the exchange's tones, a third phone
busy, the hang-up. The app's tests on two real modems pass on the shared
code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 15:16:15 +00:00
Claude 0fba297f3c Shared Kotlin: fax (T.4's MH, T.30, class 1, the PDF of the pages)
T4, T30, Class1 and FaxPdf move to shared/'s common Kotlin (the PDF
written to a Sink); the documents' rendering (Android's PdfRenderer) and
the fax manager stay the app's. T4Test in common Kotlin: the JVM and
native. The app's fax tests pass on the shared code, efax's calls over
two modems among them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 15:02:04 +00:00
Claude 9387f5eb21 Shared Kotlin: PPP (HDLC, LCP/PAP/CHAP/IPCP, client and server), IP packets, the chat scripts
Hdlc, Ip, Ppp and ChatScript move to shared/'s common Kotlin; the NAT
(its sockets) and Android's VPN stay the app's. What they needed of the
JVM, common: an IPv4 address (Inet4: on the JVM java.net.Inet4Address
itself, the app's code as it was), MD5 for CHAP, a timer (coroutines, one
piece at a time, as the scheduled executor), atomicfu's synchronized.

PppLoopbackTest (common: the JVM and native): a client and a server in
memory, the link up, the address and DNS given, IP both ways, the
hang-up; MD5 against RFC 1321's vectors. The app's PPP tests (the ISP,
the chat scripts, the internet line over two modems, the phone as an
ISP) pass on the shared code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 14:54:05 +00:00
Claude 65be65b015 Shared Kotlin: the file transfers (X/Y/ZMODEM, Kermit) and the I/O they're on
shared/'s io: what the shared code needs of I/O the same on the JVM and
iOS: Source and Sink (the JVM's streams through asSource()/asSink()), a
byte buffer, a queue of bytes read with a timeout (on coroutines'
channels), IOException (java.io's own on the JVM), the monotonic clock,
a sleep, the local time zone's offset.

The transfers move there (TransferIo, X/Y/ZMODEM, Kermit, the CRCs, the
files' Outgoing and Incoming); a folder of received files and a JVM file
to send stay the JVM's (FolderIncoming, Outgoing.of). Kermit's dates by
arithmetic (civil from days and back) in the local zone.

TransferLoopbackTest (common: the JVM and native): each protocol both
ways in memory, the files and their dates as sent. It found Kermit's
dates read wrong when they came as yyyymmdd (the 6-digit form matched
first): the 8-digit form first now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 14:48:27 +00:00
Claude 74a9c84cfc Kotlin Multiplatform: shared/, what the Android and iOS apps share, starting with the terminal's emulator
The terminal's VT/xterm emulator, its screen, Sixel, the character sets,
the keys, the characters' widths and the themes move to shared/'s common
Kotlin (the same package: the app's code as it was), their JVM-only calls
in common Kotlin's ways (code points, ISO 8859-1, copyInto, Base64.Mime).
The Android app has its JVM side; iOS its framework, DModemShared (iOS
devices, simulator); Linux native runs the common tests too.

TerminalEmulatorTest in common Kotlin (kotlin.test): on the JVM and
native; XtermFeaturesTest on the JVM. CI: the shared tests on Linux
(JVM, native) and on an iOS simulator (apple.yml).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-17 13:57:05 +00:00