Package-level declarations

Types

Link copied to clipboard

Prefers fused and falls back to the platform rotation vector, or the geomagnetic one on devices without a gyroscope. Running hot, either source is slowed.

Link copied to clipboard
Link copied to clipboard
data class AngularBox(val bearingDeg: Double, val elevationDeg: Double, val halfWidthDeg: Double, val heightDeg: Double)

A chip's footprint in view angles: centered on bearingDeg, rising heightDeg from elevationDeg.

Link copied to clipboard
data class CameraIntrinsics(val focalLengthMm: Float, val sensorLongMm: Float, val sensorShortMm: Float)

The back camera's focal length and the size of the sensor area the preview shows, both in millimeters.

Link copied to clipboard
data class CameraPose(val right: Vec3, val up: Vec3, val forward: Vec3)

Where the back camera points, as the screen's right, up and forward axes in east-north-up, referenced to magnetic north.

Link copied to clipboard
Link copied to clipboard
data class CameraPoseState(val pose: CameraPose? = null, val hasSensor: Boolean = true, val calibration: Int = CALIBRATION_UNKNOWN, val headingAccuracyDeg: Double? = null, val trueNorth: Boolean = false, val thermal: HudThermal = HudThermal.NORMAL)

calibration is the platform's sensor status, 3 high down to 0 unreliable, and -1 before the first reading. headingAccuracyDeg is the sensor's own estimate of its heading error, null when it gives none. trueNorth is true when the source already applied the declination, so the pose is referenced to true north rather than magnetic. thermal is how hot the phone runs, so the view can shed work before the system throttles it.

Link copied to clipboard
data class FencePoint(val bearingDeg: Double, val distanceM: Double)

A point on a geofence's edge as seen from the phone. bearingDeg is magnetic, like the camera's.

Link copied to clipboard

An orientation fusion outside the platform sensors, such as Play services' Fused Orientation Provider. Each flavor binds one; NONE is the flavor without it, and the camera pose falls back to the rotation vector.

Link copied to clipboard
data class HudFence(val key: String, val name: String, val edge: List<FencePoint>, val inside: Boolean)

A waypoint's geofence outline, sampled around its edge, and whether the phone stands inside it.

Link copied to clipboard
data class HudFinding(val subject: HudSubject, val distanceText: String)

What the finder is looking for and how far away it is.

Link copied to clipboard
data class HudRise(val text: String, val above: Boolean)

A rise worth saying: text is the magnitude in the user's units, above its direction.

Link copied to clipboard
data class HudRoute(val forward: RouteLeg, val back: RouteLeg?, val mappable: Int, val total: Int)

A traceroute to draw: its legs, and how many of its known nodes have a position to draw them at.

Link copied to clipboard
fun interface HudStill

The bound camera's still: a picture with overlay, a view-sized frame of the overlay, drawn where it showed.

Link copied to clipboard
sealed interface HudSubject

What a chip stands for. key is stable across updates and unique across both kinds.

Link copied to clipboard
data class HudSurveyTile(val corners: List<Pair<Double, Double>>, val quality: Quality, val distanceM: Double)

A survey square laid on the ground around the phone. corners are east and north offsets in metres, turned to magnetic north like the camera pose, so they project with the same math as everything else in the view.

Link copied to clipboard
data class HudTarget(val subject: HudSubject, val bearingDeg: Double, val elevationDeg: Double, val distanceM: Double, val distanceText: String, val precisionHalfAngleDeg: Double?, val elevationSpreadDeg: Double, val elevationKnown: Boolean, val positionAgeSec: Long?, val focused: Boolean, val rise: HudRise? = null)

A positioned node or waypoint as the HUD draws it. bearingDeg is magnetic, to match the camera pose, and precisionHalfAngleDeg spans the target's uncertainty circle widened by the phone's own fix accuracy, or is null when neither is known. elevationKnown is false when the target and the phone share no altitude frame, so the target sits level with the phone.

Link copied to clipboard
enum class HudThermal : Enum<HudThermal>

HOT slows the sensors and says so; CRITICAL also releases the camera, leaving the overlay as a compass.

Link copied to clipboard
data class HudTrack(val nodeNum: Int, val color: Int, val points: List<TrackPoint>)

A node's position history as breadcrumbs, oldest first, in the node's color.

