mirror of
https://github.com/ratspeak/rsLXST
synced 2026-11-22 23:10:37 +00:00
docs: refresh guides and reference help
This commit is contained in:
1 parent
8f8e664427
commit
2c680d8028
23 files changed
+168
-104
No files matched your search
+6
-1
@@ -2,6 +2,11 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Source builds now use the rsReticulum `~1.4.0` dependency line. The published
|
||||
`v0.3.0` standalone source release retains `~1.3.0`.
|
||||
- Retire outgoing calls when Link-request dispatch or handshake queue admission
|
||||
fails, and keep established traffic bound to the original interface owner.
|
||||
|
||||
## 0.3.0 - 2026-10-12
|
||||
|
||||
### Added
|
||||
@@ -33,7 +38,7 @@
|
||||
buffers and an application-supplied native backend. Reject malformed lengths,
|
||||
unexpected modes and insufficient capacity before codec processing; stop
|
||||
further processing after a backend failure. Preserve native 700C frame padding.
|
||||
Codec backend selection and live Codec2 telephony remain separate work.
|
||||
Native Codec2 telephony streams use this adapter boundary.
|
||||
|
||||
### Build and compatibility
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
[](LICENSE)
|
||||
[](https://www.rust-lang.org)
|
||||
[](https://github.com/markqvist/LXST)
|
||||
[](#feature-status)
|
||||
[](#release-scope)
|
||||
|
||||
[rsLXMF](https://github.com/ratspeak/rsLXMF) |
|
||||
[Ratspeak](https://github.com/ratspeak/Ratspeak) |
|
||||
@@ -28,9 +28,11 @@ The current rsLXST is experimental and incomplete. It provides LXST wire codecs,
|
||||
Reticulum link media packet boundaries, a telephony runtime, and Opus stream
|
||||
integration for applications (such as Ratspeak).
|
||||
|
||||
The first public target is interoperable Opus
|
||||
telephony, not complete feature parity with
|
||||
the reference implementation LXST.
|
||||
This README describes the source revision used by Ratspeak 1.0.37: rsLXST
|
||||
`8f8e664427b03c4440778bd6b63b65055fd2ad14`, declaring version **0.3.0**
|
||||
and using rsReticulum **1.4.0**. The standalone `v0.3.0` release uses the
|
||||
**1.3.0** Reticulum dependency line. Keep the dependency set associated with
|
||||
the source you build; a matching rsLXST package version alone is not enough.
|
||||
|
||||
## Contents
|
||||
|
||||
@@ -46,22 +48,17 @@ the reference implementation LXST.
|
||||
|
||||
## Release Scope
|
||||
|
||||
The experimental release is to cover basic voice calls, with several features still unsupported:
|
||||
The implemented application path covers telephony signalling and negotiated
|
||||
Opus or native Codec2 media over Reticulum Links. It does not provide a
|
||||
`rnphone-rs` client, a general platform microphone/speaker backend, or complete
|
||||
parity with the Python reference's audio graph and non-telephony features.
|
||||
|
||||
- `rnphone` parity and `rnphone-rs` usage.
|
||||
- Full Codec2 support.
|
||||
- Deeper audio support: microphone/source backends, filters, AGC, etc.
|
||||
- Broadcast, stream, and non-telephony LXST primitives.
|
||||
|
||||
Those are expected future work. They should not be implied by the first public
|
||||
Opus telephony release.
|
||||
|
||||
`lxst-core::Codec2PacketCodec` provides bounded, fixed-profile Codec2 packet
|
||||
processing over an application-supplied `Codec2Backend`. It uses caller-owned
|
||||
PCM16/output buffers, validates complete packets before calling the backend,
|
||||
and requires replacement after a backend error. This is a codec integration
|
||||
boundary; device qualification and telephony stream integration
|
||||
are still required. Its mode header belongs to LXST, not LXMF audio fields.
|
||||
`lxst-core::Codec2PacketCodec` provides bounded, fixed-profile packet processing
|
||||
over a `Codec2Backend`. The workspace supplies native 700C, 1600 and 3200 modes,
|
||||
plus host stream and embedded integration. Caller-owned buffers and complete
|
||||
packet validation bound the codec work; a backend error requires replacement
|
||||
of that packet-codec instance. Board audio, timing, memory and transport still
|
||||
require qualification. Its mode header belongs to LXST, not LXMF audio fields.
|
||||
|
||||
## Build It
|
||||
|
||||
@@ -81,9 +78,15 @@ mkdir ratspeak-src
|
||||
cd ratspeak-src
|
||||
git clone https://github.com/ratspeak/rsReticulum
|
||||
git clone https://github.com/ratspeak/rsLXST
|
||||
git -C rsReticulum checkout --detach 5b38cae702a5b3984adf12a435f6d3012fcf90e1
|
||||
git -C rsLXST checkout --detach 8f8e664427b03c4440778bd6b63b65055fd2ad14
|
||||
cd rsLXST
|
||||
```
|
||||
|
||||
The commands below run from that `rsLXST` directory. These pins describe the
|
||||
coordinated source above. For the standalone release, use `v0.3.0` and its
|
||||
rsReticulum `v1.3.0` sibling instead.
|
||||
|
||||
### macOS
|
||||
|
||||
Install Rust with `rustup`, then install Apple's command-line build tools:
|
||||
@@ -95,7 +98,6 @@ xcode-select --install
|
||||
Build the workspace:
|
||||
|
||||
```bash
|
||||
cd rsLXST
|
||||
cargo build --release --locked
|
||||
```
|
||||
|
||||
@@ -125,7 +127,6 @@ sudo pacman -S --needed base-devel pkgconf
|
||||
Build the workspace:
|
||||
|
||||
```bash
|
||||
cd rsLXST
|
||||
cargo build --release --locked
|
||||
```
|
||||
|
||||
@@ -137,7 +138,6 @@ Build Tools, install the "Desktop development with C++" workload.
|
||||
Build from PowerShell:
|
||||
|
||||
```powershell
|
||||
cd rsLXST
|
||||
cargo build --release --locked
|
||||
```
|
||||
|
||||
@@ -167,21 +167,25 @@ starts Python processes and TCP interfaces. Run that suite explicitly with:
|
||||
cargo test -p lxst-telephony --test python_telephone_live_interop -- --ignored
|
||||
```
|
||||
|
||||
The Python parity and live tests expect upstream LXST at `../upstream/LXST` or
|
||||
Python/reference tests additionally need the reference source checkouts. They
|
||||
expect upstream LXST at `../upstream/LXST` or
|
||||
`LXST_UPSTREAM_DIR`, and upstream Reticulum at `../upstream/Reticulum`,
|
||||
`RETICULUM_UPSTREAM_DIR`, or sibling `../rsReticulum`.
|
||||
|
||||
For full Python Opus media interop, install a native Opus runtime as well as
|
||||
the Python reference dependencies:
|
||||
For full Python Opus media interop, install a native Opus runtime and activate
|
||||
a Python virtual environment. Then install the reference dependencies; Python
|
||||
3.13 and newer also need the `audioop` compatibility package:
|
||||
|
||||
```bash
|
||||
python -m pip install numpy cryptography pyserial cffi
|
||||
python -m pip install numpy cryptography pyserial cffi "audioop-lts; python_version >= '3.13'"
|
||||
```
|
||||
|
||||
## Crate Layout
|
||||
|
||||
| Crate | Purpose |
|
||||
| --- | --- |
|
||||
| `lxst-codec2` | Allocation-free native Codec2 700C/1600/3200 processing. |
|
||||
| `lxst-embedded` | Bounded `no_std` framing, session/PTT policy and Codec2 integration for constrained applications. |
|
||||
| `lxst-core` | LXST constants, telephony profiles, signalling values, codec IDs, MessagePack packets, Raw audio frames, Opus encode/decode state, stream packetization, synthetic sources, and jitter buffers. This crate has no Reticulum runtime dependency. |
|
||||
| `lxst-rns` | The Reticulum link-packet boundary for no-receipt LXST signalling and media over active links. It packs outbound LXST packets and decodes inbound link plaintext into typed LXST packet/frame events. |
|
||||
| `lxst-telephony` | The telephony runtime and service layer. It owns call state, caller policy, Reticulum destination registration, announce discovery, outgoing link establishment, typed control/event channels, Opus transmit/receive stream boundaries, timeout handling, and shutdown teardown. |
|
||||
@@ -193,6 +197,9 @@ manually translating Reticulum events. The service registers the local
|
||||
`lxst.telephony` destination, emits startup/periodic announces, owns the call
|
||||
runtime, and exposes typed control and event channels.
|
||||
|
||||
This fragment assumes an initialized Reticulum transport, local identity and
|
||||
remote identity inside an async application:
|
||||
|
||||
```rust
|
||||
use lxst_core::Profile;
|
||||
use lxst_telephony::{TelephonyControl, TelephonyService};
|
||||
@@ -221,8 +228,8 @@ traffic. Outgoing announce/path discovery runs asynchronously inside the
|
||||
service, so an unreachable or non-LXST peer does not block hangup, announce,
|
||||
media, or shutdown controls while discovery times out.
|
||||
|
||||
The compiled `lxst-telephony` `service` example is the conformance example for
|
||||
this embedding boundary. The lower-level endpoint and runtime types remain
|
||||
The compiled [`service` example](crates/lxst-telephony/examples/service.rs)
|
||||
checks construction and types. It does not run a transport or place a call. The lower-level endpoint and runtime types remain
|
||||
available for compatible specialist use, but are experimental SPI.
|
||||
|
||||
An initial Reticulum `LINKREQUEST` still follows normal destination routing.
|
||||
@@ -232,9 +239,9 @@ traffic never reroute through a newly learned path, and packets arriving on a
|
||||
different interface are rejected before decryption or call accounting.
|
||||
Interface loss terminates that exact call.
|
||||
|
||||
Control and teardown traffic use an ordered, bounded Link endpoint queue. The
|
||||
final close packet drains in order before transport removes the endpoint and
|
||||
temporary Link destination. Realtime media uses exact-interface best-effort
|
||||
Control and teardown traffic use an ordered, bounded Link endpoint queue. Final
|
||||
teardown waits for the ordered close-send attempt to drain or fail terminally
|
||||
before transport removes the endpoint and temporary Link destination. Realtime media uses exact-interface best-effort
|
||||
delivery instead: it never enters the lossless control queue, reports drops
|
||||
under backpressure, and intentionally does not request Reticulum delivery
|
||||
receipts.
|
||||
@@ -283,8 +290,9 @@ PRs are closed for now until I have time to catch up on everything.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under the GNU Affero General
|
||||
Public License v3.0 or later. See [LICENSE](LICENSE).
|
||||
The host crates and `lxst-embedded` use AGPL-3.0-or-later. See [LICENSE](LICENSE).
|
||||
The adapted `lxst-codec2` crate declares `LGPL-2.1-only AND MIT AND BSD-3-Clause`;
|
||||
retain its [NOTICE](crates/lxst-codec2/NOTICE) and upstream license files.
|
||||
|
||||
## Third-party licenses
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Third-party licenses
|
||||
|
||||
rsLXST is licensed under AGPL-3.0-or-later as described in [LICENSE](LICENSE).
|
||||
The host crates and `lxst-embedded` use AGPL-3.0-or-later as described in
|
||||
[LICENSE](LICENSE). The adapted `lxst-codec2` crate retains the separate terms
|
||||
described below.
|
||||
Third-party components retain their own licenses; the rsLXST license does not
|
||||
replace those terms or notices.
|
||||
|
||||
|
||||
+6
-3
@@ -10,16 +10,19 @@ for telephony is the existing `lxst_telephony::TelephonyService` service seam:
|
||||
- use `TelephonyControl`, `request_answer`, and `TelephonyServiceEvent` without
|
||||
translating raw Reticulum events in the application.
|
||||
|
||||
The compiled `lxst-telephony` `service` example exercises this path.
|
||||
The compiled `lxst-telephony` `service` example checks construction and handle
|
||||
types. It does not run the service or demonstrate an end-to-end call.
|
||||
|
||||
## Stability
|
||||
|
||||
All workspace packages are experimental:
|
||||
|
||||
- `lxst-core` contains codec, profile, stream, signalling, and wire concepts;
|
||||
- `lxst-rns` binds media packets to Reticulum Links; and
|
||||
- `lxst-rns` binds media packets to Reticulum Links;
|
||||
- `lxst-telephony` contains the service boundary plus extensive runtime and
|
||||
state-machine machinery.
|
||||
state-machine machinery;
|
||||
- `lxst-codec2` provides bounded native Codec2 processing; and
|
||||
- `lxst-embedded` provides the bounded `no_std` framing and session boundary.
|
||||
|
||||
Selecting `TelephonyService` does not stabilize the whole package or change
|
||||
channel capacities, backpressure, event ordering, cancellation, timeouts,
|
||||
|
||||
@@ -38,9 +38,15 @@ FFT coefficient tables are shared read-only data, generated using the pinned
|
||||
`libm` and the original native initialisation formulas. Per-stream state keeps
|
||||
only integer selectors; encoder/decoder histories and mutable FFT scratch remain
|
||||
independent. A bit-for-bit table test covers every supported size and direction.
|
||||
Regenerate the checked-in coefficients with:
|
||||
Generate coefficients into a temporary file and compare them with the checked-in table:
|
||||
|
||||
```sh
|
||||
cargo run -p lxst-codec2 --example generate_fft_tables --locked --offline > crates/lxst-codec2/src/native/fft_coefficients.rs
|
||||
cargo fmt -p lxst-codec2
|
||||
coefficients=$(mktemp)
|
||||
cargo run -p lxst-codec2 --example generate_fft_tables --locked --offline > "$coefficients"
|
||||
diff -u crates/lxst-codec2/src/native/fft_coefficients.rs "$coefficients"
|
||||
```
|
||||
|
||||
These comparison commands are for a POSIX shell. Inspect the generated file and
|
||||
diff before replacing checked-in coefficients; redirecting straight to the
|
||||
source would truncate it before Cargo has compiled the generator. `--offline`
|
||||
requires the pinned dependencies to be available in the Cargo cache.
|
||||
@@ -1,8 +1,8 @@
|
||||
//! Core LXST wire types.
|
||||
//!
|
||||
//! This crate owns the byte-level contract with Python LXST. It deliberately
|
||||
//! avoids audio and Reticulum runtime dependencies so packet/profile parity can
|
||||
//! be tested in isolation.
|
||||
//! This crate provides LXST packet/profile types, call transitions and audio
|
||||
//! codec helpers. It has no Reticulum runtime dependency and does not open
|
||||
//! audio devices; callers supply and consume PCM frames.
|
||||
|
||||
#[path = "shared/actions.rs"]
|
||||
mod actions;
|
||||
|
||||
@@ -11,8 +11,10 @@ pub const OPUS_ENCODED_FRAME_MAX_BYTES: usize = 1_275;
|
||||
|
||||
/// The maximum encoded Opus packet accepted by the interoperable decoder.
|
||||
///
|
||||
/// RFC 7845 bounds one Opus packet at 61,440 encoded bytes. This is distinct from the 1,275-byte
|
||||
/// limit for each frame inside the packet and from the bounded decoded PCM allocation.
|
||||
/// This implementation uses the 61,440-byte processing limit recommended by
|
||||
/// [RFC 7845, section 6](https://www.rfc-editor.org/rfc/rfc7845.html#section-6).
|
||||
/// Valid padded Opus packets can be larger. This is separate from the
|
||||
/// 1,275-byte per-frame limit and the decoded PCM allocation.
|
||||
pub const OPUS_ENCODED_PACKET_MAX_BYTES: usize = 61_440;
|
||||
|
||||
#[derive(Debug, Error, PartialEq, Eq)]
|
||||
@@ -360,7 +362,9 @@ impl OpusMonoDecoder {
|
||||
1
|
||||
}
|
||||
|
||||
/// Decodes one complete Opus packet to mono PCM at 48 kHz.
|
||||
/// Decode one complete mono Opus packet to PCM at 48 kHz.
|
||||
/// Stereo packets are rejected, as are packets exceeding
|
||||
/// [`OPUS_ENCODED_PACKET_MAX_BYTES`] or the per-frame size/duration limits.
|
||||
pub fn decode_packet(&mut self, packet: &[u8]) -> Result<RawAudioFrame, OpusCodecError> {
|
||||
let inspected = inspect_opus_packet(packet)?;
|
||||
if inspected.channels != 1 {
|
||||
|
||||
@@ -122,9 +122,9 @@ impl<B: Codec2Backend> Codec2PacketCodec<B> {
|
||||
|
||||
/// Encode exactly one profile packet. PCM is mono 8 kHz, signed 16-bit.
|
||||
///
|
||||
/// Capacity/shape errors leave backend and output unchanged. A backend error
|
||||
/// invalidates this stream and the partially written output; replace it before
|
||||
/// reuse. Bytes beyond the returned length remain untouched.
|
||||
/// Capacity/shape errors leave output unchanged and do not call the native
|
||||
/// encoder. A backend error invalidates this stream and its partial output;
|
||||
/// replace it before reuse. Bytes beyond the returned length stay untouched.
|
||||
pub fn encode_into(
|
||||
&mut self,
|
||||
pcm: &[i16],
|
||||
@@ -159,8 +159,9 @@ impl<B: Codec2Backend> Codec2PacketCodec<B> {
|
||||
|
||||
/// Decode exactly one negotiated-profile payload, including its mode header.
|
||||
///
|
||||
/// A peer cannot trigger mode changes, unbounded frame counts or allocations
|
||||
/// through this wrapper. The backend is never called on malformed payloads.
|
||||
/// The wrapper fixes the mode and frame count and allocates no memory.
|
||||
/// It checks mode header, payload length and output capacity before calling
|
||||
/// the native decoder; codec-content validation belongs to the backend.
|
||||
/// On backend failure discard the partial PCM and replace this stream.
|
||||
pub fn decode_into(
|
||||
&mut self,
|
||||
|
||||
@@ -97,9 +97,9 @@ impl CallState {
|
||||
actions
|
||||
}
|
||||
|
||||
/// Re-send the wire-compatible answer offer without reopening pipelines
|
||||
/// or changing local state. The service bounds these retries and stops as
|
||||
/// soon as the outgoing peer's ESTABLISHED echo is observed.
|
||||
/// Return the answer offer again without reopening pipelines or changing state.
|
||||
/// The caller controls retry timing and count. No actions are returned once
|
||||
/// the incoming call leaves CONNECTING, including after an ESTABLISHED echo.
|
||||
pub fn retry_answer(&self) -> Actions {
|
||||
if self.role != CallRole::Incoming
|
||||
|| !self.answered
|
||||
|
||||
@@ -142,6 +142,10 @@ impl LxstPacket {
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Decode the first MessagePack value as an LXST packet. Trailing bytes are
|
||||
/// ignored, and repeated signalling/frame fields are concatenated.
|
||||
/// This allocating parser has no packet-size limit; bound input before use.
|
||||
/// Codec headers are checked, but encoded audio content is not decoded here.
|
||||
pub fn decode(bytes: &[u8]) -> Result<Self, Error> {
|
||||
let value = read_value(&mut &bytes[..]).map_err(|e| Error::Decode(e.to_string()))?;
|
||||
Self::from_value(value)
|
||||
|
||||
@@ -11,8 +11,9 @@ the same fixed action list. Preserve this shared source layout in source bundles
|
||||
these unpublished workspace crates are built from the complete repository.
|
||||
|
||||
`wire::Packet` borrows validated input with fixed ceilings (512 packet bytes,
|
||||
eight signals, four frames, 256 bytes per codec frame). It rejects duplicates,
|
||||
trailing data, excessive nesting and oversized declared containers. Unknown
|
||||
eight signals, four frames, 256 bytes per encoded frame including its codec
|
||||
identifier). It rejects duplicate signal/media fields, trailing data, excessive
|
||||
nesting and oversized declared containers. Unknown
|
||||
metadata is skipped within those limits. `wire::encode` matches the full Rust
|
||||
encoder's canonical MessagePack forms and validates before writing output.
|
||||
The negotiated Reticulum Link MDU can be smaller than the parser ceiling; the
|
||||
|
||||
@@ -283,10 +283,10 @@ impl Session {
|
||||
events.transitions(self.call.receive_signal(signal));
|
||||
events
|
||||
}
|
||||
/// Matching authenticated media confirms adoption of a suggested profile.
|
||||
/// Some standard peers change codec without echoing PreferredProfile. The
|
||||
/// embedder must validate codec, mode and complete native packet size first.
|
||||
/// This does not open audio, answer a call, or start the microphone.
|
||||
/// Confirm adoption of the current suggested profile using authenticated media.
|
||||
/// The embedder must first validate codec, mode and complete native packet size.
|
||||
/// This clears a pending profile deadline only; it does not change the
|
||||
/// selected profile, open audio, answer a call or start the microphone.
|
||||
pub fn receive_profile_media(&mut self, profile: Profile, now_ms: u64) -> Events {
|
||||
if self.ended.is_none()
|
||||
&& self.linked
|
||||
|
||||
@@ -43,6 +43,10 @@ impl<'a> Packet<'a> {
|
||||
&self.frames[..self.frame_count]
|
||||
}
|
||||
|
||||
/// Borrow one complete packet within the fixed size and item-count limits.
|
||||
/// Trailing bytes and duplicate signalling/frame fields are rejected.
|
||||
/// Unknown fields are skipped within bounded depth; their duplicates are
|
||||
/// not tracked. Codec payload contents require validation by the embedder.
|
||||
pub fn decode(bytes: &'a [u8]) -> Result<Self, Error> {
|
||||
if bytes.len() > MAX_PACKET_BYTES {
|
||||
return Err(Error::Limit);
|
||||
|
||||
+15
-10
@@ -1,8 +1,8 @@
|
||||
//! Reticulum transport boundary for LXST.
|
||||
//!
|
||||
//! This crate is intentionally small: it turns already-encoded LXST packets into
|
||||
//! Reticulum link data packets and leaves call state, audio, and codec work to
|
||||
//! higher layers.
|
||||
//! Packet helpers encrypt LXST payloads for Reticulum Links; ingress/egress
|
||||
//! adapters track frames, provide a jitter queue and convert raw or Opus audio.
|
||||
//! Call policy and audio-device ownership stay with the embedding runtime.
|
||||
|
||||
use bytes::Bytes;
|
||||
use lxst_core::{
|
||||
@@ -67,6 +67,8 @@ impl LxstLinkIngress {
|
||||
}
|
||||
|
||||
/// Decode decrypted plaintext from `LinkManager::set_link_packet_channel`.
|
||||
/// The caller supplies the authenticated Link association; parsing does not
|
||||
/// verify `link_id`. Input parsing follows [`LxstPacket::decode`].
|
||||
pub fn accept_plaintext(
|
||||
&mut self,
|
||||
link_id: [u8; 16],
|
||||
@@ -267,16 +269,18 @@ pub fn prepare_lxst_link_packet_send(
|
||||
Ok(prepare_packed_link_endpoint_send(packet, role))
|
||||
}
|
||||
|
||||
/// One packet plus the typed transport operation that owns its delivery
|
||||
/// outcome. Callers must retain and inspect `result_rx`; deliberately
|
||||
/// discarding the result would turn terminal endpoint failures into silent
|
||||
/// media or signalling loss.
|
||||
/// One packet, a transport command and its local admission result.
|
||||
///
|
||||
/// Enqueue `message` and inspect `result_rx`. `Sent` and `Queued` do not
|
||||
/// acknowledge peer receipt; later failures need endpoint-lifecycle handling.
|
||||
pub struct PreparedLinkEndpointSend {
|
||||
pub packet: PackedLinkPacket,
|
||||
pub message: TransportMessage,
|
||||
pub result_rx: oneshot::Receiver<LinkEndpointSendResult>,
|
||||
}
|
||||
|
||||
/// Prepare an ordered send for an already packed Link packet.
|
||||
/// This only constructs the command; it does not enqueue or transmit it.
|
||||
pub fn prepare_packed_link_endpoint_send(
|
||||
packet: PackedLinkPacket,
|
||||
role: LinkEndpointRole,
|
||||
@@ -298,9 +302,10 @@ pub fn prepare_packed_link_endpoint_send(
|
||||
}
|
||||
}
|
||||
|
||||
/// Prepare the final ordered packet for an established Link. Transport keeps
|
||||
/// the endpoint alive until this packet and all earlier control packets have
|
||||
/// drained, then atomically unbinds it.
|
||||
/// Prepare an ordered send followed by endpoint unbinding.
|
||||
/// Once admitted, the transport drains earlier control packets and this packet
|
||||
/// before unbinding; a terminal send/interface error may end the Link earlier.
|
||||
/// The caller must enqueue the command and inspect its local result.
|
||||
pub fn prepare_packed_link_endpoint_final_send(
|
||||
packet: PackedLinkPacket,
|
||||
role: LinkEndpointRole,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
use std::sync::Mutex;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// A release-aware local PTT lease. A stalled UI stops media within 750 ms;
|
||||
/// a ten-second burst requires a new release/press. It adds no LXST wire fields.
|
||||
/// A local PTT lease that expires after 750 ms without renewal or a ten-second
|
||||
/// burst. The caller must check [`Self::allows`] before forwarding each frame;
|
||||
/// this gate does not stop an audio device itself. Once expiry is observed,
|
||||
/// a release is required before another press. It adds no LXST wire fields.
|
||||
#[derive(Default, Debug)]
|
||||
pub struct AudioTransmitGate {
|
||||
state: Mutex<State>,
|
||||
@@ -74,6 +76,8 @@ impl AudioTransmitGate {
|
||||
state.blocked = true;
|
||||
}
|
||||
}
|
||||
/// Check the current lease; contention, expiry or closure returns `false`.
|
||||
/// This may mark an expired press blocked until a release arrives.
|
||||
pub fn allows(&self) -> bool {
|
||||
self.allows_at(Instant::now())
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
//! Telephony runtime core for LXST.
|
||||
//!
|
||||
//! This crate owns the deterministic call-control boundary between Reticulum
|
||||
//! link events and the pure LXST signalling planner. It deliberately avoids
|
||||
//! spawning tasks or touching audio devices so live runtime code can be a thin
|
||||
//! adapter around tested protocol behavior.
|
||||
//! This crate combines a call-control state machine with a Tokio service,
|
||||
//! Reticulum endpoint management and media codecs. The service spawns discovery
|
||||
//! work; the embedding application owns audio devices and handles service events.
|
||||
|
||||
use std::collections::{HashMap, HashSet, VecDeque};
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
@@ -758,7 +757,7 @@ pub enum TelephonyControl {
|
||||
bit_depth: RawBitDepth,
|
||||
frames: Vec<RawAudioFrame>,
|
||||
},
|
||||
/// Encode negotiated Opus or native Codec2 1600/3200 PCM.
|
||||
/// Encode PCM for the negotiated Opus or native Codec2 700C/1600/3200 profile.
|
||||
SendAudioFrames {
|
||||
profile: Profile,
|
||||
frames: Vec<RawAudioFrame>,
|
||||
@@ -797,7 +796,9 @@ pub enum TelephonyControl {
|
||||
|
||||
/// Submit an exact-link answer request and wait until the telephony service
|
||||
/// has validated the active incoming call, atomically admitted its signalling
|
||||
/// packets, and published the authoritative CONNECTING snapshot.
|
||||
/// packets, and queued the authoritative CONNECTING snapshot for the event consumer.
|
||||
/// This does not confirm peer receipt or an established call. There is no built-in
|
||||
/// wait deadline; cancelling this future does not retract an already queued request.
|
||||
pub async fn request_answer(
|
||||
control_tx: &mpsc::Sender<TelephonyControl>,
|
||||
expected_link_id: LinkId,
|
||||
@@ -3446,8 +3447,9 @@ impl TelephonyRnsEndpoint {
|
||||
}
|
||||
}
|
||||
|
||||
/// Number of media packets the exact-interface best-effort boundary
|
||||
/// dropped for this Link since it became active.
|
||||
/// Count media backpressure drops observed at local transport-queue admission or reported
|
||||
/// by the exact-interface best-effort path. Results still awaiting polling
|
||||
/// are not counted; unknown or removed Link counters return zero.
|
||||
pub fn media_drop_count(&self, link_id: LinkId) -> u64 {
|
||||
self.media_drops.get(&link_id).copied().unwrap_or(0)
|
||||
}
|
||||
|
||||
@@ -275,10 +275,15 @@ def render_snapshot(
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--metadata-only", action="store_true")
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Compare current public APIs with the stored snapshots, or refresh them after review."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--metadata-only", action="store_true",
|
||||
help="validate metadata, package inventory and stored snapshot hashes without generating API output; incompatible with --update",
|
||||
)
|
||||
parser.add_argument("--update", action="store_true",
|
||||
help="refresh snapshots from the working tree to commit alongside source changes")
|
||||
help="regenerate snapshots and update their counts/hashes in api/stability.json; review the diff before committing")
|
||||
parser.add_argument("--snapshot-source-commit",
|
||||
help="optional HEAD guard for --update; includes uncommitted source changes")
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -122,17 +122,19 @@ def render_contract() -> str:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Compare current library Cargo metadata with api/snapshots/manifest-contract.json."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--print",
|
||||
action="store_true",
|
||||
dest="print_contract",
|
||||
help="print the current canonical contract for reviewed application",
|
||||
help="print current Cargo contract JSON instead of comparing it with the saved snapshot",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--update",
|
||||
action="store_true",
|
||||
help="write the current reviewed manifest contract",
|
||||
help="replace the saved manifest contract with current Cargo metadata; review the diff before committing",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
if args.print_contract and args.update:
|
||||
|
||||
@@ -164,7 +164,11 @@ expected = json.dumps(build_inventory(), indent=2, sort_keys=False) + "\n"
|
||||
if len(sys.argv) == 2 and sys.argv[1] == "--write":
|
||||
INVENTORY.write_text(expected, encoding="utf-8")
|
||||
elif len(sys.argv) != 1:
|
||||
fail("usage: check-third-party-licenses.py [--write]")
|
||||
fail(
|
||||
"usage: check-third-party-licenses.py [--write]\n"
|
||||
"Without --write, compare the locked dependency inventory with THIRD_PARTY_LICENSES.json.\n"
|
||||
"With --write, replace that file after checking dependency provenance; review the diff before committing."
|
||||
)
|
||||
elif not INVENTORY.is_file():
|
||||
fail("THIRD_PARTY_LICENSES.json is missing; run with --write")
|
||||
elif INVENTORY.read_text(encoding="utf-8") != expected:
|
||||
|
||||
@@ -62,8 +62,9 @@ def generate_fixtures():
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--decode-hex", default="")
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--decode-hex", default="",
|
||||
help="decode a hex-encoded Raw codec payload to JSON; omit or pass an empty string to generate fixture cases")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.decode_hex:
|
||||
|
||||
@@ -90,8 +90,9 @@ def generate_fixtures():
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--decode-hex", default="")
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--decode-hex", default="",
|
||||
help="decode a hex-encoded LXST wire packet to JSON; omit or pass an empty string to generate fixture cases")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.decode_hex:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate immutable Rust 700C codebooks from the pinned Codec2 source tree."""
|
||||
"""Generate Rust 700C codebooks from Codec2 inputs with pinned source hashes."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
@@ -11,8 +11,8 @@ BACKEND = ROOT / "crates/lxst-codec2"
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("source", type=Path)
|
||||
parser.add_argument("--check", action="store_true")
|
||||
parser.add_argument("source", type=Path, help="Codec2 source-tree root containing the codebook files listed in UPSTREAM.json")
|
||||
parser.add_argument("--check", action="store_true", help="compare with the generated Rust file without rewriting it")
|
||||
args = parser.parse_args()
|
||||
provenance = json.loads((BACKEND / "UPSTREAM.json").read_text())["codec2_700c"]
|
||||
lines = [
|
||||
|
||||
@@ -577,15 +577,17 @@ def run_command_loop(args):
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--mode", choices=["self-test", "host"], required=True)
|
||||
parser.add_argument("--storage-dir", required=True)
|
||||
parser.add_argument("--tcp-role", choices=["server", "client"], default="client")
|
||||
parser.add_argument("--tcp-host", default="127.0.0.1")
|
||||
parser.add_argument("--tcp-port", type=int, default=0)
|
||||
parser.add_argument("--ring-time", type=float, default=20.0)
|
||||
parser.add_argument("--wait-time", type=float, default=20.0)
|
||||
parser.add_argument("--enable-transport", action="store_true")
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Headless LXST interop harness: starts Reticulum and exchanges JSON events/commands without physical audio."
|
||||
)
|
||||
parser.add_argument("--mode", choices=["self-test", "host"], required=True, help="self-test starts the stack, emits a snapshot and stops; host reads JSON commands from stdin")
|
||||
parser.add_argument("--storage-dir", required=True, help="scratch directory: existing contents are deleted and the directory is recreated on startup in both modes")
|
||||
parser.add_argument("--tcp-role", choices=["server", "client"], default="client", help="TCP interface role when --tcp-port is positive (default: client)")
|
||||
parser.add_argument("--tcp-host", default="127.0.0.1", help="client destination or server listen address (default: 127.0.0.1)")
|
||||
parser.add_argument("--tcp-port", type=int, default=0, help="TCP port; zero or negative omits the TCP interface (default: 0)")
|
||||
parser.add_argument("--ring-time", type=float, default=20.0, help="incoming-call ring timeout in seconds (default: 20)")
|
||||
parser.add_argument("--wait-time", type=float, default=20.0, help="outgoing-call/path-recall timeout in seconds (default: 20)")
|
||||
parser.add_argument("--enable-transport", action="store_true", help="enable transport mode in the generated Reticulum config (default: off)")
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user