AirPlay.V2.PtpBmca (AirPlay v0.3.2)

Copy Markdown View Source

AirPlay 2 gPTP BMCA-yield worker.

This follows the audible airplay2-rs/HomePod flow:

  • bind PTP event/general sockets on 319/320
  • send Mac-style Sync + Announce + Signaling with priority 250
  • yield to the receiver's better clock
  • act as a PTP slave: receive Sync/Follow_Up, send Delay_Req, process Delay_Resp
  • expose the current local-wall-clock to receiver-clock offset

Summary

Functions

Return the last measured clock offset.

Convert local wall-clock time to the receiver's PTP timeline.

Start the BMCA-yield worker for a receiver host.

Stop a BMCA worker.

Types

t()

@type t() :: %AirPlay.V2.PtpBmca{clock_id: binary() | nil, pid: pid(), state: pid()}

Functions

offset(ptp_bmca)

@spec offset(t()) :: map()

Return the last measured clock offset.

receiver_time_ns(session, local_ns \\ now_ns())

@spec receiver_time_ns(t(), integer()) :: non_neg_integer()

Convert local wall-clock time to the receiver's PTP timeline.

start_link(host, opts \\ [])

@spec start_link(
  String.t() | :inet.ip_address(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Start the BMCA-yield worker for a receiver host.

stop(ptp_bmca)

@spec stop(t()) :: :ok

Stop a BMCA worker.