Package-level declarations

Types

Link copied to clipboard
data class DurationBounds(val min: Int, val max: Int, val allowsZero: Boolean, val hasSchemaMin: Boolean, val hasSchemaMax: Boolean)

Validated numeric bounds for custom duration entry.

Link copied to clipboard
sealed interface DurationParseResult

Result of parsing and validating user text input against DurationBounds.

Link copied to clipboard
data class DurationParts(val days: Int, val hours: Int, val minutes: Int, val seconds: Int)

Decomposed calendar components of a duration in seconds for localized formatting.

Link copied to clipboard

Native unit of a duration configuration field.

Link copied to clipboard

How long the external notification output stays driven, in milliseconds, which is the unit ModuleConfig.ExternalNotificationConfig.output_ms is read in. FixedUpdateIntervals cannot serve this field: its values are seconds, and writing one here sets a pulse a thousand times shorter than the label promises.

Link copied to clipboard

Defines a set of fixed time intervals in seconds, commonly used for configuration settings.

Link copied to clipboard

Represents a specific configuration context that determines a subset of allowed update intervals. This is used to filter the available FixedUpdateIntervals for a particular setting.

Link copied to clipboard
Link copied to clipboard
sealed class UpdateInterval

Represents an update interval, which can be either a predefined fixed value or a custom manual value in seconds. This is a type-safe representation for settings that involve time durations.

Properties

Link copied to clipboard
Link copied to clipboard
val FieldMetadata.intRange: IntRange?

The inclusive range a proto field declares for presentation, or null when the schema leaves either bound open. Fractional bounds round inward, so the integer range never admits a value the schema excludes.

Link copied to clipboard
val FieldMetadata.maxIntValue: Int?

Inclusive upper bound a proto field declares rounded inward, or null when unset or below the Int domain.

Link copied to clipboard
val FieldMetadata.minIntValue: Int?

Inclusive lower bound a proto field declares rounded inward, or null when unset or above the Int domain.

Link copied to clipboard
val FieldMetadata.unitLabelRes: StringResource?

The translated name of the unit a proto field declares, or null where the app has no name for that symbol. The schema's symbol is never rendered directly: a symbol with no entry here shows no unit rather than raw schema text.

Functions

Link copied to clipboard

Breaks seconds into days, hours, minutes, and remaining seconds, or returns null when seconds is under one minute or equals Int.MAX_VALUE (Always On).

Link copied to clipboard
fun fieldTitle(label: StringResource, metadata: FieldMetadata): String

A control's title, with the schema's unit appended when the control shows a bare number. An interval picker names its own unit in every item ("30 seconds", "2 hours"), so those pass no metadata and keep the label alone.

Link copied to clipboard
fun FieldMetadata.offeredOn(isOemFixedGps: Boolean, holdsValue: Boolean): Boolean

Whether a control is offered on this board. A diy_only field is hidden only on a board whose HardwareModel sets oem_fixed_gps; any other or unknown board shows it, and so does a field already holding a value, which would otherwise be saved back unseen.

Link copied to clipboard

Parses input as a non-negative whole number within 0..Int.MAX_VALUE and validates it against bounds.

Link copied to clipboard
fun resolveDurationBounds(metadata: FieldMetadata?, allowsZero: Boolean, maxOverride: Int? = null): DurationBounds

Resolves DurationBounds from optional protobuf metadata, whether the field's preset list allows 0 (Unset), and an optional explicit maxOverride cap (for example, a nanopb int_size storage limit not reflected in proto FieldMetadata). When both metadata and maxOverride specify a maximum, the tighter cap applies. Inverted bounds (min > max) are treated as unbounded rather than locking the user out.