SmartBeaconing

Struct SmartBeaconing 

Source
pub struct SmartBeaconing { /* private fields */ }
Expand description

SmartBeaconing algorithm for adaptive APRS position beacon timing.

Adjusts beacon interval based on speed and course changes:

  • Stopped or slow: beacon every slow_rate seconds
  • Fast: beacon every fast_rate seconds
  • Course change: immediate beacon if heading changed > turn_threshold

Per Operating Tips §14: SmartBeaconing settings are Menu 540-547.

Implementations§

Source§

impl SmartBeaconing

Source

pub const fn new(config: SmartBeaconingConfig) -> SmartBeaconing

Create a new SmartBeaconing instance with the given configuration.

Source

pub const fn state(&self) -> &BeaconState

Return a snapshot of the current state machine.

Source

pub fn should_beacon( &mut self, speed_kmh: f64, course_deg: f64, now: Instant, ) -> bool

Check if a beacon should be sent now, given current speed and course.

now is the current wall-clock time, injected by the caller so this module remains sans-io.

Source

pub fn beacon_reason( &mut self, speed_kmh: f64, course_deg: f64, now: Instant, ) -> Option<BeaconReason>

Classify why (if at all) a beacon is due at the current speed and course. Returns None if no beacon should be sent yet, otherwise a BeaconReason identifying which condition tripped.

now is the current wall-clock time, injected by the caller so this module remains sans-io.

Source

pub fn current_turn_threshold(&self, speed_kmh: f64) -> f64

Compute the current turn threshold (in degrees) for the given speed using the HamHUD formula:

turn_threshold = turn_min + (turn_slope * 10) / speed_kmh
Source

pub const fn beacon_sent(&mut self, now: Instant)

Mark that a beacon was just sent. Updates the internal state with the supplied time, preserving any previously-recorded course and speed.

now is the wall-clock time at which the beacon was sent.

Source

pub const fn beacon_sent_with( &mut self, speed_kmh: f64, course_deg: f64, now: Instant, )

Mark that a beacon was just sent with the given speed and course.

now is the wall-clock time at which the beacon was sent.

Source

pub fn current_interval_secs(&self) -> u32

Get the current recommended interval in seconds.

Based on the last known speed, or slow_rate if no speed data.

Trait Implementations§

Source§

impl Debug for SmartBeaconing

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more