Drone.Adapters.Crazyflie.Transport.Mock (ex_drone v0.3.0)

View Source

In-process Crazyflie transport for CI and dry development.

Profiles (via mock://PROFILE or :mock_profile):

  • :default / :ready — healthy estimator, full battery
  • :estimator_not_ready — rejects takeoff readiness
  • :low_battery — reports low battery percent
  • :unplug — next send fails with :link_lost

Simulates link probe, protocol version, logging TOC/control/data, supervisor, and high-level commander replies so Session.connect/2 and adapter commands work without hardware.

Summary

Types

t()

In-memory mock radio / Crazyflie state.

Functions

Closes the mock transport (no resources to release).

Opens a mock transport with a profile from opts or URI.

Handles CRTP packets and returns synthetic ACKs.

Returns simulated battery / estimator / flight flags for the adapter.

Types

t()

@type t() :: %Drone.Adapters.Crazyflie.Transport.Mock{
  armed: boolean(),
  battery_percent: integer(),
  estimator_ready: boolean(),
  flying: boolean(),
  log_block_id: byte() | nil,
  log_layout: [Drone.Adapters.Crazyflie.Logging.layout_entry()] | nil,
  logging_started: boolean(),
  profile: atom() | nil,
  protocol_version: integer(),
  sent: [Drone.Adapters.Crazyflie.CRTP.packet()],
  unplugged: boolean(),
  x: float(),
  y: float(),
  yaw: float(),
  z: float()
}

In-memory mock radio / Crazyflie state.

Functions

close(mock)

Closes the mock transport (no resources to release).

open(opts)

Opens a mock transport with a profile from opts or URI.

send(state, packet)

Handles CRTP packets and returns synthetic ACKs.

telemetry(state)

Returns simulated battery / estimator / flight flags for the adapter.