Link copied to clipboard
enum class HudWarning : Enum<HudWarning>
Link copied to clipboard
data class MeshHudTargets(val targets: List<HudTarget> = emptyList(), val directionUnknown: List<NearbyTarget> = emptyList(), val fences: List<HudFence> = emptyList(), val ownAccuracyM: Float? = null, val elevationApproximate: Boolean = false, val declinationDeg: Float = 0.0f, val units: MeasurementSystem = MeasurementSystem.METRIC, val scoped: Boolean = false, val warnings: List<HudWarning> = emptyList(), val ready: Boolean = false, val moving: Boolean = false, val showPrecision: Boolean = true, val finding: HudFinding? = null)
Link copied to clipboard
class MeshHudViewModel(poseProvider: CameraPoseProvider, phoneLocationProvider: PhoneLocationProvider, pressureProvider: PhonePressureProvider, magneticFieldProvider: MagneticFieldProvider, nodeRepository: NodeRepository, packetRepository: PacketRepository, meshLogRepository: MeshLogRepository, tracerouteResponseProvider: TracerouteResponseProvider, tracerouteSnapshotRepository: TracerouteSnapshotRepository, mapPrefs: MapPrefs, notificationPrefs: NotificationPrefs, localeUnitsProvider: LocaleUnitsProvider, dispatchers: CoroutineDispatchers, surveyCells: SignalSurveyCellSource) : ViewModel
Link copied to clipboard
data class NearbyTarget(val subject: HudSubject, val eastM: Double, val northM: Double, val bearingDeg: Double, val distanceM: Double, val radiusM: Double)

A target too close to point at: the phone sits inside its uncertainty circle. The radar plots it by offset instead, eastM and northM from the phone, inside a ring of radiusM. bearingDeg is magnetic, like the camera's.

Link copied to clipboard
data class PathPoint(val bearingDeg: Double, val elevationDeg: Double, val distanceM: Double, val atViewer: Boolean)

A point on a path through the air, seen from the phone. bearingDeg is magnetic, like the camera's. atViewer is true when the point is inside the phone's own accuracy, so the path starts from the viewer rather than a direction.

Link copied to clipboard

The phone's barometer, in hectopascals, while collected; it completes without a value on a phone that has none.

Link copied to clipboard
enum class PinEdge : Enum<PinEdge>

The screen edge an out-of-view target pins to.

Link copied to clipboard
data class RouteLeg(val nodeNums: List<Int>, val points: List<PathPoint?>, val snrDb: List<Float?>, val forward: Boolean)

One direction of a traceroute. points runs hop by hop, null for a hop with no position; snrDb holds the signal of the link into each hop after the first, null where it was not reported.

Link copied to clipboard
data class RouteSource(val forward: List<Int>, val back: List<Int>, val snrTowards: List<Int>?, val snrBack: List<Int>?, val snapshot: Map<Int, Position>)

A traceroute to draw: its node nums each way, link SNRs in quarter dB, and the positions it was recorded with.

Link copied to clipboard
data class ScreenPoint(val x: Float, val y: Float)
Link copied to clipboard
data class Spark(val at: Vec3, val behind: Vec3, val ahead: Vec3)

A spark on a path through the view, as directions: where it is, and a step behind and ahead of it.

Link copied to clipboard
data class TrackPoint(val point: PathPoint, val fixTimeSec: Long?, val altitudeKnown: Boolean)

fixTimeSec is absolute, so ages read from it stay current while the track itself is unchanged.

Link copied to clipboard
data class TrackSource(val nodeNum: Int, val positions: List<Position>)

A node's position history to draw as breadcrumbs.

Link copied to clipboard
data class TrackSummary(val points: Int, val spanSec: Long, val newestFixTimeSec: Long?)

What a track covers: how many points, from its oldest timed fix to its newest.

Link copied to clipboard
data class Vec3(val x: Double, val y: Double, val z: Double)

A vector in the local east-north-up frame.

Properties

Link copied to clipboard
Link copied to clipboard
const val OVERFLOW_LEVEL: Int

The level stackLevels gives a chip that would need more than its cap: it is counted, not drawn.

Link copied to clipboard

The camera's tilt above the horizontal, in degrees; negative when it points at the ground.

Functions

Link copied to clipboard
fun directionEnu(bearingDeg: Double, elevationDeg: Double): Vec3

Unit vector toward a bearing (degrees from north, clockwise) at an elevation above the horizontal.

Link copied to clipboard
fun edgeOffsetPx(edge: PinEdge, yawDeg: Double, pitchDeltaDeg: Double, focalPx: Float): Float

Where along its pinned edge a target sits, in pixels from the view center: across the top and bottom by how far it is to the side, up and down the sides by how far it is above or below. Positive is rightward and upward.

Link copied to clipboard
fun elevationDeg(distanceM: Double, riseM: Double?): Double

Angle above the observer's horizontal to a target distanceM away and riseM above, including the curvature drop at that range. A null riseM places the target level with the observer.

Link copied to clipboard
fun elevationSpreadDeg(distanceM: Double, verticalM: Double, elevationKnown: Boolean): Double

Half the vertical angle a target distanceM away could lie within, from a vertical uncertainty of verticalM. When the target has no elevationKnown, its level placement is a guess, so the band is at least UNKNOWN_ELEVATION_SPREAD_DEG tall.

Link copied to clipboard
fun fallbackFocalPx(viewWidth: Float, viewHeight: Float): Float
Link copied to clipboard
actual fun HudCameraPreview(onIntrinsics: (CameraIntrinsics?) -> Unit, onAvailable: (Boolean) -> Unit, onStill: (HudStill?) -> Unit, modifier: Modifier)

