mirror of
https://github.com/D-Modem/app.git
synced 2026-11-28 17:38:05 -08:00
iOS: the line to another phone over Wi-Fi, found with Bonjour
shared (Kotlin/Native, iOS and Linux): FdDuplex (a socket: the engine's line, a TCP connection; closing it wakes a blocked read), PosixTcpTransport (calls taken on a port, polled so close() always ends it; host[:port] and [IPv6]:port called within 5 s; no SIGPIPE: Linux's send flag, Apple's socket option), and PeerHost: PeerLine on it from plain values for Swift (no default arguments or flows there), its state as text. PosixPeerTest (native): two phones over real TCP on the loopback, the modems socket pairs: a call rung, answered and heard both ways, busy, the hang-up, a wrong PIN turned away, nobody there. DModemKit: ModemSession.onLine, the peer line's modem off hook to the app (tested: a dial reaches it, its FAILED a NO CARRIER). The app: the settings' line (a SIP account or another phone on Wi-Fi: whom ATD calls, the port, the PIN, taking calls), phones found with Bonjour (_dmodem._tcp, as the Android app's NSD offers them), this one offered while it takes calls; Home's line its state and last failure. And a start fixed: the modem's log while it started ended the background audio (and now the line) before it was running. The Swift and appleMain's Kotlin aren't built here (no Xcode); the Kotlin is built and tested for Linux native. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
This commit is contained in:
12 files changed
+872
-48
No files matched your search
@@ -29,6 +29,9 @@ public final class ModemSession: EngineListener, @unchecked Sendable {
|
||||
/// the speaker's level and sound (the app's audio)
|
||||
public var onSpeaker: ((Int) -> Void)?
|
||||
public var onSound: ((UnsafeBufferPointer<Int16>) -> Void)?
|
||||
/// a peer line's modem off hook (the app's line to the other phone takes it): dialling [dial] if
|
||||
/// caller; fd its samples, the handler's to close. Without one the line is closed (the dial fails)
|
||||
public var onLine: ((_ caller: Bool, _ dial: String, _ fd: Int32) -> Void)?
|
||||
|
||||
private let engine: Engine
|
||||
|
||||
@@ -145,6 +148,10 @@ public final class ModemSession: EngineListener, @unchecked Sendable {
|
||||
changed()
|
||||
}
|
||||
|
||||
public func engineLine(caller: Bool, dial: String, fd: Int32) {
|
||||
if let h = onLine { h(caller, dial, fd) } else { close(fd) }
|
||||
}
|
||||
|
||||
public func engineSpeaker(_ level: Int) { onSpeaker?(level) }
|
||||
|
||||
public func engineSound(_ pcm: UnsafeBufferPointer<Int16>) { onSound?(pcm) }
|
||||
|
||||
Reference in new issue
Block a user