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
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
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
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
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
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
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