Merge pull request #53 from D-Modem/claude/project-thread-fur9m9

docs: rewrite the documentation in Simplified Technical English
This commit is contained in:
Neo authored and GitHub committed 2026-11-15 21:44:17 -08:00
commit e48d2482dd
18 files changed
+959 -654

No files matched your search

+10 -8
View File
@@ -1,7 +1,9 @@
# Contributing
Contributions are welcome: issues, fixes and features alike. Before
sending a change, build it and run its tests ([docs/building.md](docs/building.md)).
We accept contributions: issues, fixes and features. Before you send a
change, build it and run its tests ([docs/building.md](docs/building.md)).
Write all technical documentation in ASD-STE100 Simplified Technical English. Follow docs/STYLE.md.
## The contributor agreement
@@ -50,9 +52,9 @@ does it):
It says that you agree to the above for that commit. A contribution
without it cannot be merged.
A check on each pull request looks for that line, with the commit
author's email, on every commit. If it's missing, `git rebase --signoff
main` (or `git commit --amend -s` for the last commit) adds it; then
force-push. Pull requests from the D-Modem Authors themselves (the
repository's owner and the D-Modem organization's members) are not
checked.
A check on each pull request looks for that line, with the email of the
commit author, on each commit. If the line is missing, use
`git rebase --signoff main` to add it. For the last commit only, you can
use `git commit --amend -s`. Then force-push. The check does not examine
pull requests from the D-Modem Authors (the owner of the repository and
the members of the D-Modem organization).
+21 -20
View File
@@ -4,38 +4,39 @@
A dial-up modem in your pocket: the D-Modem app for Android and iOS.
The app is a V.92/V.90/V.91, V.34 and class 1 fax modem whose telephone
line is a SIP account's G.711 call, over Wi-Fi or mobile data. The modem
is [D-Modem](https://github.com/D-Modem/D-Modem)'s open modem core and
DSP, built for the phone; no modem hardware is needed. Toward a BBS on a
real phone line it is the digital modem, up to 56000 bit/s downstream;
toward another digital modem, V.91 at up to 62667 bit/s both ways.
The app is a V.92/V.90/V.91, V.34 and class 1 fax modem. Its telephone
line is the G.711 call of a SIP account, through Wi-Fi or mobile data. The
modem is the open modem core and DSP of
[D-Modem](https://github.com/D-Modem/D-Modem), built for the phone. You do
not need modem hardware. Toward a BBS on a real phone line, the app is the
digital modem, at up to 56000 bit/s downstream. Toward another digital
modem, it uses V.91 at up to 62667 bit/s in the two directions.
- A terminal, a dialling directory and the modem's AT console
- Class 1 fax up to 14400 bit/s: PDFs and images sent, faxes received as PDFs, T.38 too
- Voice calls through the modem on the phone's speaker and microphone, and an answering machine that keeps messages on the phone (off until turned on)
- A vintage computer's external modem, on a USB serial adapter, [pico-serial](https://github.com/D-Modem/hardware), Bluetooth serial or TCP
- Real phone lines through USB modems (the pico-serial Line stick among them), a Hayes modem on a serial adapter, or a Bluetooth modem
- Two phones as each other's line over Wi-Fi or Bluetooth, no SIP account needed
- The phone's own mobile calls as a slow line, where Android allows it
- A terminal, a dialling directory and the AT console of the modem
- Class 1 fax at up to 14400 bit/s: the app sends PDFs and images, and receives faxes as PDFs. T.38 is also available
- Voice calls through the modem on the speaker and microphone of the phone, and an answering machine that keeps messages on the phone (disabled until you enable it)
- The external modem of a vintage computer, on a USB serial adapter, [pico-serial](https://github.com/D-Modem/hardware), Bluetooth serial or TCP
- Real phone lines through USB modems (for example, the pico-serial Line stick), a Hayes modem on a serial adapter, or a Bluetooth modem
- Two phones as the line for each other, through Wi-Fi or Bluetooth, without a SIP account
- The mobile calls of the phone as a slow line, where Android permits it
## Quick start
Android: open the project in Android Studio, or
Android: open the project in Android Studio, or do these commands:
git submodule update --init
./gradlew assembleDebug
iOS: see [docs/ios.md](docs/ios.md). The full steps, Docker included, are
in [docs/building.md](docs/building.md).
iOS: refer to [docs/ios.md](docs/ios.md). The full procedures, with Docker,
are in [docs/building.md](docs/building.md).
## Documentation
The documentation is also a website, [d-modem.github.io/app](https://d-modem.github.io/app/), with reference pages made from the code.
The documentation is also a website, [d-modem.github.io/app](https://d-modem.github.io/app/). It has reference pages that are made from the code.
[docs/](docs/README.md) covers the modem's lines, fax, voice calls, adapters and
phone lines, every screen of the app, building for Android and iOS, and
the source layout.
[docs/](docs/README.md) gives information about the lines of the modem, fax,
voice calls, adapters and phone lines, each screen of the app, the build for
Android and iOS, and the source layout.
## The D-Modem suite
+7 -6
View File
@@ -1,11 +1,12 @@
# The AT command reference
`at_commands.pdf` is D-Modem's AT command reference, the A5 manual:
`docs/at_commands.pdf` in [D-Modem/D-Modem](https://github.com/D-Modem/D-Modem),
`at_commands.pdf` is the AT command reference of D-Modem, the A5 manual. It
is `docs/at_commands.pdf` in [D-Modem/D-Modem](https://github.com/D-Modem/D-Modem),
built from `docs/at/at_commands.tex` (`docs/at/build.sh`). This copy is
from its main at 9a8cb09. `tools/at_reference.py` copies it from the D-Modem submodule
(`external/d-modem-re`); the D-Modem bump workflow runs it with each bump,
and CI's docs job fails when this copy isn't the submodule's.
(`external/d-modem-re`). The D-Modem bump workflow runs this script with each
bump. The docs job of CI fails if this copy is not the same as the copy in the
submodule.
The app shows it in Settings, AT commands, and from the terminal's menu
(`ui/AtReference.kt`).
The app shows the reference in Settings, AT commands, and from the menu of the
terminal (`ui/AtReference.kt`).
+17 -15
View File
@@ -13,21 +13,23 @@
| DroidSansMono.ttf | Droid Sans Mono | Apache 2.0 | AOSP `platform/frameworks/base/data/fonts` |
The retro terminal types (ANSI-BBS, RIPscrip, Amiga ANSI, the Commodores,
the Atari 8-bit and ST, Viewdata) draw their characters from their machines'
own character ROM fonts, in the shared code (`shared/.../terminal/RomFonts.kt`,
written by `tools/gen_rom_fonts.py`), not from a font file here. The glyphs
are SyncTERM's, from Synchronet's ciolib (`src/conio/allfonts.c`,
LGPL-2.0-or-later, copyright Rob Swindell and contributors;
`licenses/syncterm-fonts-LGPL-2.0.txt`): the IBM VGA's code page 437,
RIPterm's 8x8, the Commodore 64's and 128's, the Atari 8-bit's, the Amiga's
Topaz, Topaz Plus, MicroKnight, MicroKnight Plus, P0T-NOoDLE and mO'sOul,
Prestel's and the Atari ST's.
the Atari 8-bit and ST, Viewdata) do not use a font file from this folder.
They draw their characters from the character ROM fonts of their machines,
in the shared code (`shared/.../terminal/RomFonts.kt`, written by
`tools/gen_rom_fonts.py`). The glyphs come from SyncTERM, from the ciolib of
Synchronet (`src/conio/allfonts.c`, LGPL-2.0-or-later, copyright Rob Swindell
and contributors; `licenses/syncterm-fonts-LGPL-2.0.txt`). These are the
fonts: the code page 437 of the IBM VGA, the 8x8 of RIPterm, the fonts of the
Commodore 64 and 128, the font of the Atari 8-bit, the Topaz, Topaz Plus,
MicroKnight, MicroKnight Plus, P0T-NOoDLE and mO'sOul of the Amiga, and the
fonts of Prestel and the Atari ST.
Which character each code is comes from Rebecca Bettencourt's Legacy
Computing mappings (`mappings/legacy` in kreativekorp/charset), in
The character for each code comes from the Legacy Computing mappings of
Rebecca Bettencourt (`mappings/legacy` in kreativekorp/charset), in
`LegacyCharsets.kt` (written by `tools/gen_legacy_charsets.py`). That file
also has Unscii 2.1's `unscii-8` and `unscii-16` (public domain,
http://viznut.fi/unscii/), for the characters a machine's ROM hasn't got
(another model's, such as the Atari XL's international set).
also has `unscii-8` and `unscii-16` of Unscii 2.1 (public domain,
http://viznut.fi/unscii/). These give the characters that the ROM of a
machine does not have (the characters of another model, for example the
international set of the Atari XL).
The licence texts are in `licenses/`; the app shows them (Settings, Font licences).
The licence texts are in `licenses/`. The app shows them (Settings, Font licences).
+4 -3
View File
@@ -1,13 +1,14 @@
# D-Modem app documentation
- [The modem's line](lines.md): SIP, the phone's own mobile calls, no line, two phones as each other's line
- [The modem's line](lines.md): SIP, the mobile calls of the phone, no line, two phones as the line for each other
- [Fax](fax.md)
- [Voice calls and the answering machine](voice.md)
- [Serial adapters and real phone lines](adapters.md): pico-serial, USB modems, a modem on a USB serial adapter, a Bluetooth modem
- [The app, screen by screen](features.md)
- [Terminal types](terminals.md): the DEC line, PETSCII, ATASCII, videotex, ANSI-BBS and the graphics terminals, and how to test them
- [Settings reference](settings.md): every setting, its key and default, made from the code (`tools/settings_ref.py`)
- [Settings reference](settings.md): each setting, with its key and default, made from the code (`tools/settings_ref.py`)
- [Building the Android app](building.md)
- [The iOS app](ios.md): building and running on iPhone and iPad
- [The iOS app](ios.md): how to build and run the app on iPhone and iPad
- [Source layout](layout.md)
- [The AT command reference](../app/src/main/assets/docs/README.md), shown in the app
- [Documentation style](STYLE.md): the rules for ASD-STE100 Simplified Technical English
+142
View File
@@ -0,0 +1,142 @@
# Documentation style: ASD-STE100 Simplified Technical English
All technical documentation in the D-Modem project uses ASD-STE100
Simplified Technical English (STE). This guide gives the rules that we use.
It applies to READMEs, the `docs/` folders, wikis, specifications, design
documents, protocol write-ups, CONTRIBUTING files (except legal text) and
technical notes in the project files.
The official source is the ASD-STE100 specification (Issue 9) and its
dictionary. If this guide and the specification are different, use the
specification. You can get the specification free of charge from
<https://www.asd-ste100.org>.
## 1. What STE does not change
Do not change these items. Copy them exactly:
- Code, commands, file names, paths, URLs, identifiers and configuration keys.
- AT commands, S-registers, result codes and protocol message names.
- Numbers, units, addresses, offsets and register values.
- Titles of standards (for example, ITU-T V.92) and quotations from them.
- Product names, company names and the names of people.
- Legal text: licenses, the contributor agreement, copyright and trademark
notices. Legal text keeps its legal wording.
- Text that we copied from a third party (for example, `ORIGINAL-readme.txt`
files, firmware release notes, test fixtures).
## 2. Words
1. Use approved words from the STE dictionary, with their approved meaning
only. For example, "close" means "to move to the closed position". It
does not mean "near".
2. Use technical names (Category: technical names). For example: modem,
handshake, carrier, codec, constellation, packet, socket, thread,
buffer, firmware, sample rate, call, line, PBX, trunk, server, client.
3. Use technical verbs (Category: technical verbs) for processes that STE
does not cover. This project uses these technical verbs: build, compile,
link, configure, install, uninstall, boot, flash, download, upload, dial,
log in, log out, debug, decode, encode, modulate, demodulate, train,
retrain, negotiate, sign, encrypt, decrypt, compress, decompress, parse,
render, cache, merge, commit, push, clone, emulate, probe.
4. Use one word for one thing. Do not change between synonyms. For example,
if you write "softmodem", do not write "software modem" in the next
paragraph.
5. Use these verb forms only: infinitive, imperative, simple present, simple
past, simple future, and the past participle as an adjective.
6. Do not use "-ing" forms of verbs, except in technical names (for example,
"ring signal", "echo canceller"). Write "the modem starts to train", not
"the modem is training".
7. Do not use phrasal verbs. Write "start", not "start up". Write "find",
not "find out".
8. Do not make noun clusters of more than three words. Use prepositions to
break up longer clusters. Write "the receive buffer of the V.34 data
pump", not "the V.34 data pump receive buffer".
9. Use articles ("the", "a") and demonstrative adjectives ("this", "these")
before nouns where possible.
10. Do not use slang, idioms, contractions ("can't", "it's") or Latin
abbreviations ("e.g.", "i.e.", "etc."). Write "for example", "that is",
"and other items".
### Common replacements
| Do not write | Write |
|---|---|
| utilize, make use of | use |
| ensure, make certain | make sure |
| require, need to | is necessary, must |
| should | must (a rule) or write what occurs (a fact) |
| allow, enable (a person) | let, make it possible |
| approximately, roughly | about |
| perform, carry out | do |
| obtain, fetch, grab | get |
| prior to | before |
| in order to | to |
| via | through |
| currently | now |
| additional | more |
| e.g., i.e., etc. | for example, that is, and other items |
| turn on / turn off (a setting) | enable / disable (technical verbs for software settings) |
| set up (verb) | configure, install |
| figure out, find out | find, calculate |
| it's, can't, don't | it is, cannot, do not |
## 3. Sentences
1. Write one topic in one sentence.
2. Procedural sentences (instructions): 20 words or fewer.
3. Descriptive sentences: 25 words or fewer.
4. Use the active voice. In descriptive text, you can use the passive voice
only when you do not know who or what does the action.
5. Do not use semicolons to join sentences. Write two sentences.
6. Use a colon before a list. Use a vertical list when there are more than
two items.
7. Use connecting words ("then", "but", "if", "because") to show how two
sentences are related.
## 4. Procedures
1. Write instructions in the imperative ("Install the package").
2. Write one instruction in one sentence. You can write two actions in one
sentence only when the reader does them at the same time.
3. Write each step as a numbered item.
4. If a condition applies, write the condition first: "If the build fails,
delete the `build/` folder."
5. Put a warning or a caution before the step that it applies to. Do not put
it at the end of the procedure.
6. Write the result of a step in a separate sentence after the step, if the
reader must know it.
## 5. Descriptive writing
1. Give the most important information first.
2. Write one topic in one paragraph.
3. Do not write more than six sentences in a paragraph.
4. Use headings to divide long text into short sections.
5. Use tables for data that has rows and columns.
## 6. Warnings and cautions
Use a warning for a risk to persons. Use a caution for a risk to equipment,
data or the telephone line. Start with a short title, then the instruction,
then the risk:
> **CAUTION: DO NOT CONNECT THE BOARD TO A LIVE LINE WITHOUT THE ISOLATION
> TRANSFORMER.** The line voltage can cause damage to the codec.
## 7. Examples
| Before | After (STE) |
|---|---|
| You'll need to make sure the PBX is set up before you dial out. | Configure the PBX before you dial. |
| The handshake is performed by the answering modem, which then starts sending ANSam. | The answering modem starts the handshake. Then it sends ANSam. |
| Turn it off if it's causing trouble. | If this feature causes problems, disable it. |
| `crypto/tls` can't take such a hello, and it can't be rewritten for it. | `crypto/tls` cannot accept this type of hello. Also, you cannot change `crypto/tls` to accept it. |
## 8. Check before you commit
- Are all sentences short (20 words for instructions, 25 for descriptions)?
- Is each instruction in the imperative, with one action?
- Is there a word with "-ing", a phrasal verb or a contraction?
- Are code, commands and identifiers exactly the same as before?
- Did you keep legal text and third-party text unchanged?
+87 -64
View File
@@ -3,82 +3,105 @@
## A modem for a vintage computer: pico-serial
The phone can be a computer's external modem on a serial cable: on a
USB serial adapter (FTDI, CP210x, CH34x, PL2303 and CDC-ACM chips, under
the chip makers' IDs and the 1100 or so adapter makers' own that Linux's
drivers know: tools/usb-serial-ids; and Exar's XR21V141x and XR21B14xx),
Bluetooth serial, or TCP. [pico-serial](https://github.com/D-Modem/hardware)
is a USB-C to DB25 adapter made for it: plugged into the computer's
serial port it is the modem there. The app finds its control interface
and uses its lines and settings (its firmware/PROTOCOL.md):
The phone can be the external modem of a computer on a serial cable. The
connection can be one of these:
- the modem's DCD, DSR and RI each their own: a call ringing in raises RI
on the computer, as a real modem's ring does;
- the computer's DTR read from the board, so dropping it hangs up;
- the board's role (automatic, modem or computer port), where its speed
comes from (learned from the computer's typing, as a Hayes modem does,
or the app's), RTS/CTS flow control, and what it has carried, in the
serial port settings.
- A USB serial adapter. The app knows FTDI, CP210x, CH34x, PL2303 and CDC-ACM
chips, with the IDs of the chip makers and the IDs of the 1100 (about)
adapter makers that the Linux drivers know (tools/usb-serial-ids). It also
knows the XR21V141x and XR21B14xx of Exar.
- Bluetooth serial.
- TCP.
Any other CDC-ACM adapter's line notifications (`SERIAL_STATE`) are read
too, so the computer dropping DTR hangs up there as well.
[pico-serial](https://github.com/D-Modem/hardware) is a USB-C to DB25 adapter
for this use. When you connect it to the serial port of the computer, it is
the modem on that port. The app finds its control interface and uses its
lines and settings (refer to its firmware/PROTOCOL.md):
- The DCD, DSR and RI of the modem are each separate lines. An incoming call
that rings raises RI on the computer, as the ring of a real modem does.
- The app reads the DTR of the computer from the board. Thus, when the
computer drops DTR, the call hangs up.
- The serial port settings have these items: the role of the board
(automatic, modem or computer port), the source of its speed (learned from
the typed characters of the computer, as a Hayes modem does, or set by the
app), RTS/CTS flow control, and the quantity of data that it carried.
The app also reads the line notifications (`SERIAL_STATE`) of all other
CDC-ACM adapters. Thus, if the computer drops DTR, the call also hangs up on
those adapters.
## A real phone line: USB modems
The modem's line can also be a telephone line, through a USB modem that
carries the modem's sound (D-Modem's `usb_line.cpp`, as
`dmodemd --usb` drives them): a Smart Link SmartUSB56 (USB 0483:7554,
with caller ID, its ST7554 or ST75951 DAA), or a
[pico-serial](https://github.com/D-Modem/hardware) Line stick
(1209:0002, a Si3056 DAA: caller ID on hook, and the country's line
settings in its registers), or an Agere USB 2.0 soft modem (047E:2892,
047E:2828: 8000 Hz, caller ID, on its ROM's own isochronous stream,
nothing downloaded into it; a USB 2.0 port), or Apple's USB Modem for
Macs (A1101, 05AC:1401: a Si3056 DAA, USB audio for its samples,
`usb_apple.cpp`; caller ID and the country's line settings; not yet
tried on a real one). The phone runs the modem; plugged into it
(USB OTG) the stick is its line, with no SIP account or network. Settings,
Line, "A phone line, through a USB modem"; Android asks once whether
D-Modem may use it, and offers the app when one is plugged in.
The line of the modem can also be a telephone line, through a USB modem that
carries the sound of the modem. The app uses `usb_line.cpp` of D-Modem, as
`dmodemd --usb` uses it to control these modems. The app supports these USB
modems:
- A Smart Link SmartUSB56 (USB 0483:7554, with caller ID, and its ST7554 or
ST75951 DAA).
- A [pico-serial](https://github.com/D-Modem/hardware) Line stick
(1209:0002, a Si3056 DAA). It has caller ID on hook, and the line settings
of the country in its registers.
- An Agere USB 2.0 soft modem (047E:2892, 047E:2828). It has 8000 Hz and
caller ID, and uses the isochronous stream of its ROM. The app downloads
nothing into it. It needs a USB 2.0 port.
- The Apple USB Modem for Macs (A1101, 05AC:1401). It has a Si3056 DAA and
uses USB audio for its samples (`usb_apple.cpp`). It has caller ID and the
line settings of the country. We did not try it on a real modem yet.
The phone runs the modem. When you connect the stick to the phone (USB OTG),
the stick is the line of the modem, without a SIP account or network. Select
Settings, Line, "A phone line, through a USB modem". Android asks one time
if D-Modem can use the stick. When you connect a stick, Android offers the
app.
## A real phone line: a modem on a USB serial adapter
An external modem of its own (a US Robotics, a Zoom, any Hayes modem) on a
USB serial adapter plugged into the phone (a Prolific PL2303, PL2303GS
among them, FTDI, CP210x, CH34x, CDC-ACM, Exar: the adapters the serial
bridges know) can take D-Modem's modem's place: Settings, Line, "A phone
line, through a modem on a USB serial adapter", its speed (8N1) and
RTS/CTS. As with a Bluetooth modem, the terminal, the internet, fax and the
Linux's `/dev/ttyDM0` talk to it with its own AT commands; the status comes
from its result codes and its DCD, where the adapter reads it. DTR is held
up while the modem runs, and stopping it drops DTR (a modem at `&D2` hangs
up). Android asks once whether D-Modem may use the adapter
(`SerialAdapters`, which also keeps the modem's line, the Linux's
`/dev/ttyUSB0` and the USB bridge off each other's adapter). `SerialModemTest`.
A separate external modem (a US Robotics, a Zoom, or any Hayes modem) can
replace the modem of D-Modem. Connect it to the phone through a USB serial
adapter. The adapter can be one that the serial bridges know: a Prolific
PL2303 (for example, PL2303GS), FTDI, CP210x, CH34x, CDC-ACM or Exar. Select
Settings, Line, "A phone line, through a modem on a USB serial adapter", and
set its speed (8N1) and RTS/CTS.
As with a Bluetooth modem, the terminal, the internet, fax and the
`/dev/ttyDM0` of the Linux send their own AT commands to the modem. The
status comes from its result codes and from its DCD, if the adapter reads
DCD. The app keeps DTR high while the modem runs. When the modem stops, the
app drops DTR (a modem at `&D2` hangs up). Android asks one time if D-Modem
can use the adapter. `SerialAdapters` does this. It also prevents conflicts
between the line of the modem, the `/dev/ttyUSB0` of the Linux and the USB
bridge on an adapter. `SerialModemTest`.
## A real phone line: a Bluetooth modem
A modem of its own with Bluetooth's Dial-Up Networking profile, such as
Sony's BTA-NW1 (Bluetooth 1.1) on a phone line, can take D-Modem's
modem's place: Settings, Line, "A phone line, through a Bluetooth modem",
and the paired modem chosen (pair it in Android's Bluetooth settings
first; an older one asks for its PIN). The app connects to its DUN
service (unencrypted, or its serial port, if need be) and the terminal,
the internet and fax talk to it with its own AT commands; the status
(online, its speed) comes from its result codes. Its connection
dropping, the app connects again once.
A separate modem with the Dial-Up Networking profile of Bluetooth can
replace the modem of D-Modem. An example is the BTA-NW1 of Sony (Bluetooth
1.1) on a phone line. Select Settings, Line, "A phone line, through a
Bluetooth modem", and select the paired modem. First, pair the modem in the
Bluetooth settings of Android. An older modem asks for its PIN. The app
connects to its DUN service (unencrypted, or its serial port, if necessary).
The terminal, the internet and fax send their own AT commands to the modem.
The status (online, its speed) comes from its result codes. If the
connection drops, the app connects again one time.
An app can't list the USB devices itself: Android opens the one the user
allowed and gives its descriptor. libusb is built for Android in the app
(`app/src/main/cpp/usb/libusb.cmake`, D-Modem's pinned release) and
`usb_line.cpp` built with its three calls that look for the device
renamed to `usb/usb_android.cpp`'s, which start libusb without its device
discovery and give it that descriptor, wrapped, as the only device on the
bus. Tested on the build host on D-Modem's fake pico-serial Line
sticks, Agere modems and Apple USB Modems, and simulated exchange (`native-test/usb_line_test.py`, its `agere` run on the ROM's isochronous stream, its `apple` run on USB audio's streams: dialling,
caller ID, answering, CONNECT 33600, data each way, hanging up, unplugged);
not yet on a phone with a real stick. The phone's speaker isn't fed on
this line.
An app cannot list the USB devices itself. Android opens the device that the
user permitted and gives its descriptor. The app builds libusb for Android
(`app/src/main/cpp/usb/libusb.cmake`, the pinned release of D-Modem). It
builds `usb_line.cpp` with its three calls that look for the device renamed
to the calls of `usb/usb_android.cpp`. These calls start libusb without its
device discovery. They give it that descriptor, wrapped, as the only device
on the bus.
We tested this on the build host with the fake pico-serial Line sticks,
Agere modems and Apple USB Modems of D-Modem, and a simulated exchange
(`native-test/usb_line_test.py`). Its `agere` run uses the isochronous
stream of the ROM, and its `apple` run uses the streams of USB audio. The
tests cover: the dial, caller ID, the answer, CONNECT 33600, data in each
direction, the hang-up, and a disconnected stick. We did not test it yet on
a phone with a real stick. On this line, the app does not send sound to the
speaker of the phone.
+55 -49
View File
@@ -4,75 +4,81 @@
git submodule update --init
./gradlew assembleDebug testDebugUnitTest
You need JDK 17 or later and the Android SDK with platform 37, NDK
29.0.14206865 and CMake 3.31.6 (`sdkmanager "platforms;android-37.0"
"ndk;29.0.14206865" "cmake;3.31.6"`). D-Modem's CMake fetches libre and
Mbed TLS (git) while configuring and builds them with the NDK's toolchain
for each ABI; the SSH client (`native-ssh`) fetches libssh's and its own
Mbed TLS's release tarballs (pinned by SHA-256) the same way. The unit
tests build that SSH client for the build host too (`buildHostSsh`: CMake,
a C compiler and the JDK's JNI headers). `./gradlew connectedDebugAndroidTest` runs the instrumented
tests on a device or emulator (the native library loads and answers AT
commands).
These items are necessary: JDK 17 or later, and the Android SDK with platform
37, NDK 29.0.14206865 and CMake 3.31.6 (`sdkmanager "platforms;android-37.0"
"ndk;29.0.14206865" "cmake;3.31.6"`).
Or in Docker, with the same toolchain as CI (the submodules checked out
first: the build takes them from the tree), the debug APK into `out/`:
The CMake of D-Modem fetches libre and Mbed TLS (git) when it configures the
build. It builds them with the toolchain of the NDK for each ABI. The SSH
client (`native-ssh`) fetches the release tarballs of libssh and of its own
Mbed TLS (pinned by SHA-256) in the same way. The unit tests also build that
SSH client for the build host (`buildHostSsh`: CMake, a C compiler and the
JNI headers of the JDK). `./gradlew connectedDebugAndroidTest` runs the
instrumented tests on a device or emulator (the native library loads and
answers AT commands).
You can also build in Docker, with the same toolchain as CI. First, check out
the submodules, because the build takes them from the tree. This command puts
the debug APK into `out/`:
docker build --target apk --output out .
`docker build -t dmodem-android .` makes an image with the toolchain and
the source to run Gradle in; the `Dockerfile` has the rest (a release
build, the unit tests, a proxy's CA).
`docker build -t dmodem-android .` makes an image with the toolchain and the
source, to run Gradle in. The `Dockerfile` has the other options (a release
build, the unit tests, the CA of a proxy).
The native library alone, without Gradle:
To build only the native library, without Gradle:
cmake -S app/src/main/cpp -B build-arm64 -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-26
cmake --build build-arm64 --target dmodem_jni
The host test needs OpenSSL's headers (libssl-dev), and GoogleTest
(libgtest-dev, else CMake fetches it):
The host test needs the headers of OpenSSL (libssl-dev), and GoogleTest
(libgtest-dev). If GoogleTest is not installed, CMake fetches it:
cmake -S native-test -B build-host -G Ninja
cmake --build build-host
ctest --test-dir build-host --output-on-failure
Each engine test is a ctest test of its own (`ctest -R engine.` for
those alone); `build-host/engine_test --gtest_filter=*Ringing` runs one
directly, `ENGINE_TEST_LOG=1` with the engine's log as it comes.
Each engine test is a separate ctest test. To run only the engine tests, use
`ctest -R engine.`. To run one test directly, use
`build-host/engine_test --gtest_filter=*Ringing`. Add `ENGINE_TEST_LOG=1` to
see the log of the engine while the test runs.
With `build-host` built, the unit tests also make calls on its test
lines (fax between modems, against efax and D-Modem's own T.30, over
SIP with T.38, phone to phone, through mobile codecs); without it those
are skipped. The lines run at twice a phone line's pace
(`DMODEM_LINE_SPEED=1` for a real one's).
If `build-host` is built, the unit tests also make calls on its test lines
(fax between modems, against efax and the T.30 of D-Modem, over SIP with
T.38, phone to phone, through mobile codecs). If it is not built, the unit
tests skip those calls. The lines run at two times the rate of a phone line.
Set `DMODEM_LINE_SPEED=1` for the rate of a real line.
Each test run's logs go to `build/test-runs/<date_time>/<module>-<task>/`,
one file for each test (`<class>/<test>.log`: what it printed, the line
tools' logs among it, and a failure's stack trace). A run where nothing
failed deletes its folder; the build names the one it kept.
`KERMIT_TRACE=1` and `TRANSFER_TRACE=1` add the transfer tests' bytes
each way.
The logs of each test run go to `build/test-runs/<date_time>/<module>-<task>/`,
with one file for each test (`<class>/<test>.log`). The file has the output
of the test, with the logs of the line tools and the stack trace of a
failure. If no test fails, the run deletes its folder. If the build keeps a
folder, it gives its name. `KERMIT_TRACE=1` and `TRANSFER_TRACE=1` add the
bytes of the transfer tests in each direction.
Every function has a comment on the line just above it, or above its
annotations (Kotlin, Swift, shell), or a docstring (Python); C and C++ as
D-Modem's own rule has it. `tools/doc_check.py` lists any that don't
(and fails).
Each function has a comment on the line immediately above it, or above its
annotations (Kotlin, Swift, shell), or a docstring (Python). C and C++ follow
the rule of D-Modem. `tools/doc_check.py` lists each function without a
comment (and fails).
CI (`.github/workflows/android.yml`) runs all three, and that check; it needs a
`DMODEM_TOKEN` secret that can read the private D-Modem submodule.
CI (`.github/workflows/android.yml`) runs all three, and that check. It needs
a `DMODEM_TOKEN` secret that can read the private D-Modem submodule.
`.github/workflows/d-modem-bump.yml` keeps the submodule on D-Modem's
main: daily (or by hand) it opens a pull request that moves it, with the
AT command reference in the app's assets (`tools/at_reference.py`), set to
merge once CI passes. It needs a `DMODEM_BUMP_TOKEN` secret (its header
says which permissions).
`.github/workflows/d-modem-bump.yml` keeps the submodule on the main of
D-Modem. Each day (or when you start it manually), it opens a pull request
that moves the submodule, with the AT command reference in the assets of the
app (`tools/at_reference.py`). The pull request is set to merge when CI
passes. The workflow needs a `DMODEM_BUMP_TOKEN` secret (its header gives
the necessary permissions).
Signing comes from the environment: `ANDROID_KEYSTORE_FILE` (a PKCS12
The signing keys come from the environment: `ANDROID_KEYSTORE_FILE` (a PKCS12
keystore), `ANDROID_KEYSTORE_PASSWORD`, `ANDROID_KEY_ALIAS` and
`ANDROID_KEY_PASSWORD` (the store's password if unset). Without them a
debug build takes the SDK's debug key and a release build is unsigned. CI
decodes `ANDROID_KEYSTORE_BASE64` into that file: the repository's secrets
hold the debug keystore, the protected `release` environment's (main and
`v*` tags) the release one, which CI's `release` job signs with.
`ANDROID_KEY_PASSWORD` (if it is not set, the app uses the password of the
store). Without them, a debug build uses the debug key of the SDK, and a
release build is unsigned. CI decodes `ANDROID_KEYSTORE_BASE64` into that
file. The secrets of the repository hold the debug keystore. The secrets of
the protected `release` environment (main and `v*` tags) hold the release
keystore. The `release` job of CI signs with it.
+21 -14
View File
@@ -1,17 +1,24 @@
# Fax
Class 1 fax (T.30, MH coding, V.27ter, V.29 and V.17 up to 14400 bit/s),
sending PDFs and images and receiving into PDFs, on the SIP line (audio,
or T.38 when the far end asks for it) and the line to another phone.
A call answered is a fax or a data call by what the caller sends
(D-Modem's adaptive answer, `AT+FAA=1`, on unless the settings turn
it off): a fax machine's CNG, a V.8 fax call or T.38 from the far end
and the modem says FAX, and the app's fax receiver takes the call by
itself; a modem's handshake and it says DATA, then its CONNECT, for the
terminal and the bridges.
Error correction mode (T.30 Annex A) when the other machine has it: the
page in numbered HDLC frames, those a noisy line spoils sent again. Tested
against efax, against D-Modem's own T.30 machine (native-test's
`t30_line`, on a clean line and a noisy one), and over SIP with T.38
between the app's engine and dmodemd (`sip_fax_line`).
The app has class 1 fax (T.30, MH coding, V.27ter, V.29 and V.17 at up to
14400 bit/s). It sends PDFs and images, and it receives faxes into PDFs. Fax
operates on the SIP line (audio, or T.38 if the far end asks for it) and on
the line to another phone.
When the modem answers a call, the signal from the caller sets the type of
call: fax or data. This is the adaptive answer of D-Modem (`AT+FAA=1`). It is
enabled unless you disable it in the settings:
- If the far end sends the CNG of a fax machine, a V.8 fax call or T.38, the
modem says FAX. Then the fax receiver of the app takes the call
automatically.
- If the far end sends the handshake of a modem, the modem says DATA, and then
its CONNECT, for the terminal and the bridges.
The app uses error correction mode (T.30 Annex A) if the other machine has it.
In this mode, the page goes in numbered HDLC frames, and the app sends again
the frames that noise on the line damages. We tested fax against efax and
against the T.30 machine of D-Modem (`t30_line` in native-test, on a clean
line and on a noisy line). We also tested it over SIP with T.38 between the
engine of the app and dmodemd (`sip_fax_line`).
+299 -218
View File
@@ -1,222 +1,303 @@
# The app, screen by screen
- **Home**: what the modem is doing (off, ready, connecting, online with
its rates down and up and the call's time) and the one thing to do about
it (set up SIP, start, hang up, stop); the line (the SIP account,
incoming calls, the network, fax); quick dial of the systems last
dialled; the phone (a voice call made or answered, the answering
machine's messages: [voice.md](voice.md)); the terminal and the directory; the modem's console (folded,
with an AT command line).
- **A call ringing in** (SIP, the other phone, a mobile call): the
phone's incoming call notification (heads-up, over the lock screen,
the ringtone) and a popup over the app, with who's calling when the
line says (the other phone's name): Answer (ATA: a fax machine's call
goes to the fax receiver by itself, a modem's to the terminal), or
Ignore (it rings on, out of sight); Answer as fax too when adaptive
answer is off; Answer as a voice call, or Take a message (the
answering machine). Gone when the modem
answers (here, a computer on a bridge, S0) or the caller gives up.
- **Settings**: the SIP account (or paste `user:password@host`, as
dmodemd's `SIP_LOGIN`), taking incoming calls, T.38, the AT commands
sent at start (`ATX3` by default: SIP has no dial tone), the log levels;
the country, from the ITU's list of 192 (D-Modem's, after E.180):
the modem's line settings and how it hears busy, and the call progress
tones the app plays in its tones (a second of dial tone as an entry is
dialled, the ringing tone while the other phone rings, the busy or
congestion tone when a call can't be made), with a button to hear them.
`tools/country_tones.py` makes the shared Kotlin's copy of the table.
- **Terminal**: a VT100/VT220/xterm terminal on the modem (256 and 24-bit
colours, the alternate screen, bracketed paste, DEC line drawing) that
also speaks what BBSes expect: CP437, ANSI.SYS's cursor save/restore and
clear-home, bold as bright, iCE colours, and box drawing and block
characters drawn to fill their cells so ANSI art has no gaps. A
terminal type (Settings, and each directory entry's own) picks what it
is: xterm, ANSI-BBS (a PC's, in CP437, as SyncTERM is), RIPscrip, Avatar, Amiga ANSI, DEC VT52, VT100,
VT102, VT220, VT320, VT340, VT420, VT510, VT520 or VT525, a Commodore, an
Atari 8-bit or ST, Viewdata (Prestel), a Minitel or a Tektronix 4014. Each
answers the device attribute requests as that terminal did, knows only
its own sequences (a VT100 has no colours, a VT220 no xterm titles or
mouse), and gives SSH its `TERM` and Telnet its TERMINAL-TYPE. The DEC
terminals have their double-width and double-height lines, 80/132
column switching (the screen refits to the width), the VT52's own
sequences and graphics (and a VT100's VT52 mode), the UK character set,
the keyboard LEDs and parameter reports, and a printer port (from the
VT102 on) whose output is saved to a text file. The VT220 and VT320
add G0-G3 with their locking and single shifts, the national
replacement sets, DEC Supplemental and (VT320) DEC Technical and
Latin-1 as 96-character sets, 8-bit replies (S8C1T), protected
characters with selective erase (DECSCA, DECSED, DECSEL), the
conformance level (DECSCL), the printer, keyboard and user-defined key
status reports, the cursor and tab stop reports (DECCIR, DECTABSR), the
preferred supplemental set, user-defined keys (DECUDK: Shift with
F6-F20), and soft characters (DECDLD: the host's own glyphs, drawn from
its bitmaps). A VT320 also has its status line below the screen: the
cursor's place, or a line the host writes (DECSSDT, DECSASD). The VT420
adds left and right margins (DECLRMM, DECSLRM), the rectangular area
operations (copy, erase, selective erase, fill, attribute change and
reverse, as a rectangle or a stream, and the checksum), column insert
and delete, back and forward index, six pages (NP, PP, PPA, PPR, PPB),
the lines and columns asked for (DECSNLS, DECSLPP, DECSCPP), and the
keypad and backarrow modes; the VT5xx add the display extent report,
and the VT525 colour, with its colour table (DECAC, DECRQTSR, DECRSTS,
in RGB or DEC's HLS). The VT340 has the graphics: sixel images and
ReGIS (`ESC P p`) in 16 colour registers they share, ReGIS drawing on
an 800x480 screen over the text with its positions (absolute,
relative, the position stack, pixel vectors), vectors, circles, arcs
and curves, filled polygons, text in sizes and directions, the writing
controls (overlay, replace, complement, erase, the colour, patterns,
negative, shading), the screen controls (erase, background, address
mapping, the colour map in HLS or letters), the position and alphabet
reports, loadable alphabets and macrographs. The Tektronix 4014 is its
storage tube on its own (vectors, points, incremental plots and alpha
text in four sizes, the line styles, the beam's place reported, ESC FF
to clear), and xterm and the VT340 have it too as Tek mode (`ESC [ ? 38
h`, on the alternate screen until `ESC ETX`). The key bar gains the DEC keypad (PF1-PF4, digits, minus,
comma, period, Enter, in numeric or application mode), and on a VT220
or VT320 the LK201's F6-F20, Find and Select and a page of the
user-defined keys; a hardware numpad sends the keypad's keys. ANSI-BBS is
the PC's 80x25 drawn in the IBM VGA's own 8x16 code page 437, with
SyncTERM's additions: font selection (`ESC [ 0 ; n SP D`, SyncTERM's
font numbers: the C64's, C128's, Atari's, Amiga's, Prestel's and ST's
fonts), ANSI music (`ESC [ |`, and a bare
`ESC [ M` when a PLAY string follows it) played as a PC speaker would,
iCE colours when the BBS asks (`ESC [ ? 33 h`), the line speed it asks
to be shown at for ANSI animations (`ESC [ 0 ; n * r`), and doorway
mode for DOS doors (`ESC [ = 255 h`: the keys as a PC's scan codes).
Avatar is ANSI-BBS with FidoNet's compact codes as well (AVT/0 and
AVT/0+: ^L, ^Y's repeat, ^V's PC attributes, cursor moves, insert mode,
area scrolls, clears and fills, and pattern repeats). RIPscrip (1.54)
is ANSI-BBS whose lines starting `!|` draw on a 640x350 EGA screen over
an 80x43 text window: lines in their styles and thicknesses,
rectangles, bars, circles, ellipses, arcs, pie slices, Béziers,
polygons, flood fills in BGI's patterns or the host's, text, the
palette, viewport and text window, the clipboard, and mouse regions
and buttons that send their text when tapped; it answers `ESC [ !`
with its version. Amiga ANSI is
ANSI-BBS in Latin-1, the Amiga's set, in Topaz (the Amiga's own 8x8),
in colours from the Amiga's palette. The
Commodore types (C64, C128 in 40 or 80 columns, Plus/4, VIC-20, PET in
40 or 80 columns) speak PETSCII as CCGMS and Novaterm do: the screen
becomes the machine's (40x25, the VIC-20's 22x23) in its palette, drawn
in square cells from the machine's own 8x8 character ROM (the C64's,
or the C128's), with both character sets, the colour and cursor
codes, reverse, and the C128's ESC sequences, line feed, underline and
flash. Typing and pasting are turned into PETSCII (CTRL and C= with a
digit set colours, C= with a letter types its graphic), and the key bar
has RUN/STOP, CLR/HOME, INST/DEL, RVS, F1-F8 and a page of colour keys.
A capture is saved as a `.seq` file, and "Plain text" sends one back
as it is. The Atari 8-bit types (ATASCII, with the graphics set or the
XL's international one) give the screen editor's 40x24 in its blues,
inverse video, its cursor keys wrapping round the screen, CLEAR, EOL,
insert and delete of characters and lines, tabs, the buzzer and ESC to
show a control's character; CTRL with a letter types its graphic and
the key bar's INV key types the next character inverse. The Atari ST
types (80 columns in medium resolution's four colours, or 40 in low
resolution's sixteen) are TOS's VT52 with its additions: the pens (ESC
b, ESC c), reverse, wrap, the cursor saved and hidden, erases to the
screen's and line's start, line insert and delete, and the ST's own
character set. Viewdata is
Prestel's 40x24 of teletext: its attributes take a cell and change the
rest of the row (alpha and mosaic colours, flash, conceal, contiguous
or separated mosaics, hold, new and black background; double height is
drawn single), the 2x3 mosaics drawn from the app's own bitmaps, the
cursor wrapping round the screen, and # (Enter too) as the key that
sends. The Minitel is Teletel's 40x25 with its status row: US
addressing, text and mosaics (SO/SI), SS2's accents and symbols, the
ESC colours and attributes (the background and separation taking
effect at the next space or mosaic), REP, its CSI commands, the
protocol commands (it answers as a Minitel 2), scrolling or page mode,
the 80-column Mixte mode, the Téléinformatique mode as a VT100, and a
key bar of Envoi, Retour, Suite, Répétition, Correction, Sommaire,
Guide, Annulation and Connexion/Fin. Both save captures as `.vdt`. Colour
themes (VGA, xterm, Solarized, Dracula, Monokai, Gruvbox, Nord, green
and amber phosphor), fonts (Cascadia Code, Sauce Code Pro Nerd Font,
Source Code Pro, Roboto Mono, JetBrains Mono, Fira Code, OpenDyslexic
Mono, Inconsolata, Droid Sans Mono or the system's; real bold weights
from the variable fonts, optional ligatures; `app/src/main/assets/fonts`), 80/132/40 fixed columns or pinch to zoom, scrollback
with fling, long-press selection with copy, paste, share and open link,
an extra keys bar (Esc, sticky Ctrl/Alt, Tab, arrows with auto-repeat,
Home/End/PgUp/PgDn, F1-F12), volume keys as font size or Ctrl/Alt,
bell as vibration or flash, full screen, snippets, session capture to a
file (shared to other apps), hang up (+++ with its guard times, ATH),
and Start PPP: once a call is up (dialled and logged in by hand), the
app's PPP takes it, the phone's traffic through it as the internet's
own dial has it (`PppTakeoverTest`).
Files sent and received by ZMODEM, YMODEM, XMODEM(-1K) and Kermit, and
as Intel HEX or Motorola S-records for EPROM programmers, monitors and
boot loaders: a file sent as records (a file of them already, as it is:
S1/S2/S3 by the image's size, Intel's extended addresses past 64 KB),
records received with their checksums checked into the binary image
they hold (gaps 0xFF). Plain text too: a file's bytes sent verbatim,
as if typed (to an editor, a BBS, `cat > file`), and what comes saved
as it is until the line is quiet for 10 s.
- **Dial**: the dialing directory: each system's number (or SIP user), the
AT commands it needs before ATD, its terminal type, character set and backspace; one
tap starts the modem if it is off and dials.
- **Remote logins**: a server reached over the internet instead of the
modem, in a terminal session of its own. On Android a directory entry
connects by SSH, Telnet or rlogin (rlogin: the user's name sent as both
names, the window's size when the server asks). On iOS the Terminal
tab's network button opens the Remote screen: SSH (the server's key
kept the first time it's trusted; a password or the app's private key),
Telnet or rlogin. Telnet and rlogin
are the shared Kotlin's (`org.dmodem.app.net`).
- **SSH** is the same client on every platform, the GUI's on Linux,
Windows and macOS too: libdmodemssh (`native-ssh`), on libssh 0.11 and
its own Mbed TLS (both built from their release tarballs, pinned by
SHA-256). Android loads it through JNI (`NativeSsh.kt`), iOS as the
`DModemSSHNative` XCFramework (`ios/DModemSSH`). Ed25519, ECDSA and RSA
keys, the host's and the user's; password, keyboard-interactive and
key logins, the key OpenSSH's, PEM or PuTTY's .ppk (read by the engine
itself, `native-ssh/src/ppk.c`); an agent's keys (on the desktops an
ssh-agent's socket, or on Windows Pageant or OpenSSH's agent:
`native-ssh/src/agent.c`); on Android and iOS the app's own keys (made here, or OpenSSH's,
PEM or PuTTY's .ppk imported; iOS keeps one, from Files, a .ppk turned
into OpenSSH's form with its passphrase, its public key to copy); on Android port forwards (-L, -R, -D: SOCKS 4/4a/5)
and agent forwarding (-A, each signature asked of the user when the
entry says). Its tests run against a real sshd: `native-ssh/test`,
and the app's JVM tests on a host build of the JNI library
(`./gradlew :app:buildHostSsh`, run by the unit tests).
- **Log**: the modem's and SIP's log (Copy for all of it).
- **AT commands** (Settings, AT commands, and the terminal's menu): the
AT command reference, D-Modem's manual (`docs/at_commands.pdf`, the
A5 edition) in the app (`app/src/main/assets/docs`), its pages shown
in the app with a zoom, or opened in the phone's PDF app for its search
and its contents' links.
- **Back**: from any other tab back to Home; on Home the app goes to the
background (the modem keeps running), as the Home button would.
- **Local Linux** (Settings, Linux): distributions installed and run
under proot, as root in /root, the phone's storage at /sdcard, and the
modem as a serial port at `/dev/ttyDM0` (a pty of the app's, bound in):
`minicom -D /dev/ttyDM0`, pppd, efax and the like work as on a real
modem. The program that opens it has the modem as a serial bridge's
client has it (one at a time, with the TCP, Bluetooth and USB bridges);
closing it drops DTR, so the call hangs up as a serial cable's end
would. `ModemTtyTest`, and `LinuxSystemTest` in a real Alpine under
proot: ATI from the distro, the modem's answer back.
A USB serial adapter plugged into the phone is `/dev/ttyUSB0` there (a
pty of the app's too: Android lets no app's programs at a USB device):
the app opens the adapter when a program opens the port and closes it
(DTR down) when the program does; the speed, stop bits, RTS/CTS and B0's
hang-up follow what the program sets (`stty`, minicom, pppd); a pty keeps
no character size or parity, so it is 8 data bits, no parity.
`SerialTtyTest`.
- **Dial-in** (Settings, Dial-up internet): the phone as an ISP for whoever
calls the modem, on SIP or any other line. A call that rings is answered
(unless the fax settings answer calls already); once it connects, the
modem's DTE is taken and a PPP server on the call gives the caller
10.64.64.2, DNS at 10.64.64.1 and the phone's network through the same
NAT the serial bridges' internet host uses. When the caller's PPP ends,
or none starts, the app hangs up; when the call drops, PPP stops. Home
shows the caller online, with what has gone each way and a Hang up
button. Tested over two of D-Modem's modems back to back
(`DialInLineTest`: answer, CONNECT 33600, the address, DNS and a ping
through the phone, the hang-up).
- **Home**: Home shows these items:
- The state of the modem (off, ready, connecting, online with its rates
down and up and the time of the call), and the one action for that
state (configure SIP, start, hang up, stop).
- The line (the SIP account, incoming calls, the network, fax).
- Quick dial of the systems that you dialled last.
- The phone (a voice call that you make or answer, and the messages of the
answering machine: [voice.md](voice.md)).
- The terminal and the directory.
- The console of the modem (folded, with an AT command line).
- **An incoming call that rings** (SIP, the other phone, a mobile call): the
app shows the incoming call notification of the phone (heads-up, over the
lock screen, the ringtone). It also shows a popup over the app, with the
name of the caller if the line gives it (the name of the other phone). The
popup has these options:
- Answer (ATA). The call of a fax machine goes to the fax receiver
automatically. The call of a modem goes to the terminal.
- Ignore. The call continues to ring, but the popup closes.
- Answer as fax, if adaptive answer is disabled.
- Answer as a voice call, or Take a message (the answering machine).
The modem runs in a foreground service (`ModemService`) with the CPU and
Wi-Fi kept awake for the call's real-time audio. The SIP user agent binds
to the addresses the phone has when it starts, so the service starts the
modem again when the default network changes (after the call, if one is
in progress). The DNS servers come from the active network: Android has
no `/etc/resolv.conf` for libre to read.
The popup closes when the modem answers (here, a computer on a bridge, or
S0) or when the caller stops the call.
- **Settings**: these items are in Settings:
- The SIP account. You can also paste `user:password@host`, as the
`SIP_LOGIN` of dmodemd.
- The acceptance of incoming calls, T.38, and the log levels.
- The AT commands that the app sends at the start (`ATX3` by default,
because SIP has no dial tone).
- The country, from the ITU list of 192 countries (the list of D-Modem,
after E.180). The country sets the line settings of the modem and how the
modem hears busy. It also sets the call progress tones that the app plays
in its tones: one second of dial tone when you dial an entry, the ringing
tone while the other phone rings, and the busy or congestion tone when a
call fails. A button plays them. `tools/country_tones.py` makes the copy
of the table in the shared Kotlin.
- **Terminal**: a VT100/VT220/xterm terminal on the modem (256 and 24-bit
colours, the alternate screen, bracketed paste, DEC line drawing). It also
accepts the codes that BBSes expect: CP437, the cursor save/restore and
clear-home of ANSI.SYS, bold as bright, and iCE colours. It draws box
drawing and block characters to fill their cells, thus ANSI art has no gaps.
A terminal type (in Settings, and in each directory entry) sets the type of
the terminal: xterm, ANSI-BBS (the terminal of a PC, in CP437, as SyncTERM
is), RIPscrip, Avatar, Amiga ANSI, DEC VT52, VT100, VT102, VT220, VT320,
VT340, VT420, VT510, VT520 or VT525, a Commodore, an Atari 8-bit or ST,
Viewdata (Prestel), a Minitel or a Tektronix 4014. Each type answers the
device attribute requests as that terminal did. Each type knows only its
own sequences (a VT100 has no colours, a VT220 has no xterm titles or
mouse). Each type gives SSH its `TERM` and Telnet its TERMINAL-TYPE.
The DEC terminals have these items: their double-width and double-height
lines, 80/132 column switching (the screen fits again to the width), the
sequences and graphics of the VT52 (and the VT52 mode of a VT100), the UK
character set, the keyboard LEDs and parameter reports, and a printer port
(from the VT102). The app saves the output of the printer port to a text
file.
The VT220 and VT320 add these items:
- G0-G3 with their locking and single shifts.
- The national replacement sets, DEC Supplemental and (VT320) DEC Technical
and Latin-1 as 96-character sets.
- 8-bit replies (S8C1T).
- Protected characters with selective erase (DECSCA, DECSED, DECSEL).
- The conformance level (DECSCL).
- The printer, keyboard and user-defined key status reports.
- The cursor and tab stop reports (DECCIR, DECTABSR).
- The preferred supplemental set.
- User-defined keys (DECUDK: Shift with F6-F20).
- Soft characters (DECDLD: the glyphs of the host, drawn from its bitmaps).
A VT320 also has its status line below the screen. The line shows the
position of the cursor, or a line that the host writes (DECSSDT, DECSASD).
The VT420 adds these items:
- Left and right margins (DECLRMM, DECSLRM).
- The rectangular area operations (copy, erase, selective erase, fill,
attribute change and reverse, as a rectangle or a stream, and the
checksum).
- Column insert and delete, and back and forward index.
- Six pages (NP, PP, PPA, PPR, PPB).
- The lines and columns that the host requests (DECSNLS, DECSLPP, DECSCPP).
- The keypad and backarrow modes.
The VT5xx add the display extent report. The VT525 adds colour, with its
colour table (DECAC, DECRQTSR, DECRSTS, in RGB or the HLS of DEC).
The VT340 has the graphics: sixel images and ReGIS (`ESC P p`) in 16 colour
registers that they share. ReGIS draws on an 800x480 screen over the text,
with these items:
- Its positions (absolute, relative, the position stack, pixel vectors).
- Vectors, circles, arcs and curves, and filled polygons.
- Text in sizes and directions.
- The writing controls (overlay, replace, complement, erase, the colour,
patterns, negative, shading).
- The screen controls (erase, background, address mapping, the colour map
in HLS or letters).
- The position and alphabet reports, loadable alphabets and macrographs.
The Tektronix 4014 is its storage tube as a separate type. It has vectors,
points, incremental plots and alpha text in four sizes, the line styles,
the report of the beam position, and ESC FF to clear. xterm and the VT340
also have it as Tek mode (`ESC [ ? 38
h`, on the alternate screen until `ESC ETX`).
The key bar gets the DEC keypad (PF1-PF4, digits, minus, comma, period,
Enter, in numeric or application mode). On a VT220 or VT320, it also gets
the F6-F20, Find and Select of the LK201, and a page of the user-defined
keys. A hardware numpad sends the keys of the keypad.
ANSI-BBS is the 80x25 of the PC, drawn in the 8x16 code page 437 of the IBM
VGA. It has these SyncTERM additions:
- Font selection (`ESC [ 0 ; n SP D`, with the SyncTERM font numbers: the
fonts of the C64, C128, Atari, Amiga, Prestel and ST).
- ANSI music (`ESC [ |`, and a bare `ESC [ M` if a PLAY string follows it).
The app plays it as a PC speaker does.
- iCE colours when the BBS requests them (`ESC [ ? 33 h`).
- The line speed that the BBS requests for ANSI animations
(`ESC [ 0 ; n * r`).
- Doorway mode for DOS doors (`ESC [ = 255 h`: the keys as the scan codes
of a PC).
Avatar is ANSI-BBS with the compact codes of FidoNet (AVT/0 and AVT/0+:
^L, the repeat of ^Y, the PC attributes of ^V, cursor moves, insert mode,
area scrolls, clears and fills, and pattern repeats).
RIPscrip (1.54) is ANSI-BBS in which the lines that start with `!|` draw on
a 640x350 EGA screen over an 80x43 text window. It draws lines in their
styles and thicknesses, rectangles, bars, circles, ellipses, arcs, pie
slices, Béziers, polygons, flood fills in the patterns of BGI or of the
host, text, the palette, the viewport and the text window, and the
clipboard. It has mouse regions and buttons that send their text when you
tap them. It answers `ESC [ !` with its version.
Amiga ANSI is ANSI-BBS in Latin-1 (the set of the Amiga), in Topaz (the
8x8 font of the Amiga), in colours from the palette of the Amiga.
The Commodore types (C64, C128 in 40 or 80 columns, Plus/4, VIC-20, PET in
40 or 80 columns) use PETSCII as CCGMS and Novaterm do. The screen becomes
the screen of the machine (40x25, or 22x23 for the VIC-20) in its palette.
The app draws it in square cells from the 8x8 character ROM of the machine
(the ROM of the C64 or of the C128). It has the two character sets, the
colour and cursor codes, reverse, and the ESC sequences, line feed,
underline and flash of the C128. The app changes typed and pasted text into
PETSCII. CTRL and C= with a digit set colours, and C= with a letter types
its graphic. The key bar has RUN/STOP, CLR/HOME, INST/DEL, RVS, F1-F8 and a
page of colour keys. The app saves a capture as a `.seq` file, and "Plain
text" sends it back without change.
The Atari 8-bit types (ATASCII, with the graphics set or the international
set of the XL) give the 40x24 of the screen editor in its blues. They have
inverse video, cursor keys that wrap round the screen, CLEAR, EOL, insert
and delete of characters and lines, tabs, the buzzer, and ESC to show the
character of a control. CTRL with a letter types its graphic. The INV key
of the key bar types the next character inverse.
The Atari ST types (80 columns in the four colours of medium resolution,
or 40 columns in the sixteen colours of low resolution) are the VT52 of TOS
with its additions. These are the pens (ESC b, ESC c), reverse, wrap, the
saved and hidden cursor, erases to the start of the screen and of the line,
line insert and delete, and the character set of the ST.
Viewdata is the 40x24 teletext of Prestel. Its attributes use a cell and
change the remaining part of the row (alpha and mosaic colours, flash,
conceal, contiguous or separated mosaics, hold, new and black background).
The app draws double height as single height. The app draws the 2x3
mosaics from its own bitmaps. The cursor wraps round the screen. # (and
also Enter) is the key that sends.
The Minitel is the 40x25 of Teletel with its status row. It has these
items:
- US addressing, text and mosaics (SO/SI), and the accents and symbols of
SS2.
- The ESC colours and attributes (the background and separation change at
the next space or mosaic).
- REP and its CSI commands.
- The protocol commands (it answers as a Minitel 2).
- Scroll mode or page mode.
- The 80-column Mixte mode, and the Téléinformatique mode as a VT100.
- A key bar of Envoi, Retour, Suite, Répétition, Correction, Sommaire,
Guide, Annulation and Connexion/Fin.
Viewdata and the Minitel save captures as `.vdt`.
The terminal also has these items:
- Colour themes (VGA, xterm, Solarized, Dracula, Monokai, Gruvbox, Nord,
green and amber phosphor).
- Fonts (Cascadia Code, Sauce Code Pro Nerd Font, Source Code Pro, Roboto
Mono, JetBrains Mono, Fira Code, OpenDyslexic Mono, Inconsolata, Droid
Sans Mono or the font of the system). Real bold weights from the variable
fonts, and optional ligatures (`app/src/main/assets/fonts`).
- 80/132/40 fixed columns, or pinch to zoom.
- Scrollback with fling.
- Long-press selection with copy, paste, share and open link.
- An extra keys bar (Esc, sticky Ctrl/Alt, Tab, arrows with auto-repeat,
Home/End/PgUp/PgDn, F1-F12).
- Volume keys as font size or Ctrl/Alt.
- Bell as vibration or flash.
- Full screen and snippets.
- Session capture to a file (shared to other apps).
- Hang up (+++ with its guard times, ATH).
- Start PPP. When a call is connected (you dialled and logged in
manually), the PPP of the app takes the call. The traffic of the phone
then goes through it, as with the dial of the internet screen
(`PppTakeoverTest`).
The terminal sends and receives files by ZMODEM, YMODEM, XMODEM(-1K) and
Kermit. It also sends and receives Intel HEX or Motorola S-records for
EPROM programmers, monitors and boot loaders:
- When it sends a file as records, it uses S1/S2/S3 by the size of the
image, and Intel extended addresses above 64 KB. If the file already
contains records, it sends the file without change.
- When it receives records, it checks their checksums and writes the
binary image that they hold (gaps are 0xFF).
Plain text is also available. The app sends the bytes of a file without
change, as if you typed them (to an editor, a BBS, `cat > file`). It saves
the received data without change until the line is silent for 10 s.
- **Dial**: the dialing directory. Each entry has the number of the system
(or the SIP user), the AT commands that are necessary before ATD, its
terminal type, its character set and its backspace. One tap starts the
modem if it is off, and dials.
- **Remote logins**: a server that the app connects to through the internet,
not through the modem, in a separate terminal session. On Android, a
directory entry connects by SSH, Telnet or rlogin. rlogin sends the user
name as the two names, and the size of the window if the server asks for
it. On iOS, the network button of the Terminal tab opens the Remote screen:
SSH, Telnet or rlogin. For SSH, the app keeps the key of the server the
first time that you trust it, and uses a password or the private key of the
app. Telnet and rlogin come from the shared Kotlin (`org.dmodem.app.net`).
- **SSH** is the same client on all platforms. The GUI also uses it on Linux,
Windows and macOS. It is libdmodemssh (`native-ssh`), on libssh 0.11 and
its own Mbed TLS. Both are built from their release tarballs, pinned by
SHA-256. Android loads it through JNI (`NativeSsh.kt`). iOS loads it as the
`DModemSSHNative` XCFramework (`ios/DModemSSH`). It has these items:
- Ed25519, ECDSA and RSA keys, for the host and the user.
- Password, keyboard-interactive and key logins. The key can be in the
format of OpenSSH, PEM or the .ppk of PuTTY. The engine reads the .ppk
itself (`native-ssh/src/ppk.c`).
- The keys of an agent. On the desktops, this is the socket of an
ssh-agent, or on Windows, Pageant or the agent of OpenSSH
(`native-ssh/src/agent.c`).
- On Android and iOS, the keys of the app. The app can make them, or
import them in the format of OpenSSH, PEM or the .ppk of PuTTY. iOS
keeps one key, from Files. It changes a .ppk into the OpenSSH format
with its passphrase, and shows its public key to copy.
- On Android, port forwards (-L, -R, -D: SOCKS 4/4a/5) and agent
forwarding (-A). If the entry says so, the app asks the user to approve
each signature.
Its tests run against a real sshd: `native-ssh/test`. The JVM tests of the
app also run on a host build of the JNI library
(`./gradlew :app:buildHostSsh`, which the unit tests run).
- **Log**: the log of the modem and of SIP (Copy copies all of it).
- **AT commands** (Settings, AT commands, and the menu of the terminal): the
AT command reference. This is the manual of D-Modem
(`docs/at_commands.pdf`, the A5 edition) in the app
(`app/src/main/assets/docs`). The app shows its pages with a zoom. You can
also open it in the PDF app of the phone, for its search and the links of
its contents.
- **Back**: from all other tabs, Back goes to Home. On Home, the app goes to
the background (the modem continues to run), as the Home button does.
- **Local Linux** (Settings, Linux): the app installs and runs distributions
under proot. You are root in /root, the storage of the phone is at
/sdcard, and the modem is a serial port at `/dev/ttyDM0` (a pty of the
app, bound in). `minicom -D /dev/ttyDM0`, pppd, efax and similar programs
operate as on a real modem. The program that opens the port has the modem
as the client of a serial bridge has it (one at a time, with the TCP,
Bluetooth and USB bridges). When the program closes the port, the app
drops DTR, thus the call hangs up as at the end of a serial cable.
`ModemTtyTest`, and `LinuxSystemTest` in a real Alpine under proot (ATI
from the distro, and the answer of the modem).
A USB serial adapter that you connect to the phone is `/dev/ttyUSB0` in
the Linux. This is also a pty of the app, because Android does not let
the programs of an app access a USB device. The app opens the adapter
when a program opens the port. It closes the adapter (DTR down) when the
program closes the port. The speed, stop bits, RTS/CTS and the hang-up of
B0 follow the settings of the program (`stty`, minicom, pppd). A pty
keeps no character size or parity, thus the port uses 8 data bits and no
parity. `SerialTtyTest`.
- **Dial-in** (Settings, Dial-up internet): the phone is an ISP for each
caller of the modem, on SIP or on all other lines. The app answers a call
that rings (unless the fax settings already answer calls). When the call
connects, the app takes the DTE of the modem. A PPP server on the call
gives the caller 10.64.64.2 and DNS at 10.64.64.1. It also gives the
network of the phone, through the same NAT that the internet host of the
serial bridges uses. When the PPP of the caller ends, or if it does not
start, the app hangs up. When the call drops, PPP stops. Home shows the
caller online, with the data in each direction and a Hang up button. We
tested this over two modems of D-Modem back to back (`DialInLineTest`:
answer, CONNECT 33600, the address, DNS and a ping through the phone, the
hang-up).
The modem runs in a foreground service (`ModemService`). The service keeps
the CPU and Wi-Fi awake for the real-time audio of the call. The SIP user
agent binds to the addresses that the phone has when it starts. Thus, when
the default network changes, the service starts the modem again (after the
call, if a call continues). The DNS servers come from the active network,
because Android has no `/etc/resolv.conf` for libre to read.
+58 -49
View File
@@ -1,58 +1,67 @@
# The iOS app
The native modem builds for iOS and macOS too: the engine's C API,
`app/src/main/cpp/dmodem_engine.h` (what Swift calls in place of
Android's JNI), with D-Modem, libre and Mbed TLS as one XCFramework:
The native modem also builds for iOS and macOS. Swift calls the C API of the
engine, `app/src/main/cpp/dmodem_engine.h`, in place of the JNI of Android.
The build puts D-Modem, libre and Mbed TLS into one XCFramework:
ios/build-native.sh # macOS with Xcode, CMake, Ninja
swift test --package-path ios/DModemSmoke
The Kotlin the two apps share is `shared/` (Kotlin Multiplatform: the
JVM for Android, iOS's framework `DModemShared`; Linux native for its
tests): the terminal's emulator, the file transfers (X/Y/ZMODEM, Kermit, Intel HEX and S-records, plain text),
PPP (its client and server, the chat scripts), fax (T.4, T.30, class 1,
the PDF), voice calls and the answering machine (V.253, μ-law, WAV) and the line to another phone (PeerLine), on a small common I/O
layer (`shared/.../io`). What stays each app's own: the UI, the modem
service, sockets and Bluetooth, Android's VPN and files. Its tests run on
the JVM and natively: `./gradlew :shared:allTests`.
The two apps share the Kotlin in `shared/`. This is Kotlin Multiplatform: the
JVM for Android, the framework `DModemShared` for iOS, and Linux native for
its tests. The shared code has these items, on a small common I/O layer
(`shared/.../io`):
The iOS app (`ios/DModem`, SwiftUI, iOS 16) is the modem on a SIP
account, or on the line to another phone with the app (Android or iOS)
on the same Wi-Fi: the shared PeerLine on POSIX sockets (its PIN too),
offered and found with Bonjour (`_dmodem._tcp`, as Android's NSD). It has:
- The emulator of the terminal.
- The file transfers (X/Y/ZMODEM, Kermit, Intel HEX and S-records, plain text).
- PPP (its client and server, the chat scripts).
- Fax (T.4, T.30, class 1, the PDF).
- Voice calls and the answering machine (V.253, μ-law, WAV).
- The line to another phone (PeerLine).
- Home: the modem's state, the rates and what the CONNECT was, start,
hang up, stop, an AT command line, the log
- the terminal (the shared emulator drawn in SwiftUI, CP437 and the VGA
Each app keeps these items as its own: the UI, the modem service, sockets and
Bluetooth, and the VPN and files of Android. The tests of the shared code run
on the JVM and natively: `./gradlew :shared:allTests`.
The iOS app (`ios/DModem`, SwiftUI, iOS 16) is the modem on a SIP account.
It can also be the modem on the line to another phone with the app (Android
or iOS) on the same Wi-Fi. This line is the shared PeerLine on POSIX sockets
(with its PIN). The app offers and finds the line with Bonjour
(`_dmodem._tcp`, as the NSD of Android). The app has these screens:
- Home: the state of the modem, the rates and the CONNECT text, start,
hang up, stop, an AT command line, the log.
- The terminal (the shared emulator drawn in SwiftUI, CP437 and the VGA
colours, Esc/Ctrl/Tab/arrows) and its file transfers (ZMODEM, YMODEM,
XMODEM, Kermit, Intel HEX, S-records, plain text; a remote's `sz` or `kermit -s`
starts one by itself)
- Phone: voice calls through the modem (dialled, answered, the keypad);
the answering machine, off until turned on, its greeting and messages
([voice.md](voice.md))
- Fax: PDFs, images and text sent; a ringing call answered as a fax, by
hand or each one; the received faxes as PDFs
- Internet: dial-up to an ISP (its login script if it has one, PPP), the
phone's traffic through it as a VPN (the `DModemTunnel` packet tunnel
extension, its packets to the app's PPP on the loopback)
- Settings: the SIP account or the other phone, the modem's commands
XMODEM, Kermit, Intel HEX, S-records, plain text). A `sz` or `kermit -s` on
the remote starts a transfer automatically.
- Phone: voice calls through the modem (dial, answer, the keypad). The
answering machine, disabled until you enable it, with its greeting and
messages ([voice.md](voice.md)).
- Fax: send PDFs, images and text. Answer a call that rings as a fax,
manually or for each call. The received faxes as PDFs.
- Internet: dial-up to an ISP (with its login script if it has one, and PPP).
The traffic of the phone goes through it as a VPN. The `DModemTunnel` packet
tunnel extension sends its packets to the PPP of the app on the loopback.
- Settings: the SIP account or the other phone, the commands of the modem.
The modem's calls are the phone's own (CallKit): one ringing in rings
as a phone call does, answered or turned down there; one dialled shows
as a call, hung up from the call screen. The passwords and the PIN are
in the Keychain. Received files and faxes are in the Files app (On My
iPhone › D-Modem). The modem keeps going in the background on the audio
session (its speaker, or quiet); calls ring in while the app runs (with
no push service, a call can't wake it). Dial-up's VPN needs the Network
Extensions capability on the app's team.
The calls of the modem are phone calls of the phone (CallKit). An incoming
call rings as a phone call does. You answer it or refuse it on that screen.
A call that you dial shows as a call, and you hang it up from the call screen.
The passwords and the PIN are in the Keychain. Received files and faxes are
in the Files app (On My iPhone › D-Modem). The modem continues to operate in
the background on the audio session (its speaker, or silent). Calls ring
while the app runs. There is no push service, thus a call cannot wake the
app. The VPN of dial-up needs the Network Extensions capability on the team
of the app.
What the screens run is the shared Kotlin's jobs (`shared/.../jobs`: a
fax call, a voice call, a transfer, dial-up, each lent the modem's DTE while it lasts),
tested on the JVM and natively. The modem apart from the views is the
`ios/DModemKit` Swift package (the engine from Swift, its DTE and who
it's lent to, the settings and their secrets, the session), whose tests
run on Linux too, against the host build:
The screens run the jobs of the shared Kotlin (`shared/.../jobs`: a fax call,
a voice call, a transfer, dial-up). Each job gets the DTE of the modem while
it runs. The jobs have tests on the JVM and natively. The modem without the
views is the `ios/DModemKit` Swift package. It has the engine from Swift, its
DTE and the job that has the DTE, the settings and their secrets, and the
session. Its tests also run on Linux, against the host build:
./gradlew :shared:assembleDModemSharedReleaseXCFramework
ios/build-native.sh
@@ -60,9 +69,9 @@ run on Linux too, against the host build:
DMODEM_HOST_BUILD=$PWD/build-host swift test --package-path ios/DModemKit # Linux or macOS
D-Modem's `portable.h` has Apple's ways where Linux has its own
(close-on-exec sockets, SIGPIPE, a monotonic sleep, a peer's hang-up);
the Linux build tests them too with `-DDMODEM_PORTABLE_FALLBACKS`. CI
(`.github/workflows/apple.yml`) builds the XCFramework, runs the Swift
tests on macOS and builds the app for the simulator; the Linux job runs
DModemKit's tests on the host engine.
The `portable.h` of D-Modem has the Apple methods where Linux has its own
methods (close-on-exec sockets, SIGPIPE, a monotonic sleep, the hang-up of a
peer). The Linux build also tests them with `-DDMODEM_PORTABLE_FALLBACKS`.
CI (`.github/workflows/apple.yml`) builds the XCFramework, runs the Swift
tests on macOS and builds the app for the simulator. The Linux job runs the
tests of DModemKit on the host engine.
+22 -20
View File
@@ -1,23 +1,25 @@
# Source layout
- `external/d-modem-re`: D-Modem (git submodule): the modem core, the
data pumps, the data link layer, the SIP user agent (on libre) and
`libdmodem_sip`, the modem on a SIP line as a library.
- `app/src/main/cpp`: the native library, `libdmodem_jni.so`:
`engine.cpp` runs the modem in a thread of its own with its DTE on a
socket pair whose other end is the app's, on SIP, a peer line
(`peer_modem.cpp`) or a USB modem (`usb/`); `jni.cpp` binds it to
`org.dmodem.app.android.NativeModem`.
- `app/src/main/java/org/dmodem/app/android`: `modem/` the service, the
state the UI observes and `DteHub`, the modem's DTE shared by the
console, the terminal and the bridges; `settings/`; `ui/` (Compose).
- `app/src/main/java/org/dmodem/app/android/terminal`: the terminal:
`TerminalEmulator` (pure Kotlin, unit tested), `TerminalView` (drawing
and input), `TerminalSession` (the emulator on the modem's DTE),
`BoxDrawing`, `Themes`, the directory and snippets.
- `native-test`: the engine on the build host, against a dmodemd over
loopback SIP (dialling out, data both ways, restarting, a call coming
in, the app closing its end) and through the C API, as GoogleTest
tests (`engine_test.cpp`, `c_api_test.cpp`), and on fake USB modems
(`usb_line_test.py`).
- `external/d-modem-re`: D-Modem (git submodule). It contains the modem core,
the data pumps, the data link layer, the SIP user agent (on libre) and
`libdmodem_sip`, which is the modem on a SIP line as a library.
- `app/src/main/cpp`: the native library, `libdmodem_jni.so`.
`engine.cpp` runs the modem in its own thread. The DTE of the modem is on a
socket pair. The other end of the socket pair belongs to the app, on SIP, a
peer line (`peer_modem.cpp`) or a USB modem (`usb/`). `jni.cpp` binds the
engine to `org.dmodem.app.android.NativeModem`.
- `app/src/main/java/org/dmodem/app/android`: `modem/` has the service, the
state that the UI observes, and `DteHub`. `DteHub` is the DTE of the modem
that the console, the terminal and the bridges share. Also `settings/` and
`ui/` (Compose).
- `app/src/main/java/org/dmodem/app/android/terminal`: the terminal.
`TerminalEmulator` (pure Kotlin, with unit tests), `TerminalView` (it draws
and gets input), `TerminalSession` (the emulator on the DTE of the modem),
`BoxDrawing`, `Themes`, the directory and the snippets.
- `native-test`: tests of the engine on the build host. The tests are
GoogleTest tests (`engine_test.cpp`, `c_api_test.cpp`) and tests on fake
USB modems (`usb_line_test.py`). They run the engine against a dmodemd
over loopback SIP and through the C API. They test these items: the dial,
data in the two directions, a restart, an incoming call, and the app when
it closes its end.
+46 -39
View File
@@ -1,51 +1,58 @@
# The modem's line
An Android app that is a dial-up modem: V.92/V.90/V.91, V.34 and below, and
class 1 fax, over SIP calls. No modem hardware: the modem is
[D-Modem](https://github.com/D-Modem/D-Modem)'s open modem core
and DSP, built for Android with the NDK, and the telephone line is a SIP
account's G.711 call (Wi-Fi or mobile data).
The app is a dial-up modem for Android: V.92/V.90/V.91, V.34 and lower, and
class 1 fax, over SIP calls. It does not use modem hardware. The modem is the
open modem core and DSP of [D-Modem](https://github.com/D-Modem/D-Modem),
built for Android with the NDK. The telephone line is the G.711 call of a SIP
account (Wi-Fi or mobile data).
Over SIP the phone is on the digital side of the network: toward an
analogue modem (a BBS on a real phone line) it is the V.90/V.92 digital
modem, up to 56000 bit/s downstream; toward another digital modem
(D-Modem, an ISP's modem bank) V.91, up to 62667 bit/s both ways, or V.34.
The SIP provider must carry G.711 (PCMU/PCMA) end to end to the telephone
network.
Over SIP, the phone is on the digital side of the network. Toward an
analogue modem (a BBS on a real phone line), the phone is the V.90/V.92
digital modem, at up to 56000 bit/s downstream. Toward another digital modem
(D-Modem, or the modem bank of an ISP), it uses V.91 at up to 62667 bit/s in
the two directions, or V.34. The SIP provider must carry G.711 (PCMU/PCMA)
end to end to the telephone network.
The phone's own mobile calls can be the line too, slowly, where Android
lets the app have a call's sound: Android 13 or later, the app privileged
(CALL_AUDIO_INTERCEPTION; on a rooted phone the app installs itself as a
Magisk module), and a phone whose audio supports it. Mobile calls carry
speech through codecs that wreck modem signals; native-test's
`codec_line` measured it, two modems back to back through each codec:
The mobile calls of the phone can also be the line, at a low speed. This is
possible only if Android lets the app get the sound of a call. These
conditions are necessary:
- Android 13 or later.
- The app is privileged (CALL_AUDIO_INTERCEPTION). On a rooted phone, the app
installs itself as a Magisk module.
- The audio of the phone supports it.
Mobile calls carry speech through codecs that cause bad damage to modem
signals. We measured this with `codec_line` in native-test: two modems back
to back through each codec.
| Codec | Gets through |
|---|---|
| AMR-NB 12.2 kbit/s (a 3G/4G call, good signal) | V.21 (300 bit/s); V.22 and V.22bis connect but lose data about half the time; V.32 and up don't connect |
| AMR-NB 12.2 kbit/s (a 3G/4G call, good signal) | V.21 (300 bit/s). V.22 and V.22bis connect, but lose data about half the time. V.32 and higher do not connect |
| AMR-NB 7.95, 5.9 kbit/s (a busy network) | V.21 only |
| AMR-NB 4.75 kbit/s, GSM full rate (2G) | nothing reliable |
| AMR-NB 4.75 kbit/s, GSM full rate (2G) | Nothing reliable |
Between two D-Modems, V.cvm (D-Modem's modem for speech codecs,
`+MS=VCVM`) does better: after V.8 it spends 15 to 20 s probing the
codec, then loads a mode for it, with LAPM over it. Through AMR-NB 12.2
the app's engines connect at about 1200 bit/s coded (750 to 1200 each
way, `CONNECT 1200/CVM/LAPM/V44`; D-Modem measured 175 to 350 through
AMR 7.4). So the mobile-call line starts the modem in V.cvm, which offers
V.22 and V.21 to modems without it; V.21 (and 1200 and 2400 bit/s) are
settings for those. The dashboard says what the connection is ("V.cvm ·
LAPM · V.44").
Between two D-Modems, V.cvm (the modem of D-Modem for speech codecs,
`+MS=VCVM`) gives better results. After V.8, it probes the codec for 15 to
20 s. Then it loads a mode for that codec, with LAPM over it. Through AMR-NB
12.2, the engines of the app connect at about 1200 bit/s coded (750 to 1200
in each direction, `CONNECT 1200/CVM/LAPM/V44`). D-Modem measured 175 to 350
through AMR 7.4. Thus, on the mobile-call line, the modem starts in V.cvm.
V.cvm offers V.22 and V.21 to modems that do not have V.cvm. V.21 (and 1200
and 2400 bit/s) are settings for those modems. The dashboard shows the type
of connection ("V.cvm · LAPM · V.44").
Fax doesn't get through at all (V.cvm has no fax; V.27ter's training at 2400 bit/s comes
through AMR 12.2 with about one bit in sixteen wrong), so the app turns
fax down on that line.
Fax does not get through at all. V.cvm has no fax. The training of V.27ter at
2400 bit/s gets through AMR 12.2, but about one bit in sixteen is wrong. Thus
the app refuses fax on that line.
Or no line at all: the modem starts on its own, no SIP account or
network needed, and answers AT commands in the terminal and on the serial
bridges; a dial gets NO DIALTONE, as a modem with no phone cable. Home
offers it beside setting up SIP ("Start without a line").
You can also use no line. The modem starts by itself, without a SIP account
or a network. It answers AT commands in the terminal and on the serial
bridges. A dial gets NO DIALTONE, as a modem without a phone cable. Home
shows this option next to the SIP configuration ("Start without a line").
Two phones with the app can also be each other's line, over Wi-Fi or
Bluetooth, with no SIP account: the modems connect as over a perfect line.
An optional PIN, the same on both phones, keeps other callers out (a
challenge and response: the PIN never goes over the connection).
Two phones with the app can also be the line for each other, through Wi-Fi or
Bluetooth, without a SIP account. The modems connect as over a perfect line.
An optional PIN, the same on the two phones, prevents access by other
callers. The PIN uses a challenge and a response, thus the PIN never goes
over the connection.
+5 -5
View File
@@ -2,11 +2,11 @@
# Settings reference
Every setting the apps keep, from their code. [The app, screen by screen](features.md) shows where each is set, and [The modem's line](lines.md) what the lines are.
This page lists each setting that the apps keep, from their code. [The app, screen by screen](features.md) shows where you set each one. [The modem's line](lines.md) tells what the lines are.
## Android
`ModemSettings` ([`ModemSettings.kt`](../app/src/main/java/org/dmodem/app/android/settings/ModemSettings.kt)), kept in the app's private DataStore `modem` under the key beside each.
`ModemSettings` ([`ModemSettings.kt`](../app/src/main/java/org/dmodem/app/android/settings/ModemSettings.kt)). The app keeps each setting in its private DataStore `modem`, under the key in the table.
| setting | key | kind | default | what it is |
|---|---|---|---|---|
@@ -40,11 +40,11 @@ Every setting the apps keep, from their code. [The app, screen by screen](featur
| `usbTxGain` | `usb_tx_gain` | number | `0` | A USB modem's line: the modem's sound to it louder or softer, dB (-20 to 20; D-Modem's DMODEM_USB_TX_GAIN). |
| `usbTxAuto` | `usb_tx_auto` | on/off | `true` | A USB modem's line: its transmit level set for each call from the remote's answer tone (DMODEM_USB_TX_GAIN=auto), not [usbTxGain]. |
`line` is one of: `bluetooth`, `bt_modem`, `cell`, `none`, `serial_modem`, `sip`, `usb`, `wifi`.
`line` is one of these values: `bluetooth`, `bt_modem`, `cell`, `none`, `serial_modem`, `sip`, `usb`, `wifi`.
## iOS
`ModemSettings` ([`ModemSettings.swift`](../ios/DModemKit/Sources/DModemKit/ModemSettings.swift)), kept as JSON under each setting's own name; the secrets go in the Keychain instead, under the name beside them.
`ModemSettings` ([`ModemSettings.swift`](../ios/DModemKit/Sources/DModemKit/ModemSettings.swift)). The app keeps each setting as JSON, under the name of the setting. But the app keeps the secrets in the Keychain, under the name in the table.
| setting | Keychain | kind | default | what it is |
|---|---|---|---|---|
@@ -78,4 +78,4 @@ Every setting the apps keep, from their code. [The app, screen by screen](featur
| `ispScript` | | text | (empty) | As above. |
| `ispInit` | | text | (empty) | As above. |
`line` is one of: `sip`, `wifi`, `none`.
`line` is one of these values: `sip`, `wifi`, `none`.
+76 -67
View File
@@ -1,17 +1,21 @@
# Terminal types
The terminal (Android and iOS) can be any of the terminals below. Pick one
in Settings, or give a directory entry its own. The choice sets what the
screen understands, how it answers the remote's identity requests, what
SSH sends as `TERM` and Telnet as TERMINAL-TYPE, the screen's size, its
character set and glyphs, and the key bar.
The terminal (Android and iOS) can be each of the terminals below. Select one
in Settings, or give a directory entry its own type. The type sets these
items:
All of them live in `shared/src/commonMain/kotlin/org/dmodem/app/terminal/`:
a `TerminalProfile` subclass for each type (`TerminalProfile.kt`,
`Commodore.kt`, `Atari.kt`, `Videotex.kt`, `Minitel.kt`, `Tektronix.kt`)
and the interpreter it makes (`VtInterpreter`, `Vt420Interpreter`,
- The codes that the screen accepts.
- The answers to the identity requests of the remote.
- The `TERM` that SSH sends and the TERMINAL-TYPE that Telnet sends.
- The size of the screen, its character set and its glyphs.
- The key bar.
All the types are in `shared/src/commonMain/kotlin/org/dmodem/app/terminal/`.
There is a `TerminalProfile` subclass for each type (`TerminalProfile.kt`,
`Commodore.kt`, `Atari.kt`, `Videotex.kt`, `Minitel.kt`, `Tektronix.kt`).
Each subclass makes an interpreter (`VtInterpreter`, `Vt420Interpreter`,
`AnsiBbsInterpreter`, `ByteControlInterpreter` and its subclasses,
`TektronixInterpreter`). ReGIS is `Regis.kt`, sixel `Sixel.kt`, and both
`TektronixInterpreter`). ReGIS is `Regis.kt` and sixel is `Sixel.kt`. The two
graphics terminals draw through `Raster.kt`.
| Type | Id | TERM / Telnet type | Screen | What it is |
@@ -39,10 +43,10 @@ graphics terminals draw through `Raster.kt`.
## Fonts
Each retro type draws with its machine's own character ROM font,
SyncTERM's copies of them (`RomFonts.kt`, written by
`tools/gen_rom_fonts.py`), read in the machine's own character set
(`MachineFonts.kt`):
Each retro type draws with the character ROM font of its machine. The fonts
are the copies of SyncTERM (`RomFonts.kt`, written by
`tools/gen_rom_fonts.py`). The app reads them in the character set of the
machine (`MachineFonts.kt`):
| Types | Font |
|---|---|
@@ -55,9 +59,10 @@ SyncTERM's copies of them (`RomFonts.kt`, written by
| Atari ST | The ST's 8x8 (its colour modes') |
| Viewdata | Prestel's teletext characters, 8x16 |
A BBS can change the ANSI-BBS types' font with SyncTERM's
`ESC [ 0 ; n SP D`. The font is drawn at the profile's height and read
as the session's octets, as SyncTERM does. These are here:
A BBS can change the font of the ANSI-BBS types with the SyncTERM sequence
`ESC [ 0 ; n SP D`. The app draws the font at the height of the profile, and
reads it as the octets of the session, as SyncTERM does. These fonts are
available:
| n | Font |
|---|---|
@@ -75,105 +80,109 @@ as the session's octets, as SyncTERM does. These are here:
| 43 | Prestel |
| 44 | Atari ST (its mono mode's 8x16) |
Its own number, RIS or another terminal type puts the profile's font
back. The other code page fonts (1-31) aren't here, and are ignored.
The number of the profile font, RIS or another terminal type sets the font of
the profile again. The other code page fonts (1-31) are not available, and
the app ignores them.
A VT510's and later screen size can change at the host's request
(DECSNLS, DECSLPP, DECSCPP). xterm and ANSI-BBS fit the view.
On a VT510 and later, the host can change the size of the screen (DECSNLS,
DECSLPP, DECSCPP). xterm and ANSI-BBS fit the view.
## Graphics
Sixel images are cells of an image that scroll with the text. ReGIS and
the Tektronix draw a picture over the whole screen instead. It is kept
the screen's size in pixels, and only the cells it has drawn in show it.
Resizing the screen starts the picture again, as on a storage tube.
Sixel images are cells of an image that scroll with the text. But ReGIS and
the Tektronix draw a picture over the full screen. The picture has the size
of the screen in pixels. Only the cells that it drew in show it. If the size
of the screen changes, the picture starts again, as on a storage tube.
- **Sixel**: xterm, ANSI-BBS and the VT340. On the VT340 the images
share ReGIS's 16 colour registers.
- **Sixel**: xterm, ANSI-BBS and the VT340. On the VT340, the images
share the 16 colour registers of ReGIS.
- **ReGIS** (`ESC P p … ESC \`, VT340 only):
- The screen is 800x480. Positions can be absolute or relative, and
use the position stack and pixel vectors.
- Commands: P, V, C (circles, arcs, closed and open curves), F, T, W,
S, R, L and macrographs (@).
- Commands are run as they become whole, so a drawing sent over many
reads shows as it comes. `ESC P 1 p` starts afresh, and `ESC P p`
carries on from where the last one left off.
- The app runs each command when it is complete. Thus a drawing that comes
in many reads shows while it comes. `ESC P 1 p` starts again from
zero, and `ESC P p` continues from the end of the last drawing.
- **Tektronix 4014**: its own terminal type, and Tek mode on xterm and
the VT340.
- `ESC [ ? 38 h` switches to the alternate screen, and `ESC ETX` goes
- `ESC [ ? 38 h` changes to the alternate screen, and `ESC ETX` goes
back to the text.
## Testing
## Tests
Each sequence has unit tests in `shared/src/commonTest`. Run them with
`./gradlew :shared:jvmTest :shared:linuxX64Test`.
`ProfileRenderTest` in `app/src/test` draws a screen on every terminal
type through the real Android view and keeps it as
`ProfileRenderTest` in `app/src/test` draws a screen on each terminal
type through the real Android view. It keeps each screen as
`app/build/profiles/<id>.png`. Run it with
`./gradlew :app:testDebugUnitTest --tests '*ProfileRenderTest*'` and look
at the pictures after a change to drawing.
`./gradlew :app:testDebugUnitTest --tests '*ProfileRenderTest*'`. After a
change to the drawing code, look at the pictures.
### vttest
To run vttest, open the app's Linux shell and install it
(`apk add vttest`, or the distro's equivalent). Set the terminal type in
Settings, then run `vttest`.
To run vttest, do these steps:
What to expect, menu by menu, from the unit tests and the code. These
haven't yet been checked against a vttest run on a device: update the
table when they are.
1. Open the Linux shell of the app.
2. Install vttest (`apk add vttest`, or the equivalent command of the distro).
3. Set the terminal type in Settings.
4. Run `vttest`.
The table gives the expected results, menu by menu, from the unit tests and
the code. We did not compare these results with a vttest run on a device
yet. When you do this, update the table.
| vttest menu | Profiles | Expect |
|---|---|---|
| 1 Cursor movements | all DEC, xterm | passes |
| 2 Screen features (132 columns, scrolling regions, origin mode) | all DEC, xterm | passes. Smooth scrolling (DECSCLM) is drawn as jump scrolling |
| 2 Screen features (132 columns, scrolling regions, origin mode) | all DEC, xterm | passes. The app draws smooth scrolling (DECSCLM) as jump scrolling |
| 3 Character sets | VT100 and later | passes. NRCS needs a VT220 or later |
| 4 Double-sized characters | VT100 and later | passes |
| 5 Keyboard | all | the LEDs and auto-repeat can't be checked on a phone. Use the key bar for the keypad and function keys |
| 5 Keyboard | all | you cannot examine the LEDs and auto-repeat on a phone. Use the key bar for the keypad and function keys |
| 6 Terminal reports | all | passes. The answerback message is empty |
| 7 VT52 mode | VT100 and later | passes |
| 8 VT102 features | VT102 and later | passes |
| 9 Known bugs | all | n/a |
| 10 Reset and self-test | all | the self-test (DECTST) does nothing |
| 11 Non-VT100 terminals | by level | VT220: passes. VT320: passes. VT420: passes except the locator (no mouse reports on a DEC type). VT520: passes except the keyboard's own settings (bell volumes and key click are accepted and ignored). xterm: its own menus |
| 11 Non-VT100 terminals | by level | VT220: passes. VT320: passes. VT420: passes except the locator (no mouse reports on a DEC type). VT520: passes except the keyboard's own settings (the app accepts and ignores bell volumes and key click). xterm: its own menus |
## What isn't done
## What is not done
**ReGIS**
- Text is drawn upright in any direction: the string moves the way it's
told, but the glyphs don't turn.
- Italics (T(I)) and the hard copy and scrolling of S are accepted and
ignored.
- R(M) (macrograph storage) isn't answered.
- A colour register changed after drawing doesn't recolour what's
already drawn.
- The app draws text upright in all directions. The string moves in the
direction that the command gives, but the glyphs do not turn.
- The app accepts and ignores italics (T(I)), and the hard copy and
scrolling of S.
- The app does not answer R(M) (macrograph storage).
- If a colour register changes after the app draws, the app does not change
the colour of the items that it drew before.
**RIPscrip**
- Icons (1I, 1W) and scenes (1R) from the host's files aren't loaded.
- Text variables ($…$) aren't expanded.
- The stroke fonts are drawn with the PC's bitmap font at their size.
- Vertical text runs down, but its glyphs don't turn.
- The app does not load icons (1I, 1W) and scenes (1R) from the files of the host.
- The app does not expand text variables ($…$).
- The app draws the stroke fonts with the bitmap font of the PC at their size.
- Vertical text goes down, but its glyphs do not turn.
**Tektronix**
- No graphic input (GIN) cross-hair.
- No write-through or defocused modes.
**Viewdata and Minitel**
- Double height and double size are drawn single.
- The Minitel draws its text in the app's font, not its own ROM's.
- The app draws double height and double size as single size.
- The Minitel draws its text in the font of the app, not in the font of its own ROM.
**Fonts**
- Fonts 1-3 of `ESC [ Ps1 ; n SP D` (the ones SyncTERM draws bright and
blinking text in) aren't kept: only font 0 changes.
- The DEC types, the Tektronix and the Minitel use the app's font: no
ROM fonts of theirs are here.
- The VIC-20, Plus/4 and PET draw with the C64's ROM, which is nearly
theirs.
- The app does not keep fonts 1-3 of `ESC [ Ps1 ; n SP D` (SyncTERM uses
them for bright and blinking text). Only font 0 changes.
- The DEC types, the Tektronix and the Minitel use the font of the app. Their
ROM fonts are not available.
- The VIC-20, Plus/4 and PET draw with the ROM of the C64, which is almost
the same as their ROM.
**DEC**
- No locator (DECELR), and no answerback message.
**iOS**
- The picture and image drawing is built but not yet compiled in Xcode
(the bridge's `imageRuns` and `imagePixels`).
- The code that draws pictures and images is written, but we did not
compile it in Xcode yet (`imageRuns` and `imagePixels` of the bridge).
+62 -52
View File
@@ -1,56 +1,65 @@
# Voice calls and the answering machine
The modem makes and takes voice calls: a number called, or the call
ringing answered, with the phone's earpiece or loudspeaker and its
microphone. When it's turned on, the answering machine takes the calls
The modem makes and receives voice calls. It can call a number or answer a
call that rings. It uses the earpiece or loudspeaker of the phone, and its
microphone. If you enable the answering machine, it answers the calls that
nobody answers and keeps the messages on the phone.
It is D-Modem's V.253 voice mode, as a fax is its class 1: the shared
Kotlin's `VoiceJob` (`shared/.../jobs/VoiceJob.kt`) is lent the modem's
DTE for the call, and sends
This is the V.253 voice mode of D-Modem, as fax uses its class 1. The
`VoiceJob` of the shared Kotlin (`shared/.../jobs/VoiceJob.kt`) gets the DTE
of the modem for the call, and sends these commands:
| Step | Command | The modem's answer |
| --- | --- | --- |
| Voice mode, G.711 μ-law at 8000 Hz | `AT+FCLASS=8`, `AT+VSM=4` | `OK` |
| A call made | `ATD<number>` | `OK` once the far end answers; `BUSY`, `NO ANSWER` |
| The ringing call answered | `AT+VLS=1` | `OK` |
| The call's sound, both ways | `AT+VTR` | `CONNECT`, then the stream |
| Hung up | `<DLE>^`, then `ATH`, `AT+FCLASS=0` | `<DLE><ETX>`, `OK` |
| Make a call | `ATD<number>` | `OK` when the far end answers. `BUSY`, `NO ANSWER` |
| Answer the call that rings | `AT+VLS=1` | `OK` |
| The sound of the call, in the two directions | `AT+VTR` | `CONNECT`, then the stream |
| Hang up | `<DLE>^`, then `ATH`, `AT+FCLASS=0` | `<DLE><ETX>`, `OK` |
The stream is μ-law octets both ways, a `<DLE>` doubled. The modem's
`<DLE>` codes say what it heard: `l` the far end hung up, `b` a busy
tone, `d` a dial tone (both: the exchange saying the caller has gone),
the DTMF digits pressed. Our samples go at the line's pace, by the clock,
60 ms ahead; silence when the microphone has none. The keypad's digits
are DTMF tones in our sound.
The stream is μ-law octets in the two directions, with each `<DLE>` doubled.
The `<DLE>` codes of the modem tell what it heard:
Any line the modem has carries it: SIP, the line to another phone, a USB
modem's phone line (when that modem has voice mode). A modem without it
answers `ERROR` to `AT+FCLASS=8`, and the call stops with "the modem has
no voice mode".
- `l`: the far end hung up.
- `b`: a busy tone.
- `d`: a dial tone.
- The DTMF digits that the far end pushed.
A busy tone and a dial tone both mean that the exchange says that the caller
is gone. The app sends its samples at the rate of the line, by the clock,
60 ms ahead. If the microphone gives no sound, the app sends silence. The
digits of the keypad are DTMF tones in the sound of the app.
Each line of the modem can carry voice: SIP, the line to another phone, and
the phone line of a USB modem (if that modem has voice mode). A modem without
voice mode answers `ERROR` to `AT+FCLASS=8`, and the call stops with "the
modem has no voice mode".
## The answering machine
Off until it's turned on (Android: Settings › Phone and answering
machine; iOS: the Phone tab). When it's on, after the rings set (4 by
default) it answers the call, plays the greeting (or none) and a beep,
and records the caller until
The answering machine is disabled until you enable it (Android: Settings ›
Phone and answering machine. iOS: the Phone tab). When it is enabled, it
answers the call after the set number of rings (4 by default). It plays the
greeting (or no greeting) and a beep. Then it records the caller until one
of these conditions occurs:
- they hang up (a busy or dial tone's start is cut from the message),
- they have been quiet for 7 s (half a second of the quiet is kept), or
- the longest message (2 minutes by default) has gone.
- The caller hangs up. The app cuts the start of the busy tone or dial tone from the message.
- The caller is silent for 7 s. The app keeps half a second of the silence.
- The maximum message length (2 minutes by default) is reached.
A message under a second isn't kept. Each one is a WAV file (16-bit PCM,
8000 Hz, mono) named for its time and the caller's number when caller ID
gave it, `20261111-093000_5551234.wav`: on Android in the app's own
storage (`files/voicemail`), on iOS in Documents/Voicemail (the Files
app shows it). Nothing leaves the phone.
The app does not keep a message that is shorter than one second. Each
message is a WAV file (16-bit PCM, 8000 Hz, mono). Its name is its time and,
if caller ID gave it, the number of the caller:
`20261111-093000_5551234.wav`. On Android, the files are in the storage of
the app (`files/voicemail`). On iOS, they are in Documents/Voicemail (the
Files app shows them). No data goes out of the phone.
While a message is being left, **Listen** plays it on the loudspeaker
and **Pick up** turns it into a call (the message isn't kept). The
greeting is recorded with the microphone (a minute at most) or chosen
from a sound file, at any rate: mixed to one channel and resampled to
8000 Hz. The app reads these itself, the same on both phones:
While a caller leaves a message, **Listen** plays it on the loudspeaker.
**Pick up** changes it into a call (the app does not keep the message). You
can record the greeting with the microphone (one minute maximum). You can
also select a sound file with any sample rate. The app mixes the file to one
channel and resamples it to 8000 Hz. The app reads these files itself, the
same on the two phones:
| File | Kinds |
| --- | --- |
@@ -58,24 +67,25 @@ from a sound file, at any rate: mixed to one channel and resampled to
| AIFF, AIFF-C | PCM, floats, A-law, μ-law |
| Sun/NeXT `.au` | PCM, floats, A-law, μ-law |
The rest goes to the phone's own decoders: on Android MediaCodec (MP3,
AAC/M4A, FLAC, Ogg Vorbis, Opus, AMR, and whatever else the phone has),
on iOS AVAudioFile (MP3, AAC/M4A, FLAC, ALAC, CAF).
The decoders of the phone read all other files. On Android, MediaCodec does
this (MP3, AAC/M4A, FLAC, Ogg Vorbis, Opus, AMR, and all other formats that
the phone has). On iOS, AVAudioFile does this (MP3, AAC/M4A, FLAC, ALAC, CAF).
Calls answered as faxes by the fax settings, or by dial-in, are answered
on the first ring: with either on, the answering machine waits.
The fax settings and dial-in answer their calls on the first ring. If one of
them is enabled, the answering machine waits.
## Where it is
- Android: Home's **Phone** (call a number, the call as it goes, the
messages), the incoming call's popup (**Answer as a voice call**,
**Take a message**), Settings › **Phone and answering machine**.
`voice/Voice.kt` runs the call, `voice/VoiceAudio.kt` its sound (an
AudioTrack for the speaker; an AudioRecord with the phone's echo
cancelling, `VOICE_COMMUNICATION`, for the microphone).
- iOS: the **Phone** tab. `JobsModel` runs the call, `VoiceSound.swift`
- Android: the **Phone** item on Home (call a number, the call while it
continues, the messages), the popup for an incoming call (**Answer as a
voice call**, **Take a message**), and Settings › **Phone and answering
machine**. `voice/Voice.kt` runs the call. `voice/VoiceAudio.kt` runs its
sound: an AudioTrack for the speaker, and an AudioRecord with the echo
canceller of the phone (`VOICE_COMMUNICATION`) for the microphone.
- iOS: the **Phone** tab. `JobsModel` runs the call. `VoiceSound.swift` runs
its sound (AVAudioEngine in the voice chat mode).
The tests (`shared/src/commonTest/.../voice/VoiceTest.kt`) run a call,
a busy number, a modem without voice mode, messages that end by a
hang-up and by quiet, and one picked up, against a fake V.253 modem.
The tests (`shared/src/commonTest/.../voice/VoiceTest.kt`) run against a
fake V.253 modem. They test a call, a busy number, a modem without voice
mode, messages that end with a hang-up and with silence, and a message that
the user picks up.
+17 -15
View File
@@ -2,24 +2,26 @@
`build.sh` builds [Termux's proot](https://github.com/termux/proot)
(`external/proot`, a submodule pinned to a commit) and its loader, with
[talloc](https://talloc.samba.org/) 2.4.2 (downloaded from samba.org and
checked against its SHA-256), for each Android ABI with the NDK, or for the
host (the unit tests). Gradle runs it (`:app:buildProot`) before each build.
[talloc](https://talloc.samba.org/) 2.4.2. The script downloads talloc from
samba.org and checks it against its SHA-256. It builds for each Android ABI
with the NDK, or for the host (for the unit tests). Gradle runs the script
(`:app:buildProot`) before each build.
The outputs are programs named `libproot.so` and `libproot-loader.so`, so
that Android installs them in the app's native library directory: from
Android 10 on, an app can run its own programs only from there (not from
its data directory). proot runs the Linux system's programs through the
loader, which maps them into memory rather than executing them.
The outputs are programs with the names `libproot.so` and `libproot-loader.so`.
With these names, Android installs them in the native library directory of
the app. From Android 10, an app can run its own programs only from that
directory (not from its data directory). proot runs the programs of the Linux
system through the loader. The loader maps them into memory and does not
execute them.
Needs: a C compiler (the NDK's for Android), make, GNU awk (`gawk`) and curl.
Necessary tools: a C compiler (the compiler of the NDK for Android), make, GNU awk (`gawk`) and curl.
`talloc-shim/replace.h` stands in for the part of Samba's `lib/replace` that
`talloc.c` uses, so that talloc builds as one file without Samba's waf.
`talloc-shim/replace.h` replaces the part of the Samba `lib/replace` that
`talloc.c` uses. Thus talloc builds as one file without the waf of Samba.
The build copies proot's source tree and adds `#include <string.h>` to
`extension/ashmem_memfd/ashmem_memfd.c`, which needs it and doesn't include
it (an error with clang). The submodule itself is left as it is.
The build copies the source tree of proot and adds `#include <string.h>` to
`extension/ashmem_memfd/ashmem_memfd.c`. That file needs the include but does
not have it (clang gives an error). The build does not change the submodule.
Licences: proot is GPL-2.0-or-later, talloc LGPL-3.0-or-later; their
Licences: proot is GPL-2.0-or-later, talloc LGPL-3.0-or-later. Their
sources are the submodule and the pinned tarball named above.
+10 -10
View File
@@ -149,12 +149,12 @@ def page(problems):
b = ["<!-- Made by tools/settings_ref.py from the apps' ModemSettings: "
"change the code (or the script), not this page. -->\n\n",
"# Settings reference\n\n",
"Every setting the apps keep, from their code. "
"[The app, screen by screen](features.md) shows where each is set, "
"and [The modem's line](lines.md) what the lines are.\n\n",
"This page lists each setting that the apps keep, from their code. "
"[The app, screen by screen](features.md) shows where you set each one. "
"[The modem's line](lines.md) tells what the lines are.\n\n",
"## Android\n\n",
"`ModemSettings` ([`ModemSettings.kt`](../%s)), kept in the app's "
"private DataStore `%s` under the key beside each.\n\n" % (KOTLIN, store),
"`ModemSettings` ([`ModemSettings.kt`](../%s)). The app keeps each "
"setting in its private DataStore `%s`, under the key in the table.\n\n" % (KOTLIN, store),
"| setting | key | kind | default | what it is |\n|---|---|---|---|---|\n"]
for name, typ, default, doc, first in fs:
key = keys.get(name)
@@ -163,18 +163,18 @@ def page(problems):
b.append("| `%s` | %s | %s | %s | %s |\n" % (
name, "`%s`" % key if key else "", kind(typ, default), cell(show_default(default, consts)),
what(doc, first)))
b += ["\n`line` is one of: %s.\n\n" % ", ".join("`%s`" % v.strip('"') for _, v in alines),
b += ["\n`line` is one of these values: %s.\n\n" % ", ".join("`%s`" % v.strip('"') for _, v in alines),
"## iOS\n\n",
"`ModemSettings` ([`ModemSettings.swift`](../%s)), kept as JSON "
"under each setting's own name; the secrets go in the Keychain "
"instead, under the name beside them.\n\n" % SWIFT,
"`ModemSettings` ([`ModemSettings.swift`](../%s)). The app keeps "
"each setting as JSON, under the name of the setting. But the app "
"keeps the secrets in the Keychain, under the name in the table.\n\n" % SWIFT,
"| setting | Keychain | kind | default | what it is |\n|---|---|---|---|---|\n"]
for name, typ, default, doc, first in ifs:
default = re.sub(r"^Line\.", "", default)
b.append("| `%s` | %s | %s | %s | %s |\n" % (
name, "`%s`" % secrets[name] if name in secrets else "", kind(typ, default),
cell(show_default(default, {})), what(doc, first)))
b.append("\n`line` is one of: %s.\n" % ", ".join("`%s`" % l for l in ilines))
b.append("\n`line` is one of these values: %s.\n" % ", ".join("`%s`" % l for l in ilines))
return "".join(b)