diff --git a/README.md b/README.md index ad39462..de1c466 100644 --- a/README.md +++ b/README.md @@ -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 @@ -44,7 +45,7 @@ the source layout. | [D-Modem](https://github.com/D-Modem/D-Modem) | The open V.92 softmodem: dmodemd, libdmodem and the Asterisk, FreeSWITCH and ARI modules | | [app](https://github.com/D-Modem/app) | The D-Modem app for Android and iOS: a dial-up modem on a SIP call | | [hardware](https://github.com/D-Modem/hardware) | pico-serial: RP2040 serial adapters and phone-line USB sticks | -| [menu](https://github.com/D-Modem/menu) | modemmenu: the login and menu dial-up callers reach | +| [menu](https://github.com/D-Modem/menu) | modemmenu: the login and the menu that dial-up callers get to | | [bbs](https://github.com/D-Modem/bbs) | A bulletin board for telnet, SSH, TN3270 and modem callers | | [go3270](https://github.com/D-Modem/go3270) | A Go library for 3270 terminal servers, used by bbs | | [brand](https://github.com/D-Modem/brand) | Logos, colours, type and the naming guide | diff --git a/app/src/main/assets/docs/README.md b/app/src/main/assets/docs/README.md index d4cdc3c..0a49b29 100644 --- a/app/src/main/assets/docs/README.md +++ b/app/src/main/assets/docs/README.md @@ -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 da07c8d. `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`). diff --git a/docs/README.md b/docs/README.md index 16ed23c..7123f82 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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 diff --git a/docs/fax.md b/docs/fax.md index 9046614..2d0493a 100644 --- a/docs/fax.md +++ b/docs/fax.md @@ -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`). diff --git a/docs/layout.md b/docs/layout.md index 9386410..62bd70a 100644 --- a/docs/layout.md +++ b/docs/layout.md @@ -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. diff --git a/docs/lines.md b/docs/lines.md index cd97ae2..3799465 100644 --- a/docs/lines.md +++ b/docs/lines.md @@ -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. diff --git a/native-proot/README.md b/native-proot/README.md index fbd92b8..2cd10b5 100644 --- a/native-proot/README.md +++ b/native-proot/README.md @@ -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 ` 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 ` 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.