API
Los nombres son los mismos en las dos plataformas, salvo donde la tabla dice otra cosa. En Kotlin los paquetes son today.torke.kit.session, .engine, .input, .format, .analysis, .suspension y .sensors.
RunSession
Sección titulada «RunSession»| Miembro | Swift | Kotlin |
|---|---|---|
| Crear | RunSession(options:) |
RunSession(options) |
| Estado en vivo | snapshot (@Observable) |
snapshot: StateFlow<RunSnapshot> |
| Eventos | events() -> AsyncStream<RunEvent> |
events: Flow<RunEvent> |
| Leer una fuente | start(with:) |
start(provider, scope) |
| Leer hasta el final | await run(with:) |
suspend run(provider) |
| Armar | arm(mode:) |
arm(mode) |
| Cerrar / descartar / parar | finish(), cancel(), stop() |
igual |
| Error de la app | fail(_:) |
fail(failure) |
| Grabación | recording(device:app:) -> TorkeRun |
recording(device, app) |
| Muestra a mano | process(_:) -> [RunEvent] |
process(sample): List<RunEvent> |
RunSnapshot
Sección titulada «RunSnapshot»phase, speed, speedKmh, elapsed, distance, gpsAccuracy, location, startLocation, mode, result, interval, gpsRate. Ver La sesión en vivo.
RunPhase
Sección titulada «RunPhase»idle, waitingStill, armed, running(start), finished, failed(failure). En Kotlin con mayúscula: RunPhase.Idle, RunPhase.Running(start)…
RunMode
Sección titulada «RunMode»| Swift | Kotlin | Qué mide |
|---|---|---|
.standingStart |
RunMode.StandingStart |
Arrancada desde parado (por defecto). |
.rolling(fromKmh:toKmh:) |
RunMode.Rolling(fromKmh, toKmh) |
Un tramo en movimiento. |
.braking(fromKmh:) |
RunMode.Braking(fromKmh) |
Un frenado hasta parar. |
RunEvent
Sección titulada «RunEvent»| Swift | Kotlin | Cuándo |
|---|---|---|
.armed |
RunEvent.Armed |
Quieto el tiempo suficiente. |
.disarmed |
RunEvent.Disarmed |
Se movió sin arrancar. |
.launched(time:location:) |
RunEvent.Launched |
Arrancó. |
.passed(mark, elapsed:) |
RunEvent.Passed |
Estimación en vivo de una marca. |
.finished(result) |
RunEvent.Finished |
Tiempos oficiales. |
.intervalFinished(result) |
RunEvent.IntervalFinished |
Terminó un tramo rodando o de frenado. |
.failed(failure) |
RunEvent.Failed |
No hubo corrida. |
RunFailure
Sección titulada «RunFailure»noLaunch, noInterval, noMotionSensors, locationDenied.
RunSessionOptions
Sección titulada «RunSessionOptions»stillWindow, stillAccel, stillSpeed, launchAccel, launchHoldAccel, launchHold, launchGrace, finishDistance, backOffRatio, maxDuration, analysisDistance. Ver Ajustar la detección.
Resultados
Sección titulada «Resultados»RunResult
Sección titulada «RunResult»| Campo | Unidad |
|---|---|
launchTime |
s, en el reloj de las muestras |
sixtyFeet, zeroTo100, eighthMile, quarterMile |
s |
eighthMileKmh, quarterMileKmh, topSpeedKmh |
km/h |
launchG, peakG |
g |
accelBias |
m/s², el sesgo que aprendió el filtro |
trace |
[TracePoint]: t, velocidad y distancia |
Extensiones: zeroTo60mph, thousandFeet, halfMile, time(toKmh:), time(fromKmh:toKmh:), elapsed(toDistance:), speedKmh(atDistance:), corrected(for:) (Kotlin: corrected(weather)).
IntervalResult
Sección titulada «IntervalResult»kind (rolling, braking), fromKmh, toKmh, time, distance, peakG, startTime.
DragMark y DragDistance
Sección titulada «DragMark y DragDistance»DragMark: sixtyFeet, zeroTo100, eighthMile, quarterMile.
DragDistance (metros): rollout, sixtyFeet, eighthMile, thousandFeet, quarterMile, halfMile, y las velocidades speed100, speed60mph. En Kotlin en mayúsculas: DragDistance.QUARTER_MILE.
Fuentes de datos
Sección titulada «Fuentes de datos»RunDataProvider
Sección titulada «RunDataProvider»Un protocolo (interfaz en Kotlin) con un solo método: samples(), que entrega SensorSample en orden de tiempo. Implementalo para conectar tu propia fuente (un archivo de otra herramienta, datos de prueba).
PhoneSensorProvider
Sección titulada «PhoneSensorProvider»Los sensores del teléfono. iOS: PhoneSensorProvider() y await requestPermission(). Android: PhoneSensorProvider(context, fullTracking), con ACCESS_FINE_LOCATION ya concedido; gnss (StateFlow<GnssInfo?>: satellitesInFix, satellitesVisible, meanCn0).
PhoneBarometer
Sección titulada «PhoneBarometer»La presión de la estación para Weather: isAvailable y stationPressureHpa() (async en Swift, suspend en Kotlin).
RecordedRunProvider
Sección titulada «RecordedRunProvider»RecordedRunProvider(run, speed:): speed 0 (por defecto) reproduce lo más rápido posible; 1, a la velocidad real. RecordedRunProvider.demo(seed:) es la corrida simulada.
Muestras
Sección titulada «Muestras»| Tipo | Campos |
|---|---|
RawMotionSample |
t, user (aceleración sin gravedad, m/s²), gravity |
GPSSample |
t, speed, speedAccuracy, latitude, longitude, horizontalAccuracy, altitude |
Coordinate |
latitude, longitude |
Formato
Sección titulada «Formato»TorkeRun
Sección titulada «TorkeRun»format, version, recordedAt, device, app, motion, gps, result, interval, weather, suspension.
Métodos: analyze(stopDistance:), rolling(fromKmh:toKmh:), braking(fromKmh:), quality(), startLocation, encoded() / TorkeRun.decode(_:) (Kotlin: encode() / TorkeRun.decode(text)). Ver Formato torke.run.
Análisis
Sección titulada «Análisis»Weather
Sección titulada «Weather»Weather(temperatureC:humidity:pressureHpa:). Propiedades: vaporPressureHpa, dryPressureHpa, airDensity, densityAltitude, correctionFactor. Métodos: corrected(time:), corrected(speed:) (Kotlin: correctedTime, correctedSpeed).
PowerEstimate
Sección titulada «PowerEstimate»fromTrapSpeed(massKg:quarterMileKmh:), fromElapsedTime(massKg:quarterMile:), wheelPower(_:massKg:dragArea:rollingResistance:airDensity:) -> [PowerPoint], peakWheelHp(…). PowerPoint: t, speedKmh, watts.
RunQuality
Sección titulada «RunQuality»grade (good, fair, poor), issues, gpsRate, speedAccuracy, longestGpsGap, slope, tiltChange, disagreement. RunQuality.assess(run, limits:) con RunQuality.Limits. Ver Calidad de la corrida.
Validación
Sección titulada «Validación»| Tipo | Qué es |
|---|---|
Timeslip |
La boleta: sixtyFeet, threeThirtyFeet, eighthMile, eighthMileSpeed, thousandFeet, quarterMile, quarterMileSpeed, speedUnit (kmh, mph), reactionTime, notes. |
ValidationMark |
Las marcas comparables; isSpeed, value(in:). |
MarkComparison |
mark, measured, reference, error. |
RunComparison |
label, marks. Swift: RunComparison(result:timeslip:label:); Kotlin: RunComparison.of(…). TorkeRun.compare(with:) analiza de nuevo y compara. |
ValidationReport |
runs, skipped, summaries, targets, passed. Kotlin: ValidationReport.of(inputs). |
MarkSummary |
count, bias, meanAbsolute, rms, worst, limit, passed. |
ValidationTargets |
El error permitido por marca; por defecto las metas de TorkeKit. |
ValidationSet |
El JSON torke.validation: decode, report(relativeTo:) (Kotlin: report(directory)). |
| Tipo | Qué es |
|---|---|
ChristmasTree |
type (pro, sportsman), activatedAt, lights, greenAt, lit(at:), reaction(leftStageAt:), estimatedReaction(launchedAt:); ChristmasTree.start(type:stagedAt:seed:). |
TreeLight, Reaction |
Una luz (kind, time); la reacción (time, isRedLight, isPerfect). |
RunResult |
leftStageAt, reaction(on:), package(on:) (Kotlin: reaction(tree), packageTime(tree)). |
LapTimer |
process(_:) → LapEvent (started, sector, lap); laps, bestLap, delta, predictedLap, elapsed(at:), minimumLapTime. |
TimingLine, Lap |
Una línea de dos puntos; una vuelta (number, start, time, sectors, distance). |
Geofence |
circle(center:radius:) o polygon(_:), contains; [Geofence].first(containing:) (Kotlin: firstContaining). |
GeofenceCheck |
TorkeRun.check(_:): startInside, shareInside, allInside. |
Geo |
distance(_:_:) (haversine) y local(_:origin:). |
Suspensión
Sección titulada «Suspensión»| Tipo | Qué es |
|---|---|
SuspensionSetup |
kind (fourLink, ladderBar, torqueArm), unit, wheelbase, cgHeight, points, notes. Constructores fourLink, ladderBar, torqueArm; converted(to:), geometry(). |
SuspensionGeometry |
instantCenter, icLength, icHeight, antiSquat, bars, warnings. |
Bar |
name, rear, front, angle, length. |
Point2, LengthUnit |
Un punto x, y; inches o centimeters. |
ValueRange |
min, max, contains, miss. |
TargetWindow |
icLength, icHeight, antiSquat, nearShare; status(_:of:), score(_:). |
FourLinkHoles |
Los hoyos de cada soporte; ranked(base:target:limit:) -> [HoleOption]. |
HoleOption |
holes, setup, geometry, score. |
SetupChange |
icLength, icHeight, antiSquat, moved. Swift: SetupChange(from:to:); Kotlin: SetupChange.between(before, after). |