mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
ios/DModemKit (Swift package): the engine (dmodem_engine.h) from Swift
(Engine: its config, its callbacks to a listener), its DTE (read on a
thread of its own, written), the settings (ModemSettings, as the Android
app's: the SIP account or the Wi-Fi peer line, user:password@host, kept in
UserDefaults, read leniently), ConnectInfo ("V.cvm · LAPM"), and
ModemSession (started from the settings: status, log, console, the DTE's
data, the speaker) for the views to watch. On Apple's systems the engine
is the XCFramework; on Linux the host build's libraries
(DMODEM_HOST_BUILD), so its tests run there: a session on a peer line
answering AT commands, a dial handed to the app and turned down busy.
shared: TerminalEmulator.runs(), a screen row as styled runs with their
colours resolved as TerminalView has them (the remote's palette, bold as
bright, iCE colours, inverse, faint), for a view that draws text (the iOS
app's); tested on the JVM and natively.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
25 lines
1.2 KiB
Swift
25 lines
1.2 KiB
Swift
// SPDX-License-Identifier: AGPL-3.0-only
|
|
// Copyright (C) 2026 Neo-Desktop
|
|
import Foundation
|
|
|
|
/// What a CONNECT result says beyond the rate ("CONNECT 1200/CVM/LAPM",
|
|
/// "CONNECT 56000/V92/LAPM/V44"), named as Home shows it ("V.cvm · LAPM").
|
|
/// The Android app's ConnectInfo.
|
|
public enum ConnectInfo {
|
|
static let names: [String: String] = [
|
|
"CVM": "V.cvm", "V92": "V.92", "V90": "V.90", "V91": "V.91", "V34": "V.34",
|
|
"V32B": "V.32bis", "V32": "V.32", "V22B": "V.22bis", "V22": "V.22", "V23": "V.23",
|
|
"V21": "V.21", "B103": "Bell 103", "B212": "Bell 212", "LAPM": "LAPM", "MNP": "MNP",
|
|
"V44": "V.44", "V42BIS": "V.42bis", "MNP5": "MNP 5",
|
|
]
|
|
|
|
/// the last CONNECT line in [console]: its parts after the rate, named; empty when there's none
|
|
public static func label(_ console: String) -> String {
|
|
guard let r = console.range(of: "CONNECT", options: .backwards) else { return "" }
|
|
let line = console[r.upperBound...].prefix { !$0.isNewline }
|
|
return line.trimmingCharacters(in: .whitespaces).split(separator: "/").dropFirst()
|
|
.compactMap { names[$0.trimmingCharacters(in: .whitespaces).uppercased()] }
|
|
.joined(separator: " · ")
|
|
}
|
|
}
|