The back camera's live preview, filling modifier; reports intrinsics once the camera is bound, and onAvailable false when it cannot bind or the camera fails, true once it opens. onStill gets the bound camera's still, or null once it is released or where there is none.

expect fun HudCameraPreview(onIntrinsics: (CameraIntrinsics?) -> Unit, onAvailable: (Boolean) -> Unit, onStill: (HudStill?) -> Unit, modifier: Modifier = Modifier)

The back camera's live preview, filling modifier; reports intrinsics once the camera is bound, and onAvailable false when it cannot bind or the camera fails, true once it opens. onStill gets the bound camera's still, or null once it is released or where there is none.

actual fun HudCameraPreview(onIntrinsics: (CameraIntrinsics?) -> Unit, onAvailable: (Boolean) -> Unit, onStill: (HudStill?) -> Unit, modifier: Modifier)

The back camera's live preview, filling modifier; reports intrinsics once the camera is bound, and onAvailable false when it cannot bind or the camera fails, true once it opens. onStill gets the bound camera's still, or null once it is released or where there is none.

Link copied to clipboard
fun leaderSide(level: Int): Int

Which way a chip at level steps aside from its point: none at level 0, then right and left in turn.

Link copied to clipboard
fun MeshHudScreen(focusNodeNum: Int?, onNavigateUp: () -> Unit, onOpenNode: (Int) -> Unit, modifier: Modifier = Modifier, tracerouteDestNum: Int? = null, tracerouteRequestId: Int? = null, tracerouteLogUuid: String? = null, trackNodeNum: Int? = null, onEditWaypoint: (Int) -> Unit? = null, viewModel: MeshHudViewModel = koinViewModel())
Link copied to clipboard
fun pinEdge(projected: ScreenPoint?, width: Float, yawDeg: Double, pitchDeltaDeg: Double, previous: PinEdge?): PinEdge

Where to pin a target that falls outside the view, chosen the way someone finds it: a target well to the side, or behind, pins to the side to turn toward (yawDeg, positive clockwise), and one roughly ahead pins top or bottom to tilt toward (pitchDeltaDeg, positive up). Choosing on the screen's own axes instead puts a node behind the user on the bottom edge while the camera points at the ground, which reads as inverted. previous holds through small wobbles: near SIDE_YAW_DEG and near straight behind, where the side would otherwise flip.

Link copied to clipboard
fun precisionHalfAngleDeg(radiusM: Double, distanceM: Double): Double?

Half the angle a circle of radiusM subtends at distanceM, or null when the observer is inside it.

Link copied to clipboard
fun project(direction: Vec3, pose: CameraPose, focalPx: Float, width: Float, height: Float): ScreenPoint?

Pinhole projection of direction onto a width x height view with focal length focalPx, or null when it is behind the camera.

Link copied to clipboard
fun pxToDeg(px: Int, focalPx: Float): Double

View angle, in degrees, that px spans at the center of a view with focal length focalPx.

Link copied to clipboard
actual fun rememberHudCapture(still: HudStill?, overlay: GraphicsLayer): () -> Unit?

Android 10 and later only, where saving to Pictures needs no storage permission.

expect fun rememberHudCapture(still: HudStill?, overlay: GraphicsLayer): () -> Unit?

Saves a picture of the mesh view from still, with overlay recorded at the shutter drawn over it; null where the platform cannot or before the camera is bound.

actual fun rememberHudCapture(still: HudStill?, overlay: GraphicsLayer): () -> Unit?

Saves a picture of the mesh view from still, with overlay recorded at the shutter drawn over it; null where the platform cannot or before the camera is bound.

Link copied to clipboard

This pose turned clockwise about the vertical by deg.

Link copied to clipboard
fun signedTurnDeg(fromDeg: Double, toDeg: Double): Double

The shortest signed turn from fromDeg to toDeg, in -180..180; positive is clockwise.

Link copied to clipboard
fun stackLevels(boxes: List<AngularBox>, gapDeg: Double, leaderRunDeg: Double = 0.0, maxLevel: Int = MAX_STACK_LEVEL): IntArray

How many rows each chip is lifted so none overlaps an earlier one, in list order. Computed from view angles rather than screen positions, so it holds still while the phone moves and changes only when the targets do. A lifted chip also steps aside by its half width plus leaderRunDeg, to the side leaderSide gives, so its leader leans rather than rising plumb; a chip that would need more than maxLevel rows gets OVERFLOW_LEVEL.

Link copied to clipboard
fun viewToBufferMatrix(viewWidth: Float, viewHeight: Float, cropLeft: Float, cropTop: Float, cropRight: Float, cropBottom: Float, rotationDegrees: Int): FloatArray

The affine map, as a row-major 3x3, from view pixels to the pixels of a camera buffer whose crop the view shows rotated clockwise by rotationDegrees and center-cropped to fill, the way the preview fills the mesh view.