API
Os nomes são os mesmos nas duas plataformas, exceto onde a tabela diz outra coisa. Em Kotlin os pacotes são today.torke.kit.session, .engine, .input, .format, .analysis, .suspension e .sensors.
RunSession
Seção intitulada “RunSession”| Membro | Swift | Kotlin |
|---|---|---|
| Criar | RunSession(options:) |
RunSession(options) |
| Estado ao vivo | snapshot (@Observable) |
snapshot: StateFlow<RunSnapshot> |
| Eventos | events() -> AsyncStream<RunEvent> |
events: Flow<RunEvent> |
| Ler uma fonte | start(with:) |
start(provider, scope) |
| Ler até o fim | await run(with:) |
suspend run(provider) |
| Armar | arm(mode:) |
arm(mode) |
| Fechar / descartar / parar | finish(), cancel(), stop() |
igual |
| Erro do app | fail(_:) |
fail(failure) |
| Gravação | recording(device:app:) -> TorkeRun |
recording(device, app) |
| Amostra à mão | process(_:) -> [RunEvent] |
process(sample): List<RunEvent> |
RunSnapshot
Seção intitulada “RunSnapshot”phase, speed, speedKmh, elapsed, distance, gpsAccuracy, location, startLocation, mode, result, interval, gpsRate. Veja A sessão ao vivo.
RunPhase
Seção intitulada “RunPhase”idle, waitingStill, armed, running(start), finished, failed(failure). Em Kotlin com maiúscula: RunPhase.Idle, RunPhase.Running(start)…
RunMode
Seção intitulada “RunMode”| Swift | Kotlin | O que mede |
|---|---|---|
.standingStart |
RunMode.StandingStart |
Largada parada (padrão). |
.rolling(fromKmh:toKmh:) |
RunMode.Rolling(fromKmh, toKmh) |
Uma retomada. |
.braking(fromKmh:) |
RunMode.Braking(fromKmh) |
Uma frenagem até parar. |
RunEvent
Seção intitulada “RunEvent”| Swift | Kotlin | Quando |
|---|---|---|
.armed |
RunEvent.Armed |
Parado tempo suficiente. |
.disarmed |
RunEvent.Disarmed |
Mexeu sem largar. |
.launched(time:location:) |
RunEvent.Launched |
Largou. |
.passed(mark, elapsed:) |
RunEvent.Passed |
Estimativa ao vivo de uma marca. |
.finished(result) |
RunEvent.Finished |
Tempos oficiais. |
.intervalFinished(result) |
RunEvent.IntervalFinished |
Terminou uma retomada ou frenagem. |
.failed(failure) |
RunEvent.Failed |
Não houve arrancada. |
RunFailure
Seção intitulada “RunFailure”noLaunch, noInterval, noMotionSensors, locationDenied.
RunSessionOptions
Seção intitulada “RunSessionOptions”stillWindow, stillAccel, stillSpeed, launchAccel, launchHoldAccel, launchHold, launchGrace, finishDistance, backOffRatio, maxDuration, analysisDistance. Veja Ajustar a detecção.
Resultados
Seção intitulada “Resultados”RunResult
Seção intitulada “RunResult”| Campo | Unidade |
|---|---|
launchTime |
s, no relógio das amostras |
sixtyFeet, zeroTo100, eighthMile, quarterMile |
s |
eighthMileKmh, quarterMileKmh, topSpeedKmh |
km/h |
launchG, peakG |
g |
accelBias |
m/s², o viés que o filtro aprendeu |
trace |
[TracePoint]: t, velocidade e distância |
Extensões: zeroTo60mph, thousandFeet, halfMile, time(toKmh:), time(fromKmh:toKmh:), elapsed(toDistance:), speedKmh(atDistance:), corrected(for:) (Kotlin: corrected(weather)).
IntervalResult
Seção intitulada “IntervalResult”kind (rolling, braking), fromKmh, toKmh, time, distance, peakG, startTime.
DragMark e DragDistance
Seção intitulada “DragMark e DragDistance”DragMark: sixtyFeet, zeroTo100, eighthMile, quarterMile.
DragDistance (metros): rollout, sixtyFeet, eighthMile, thousandFeet, quarterMile, halfMile, e as velocidades speed100, speed60mph. Em Kotlin em maiúsculas: DragDistance.QUARTER_MILE.
Fontes de dados
Seção intitulada “Fontes de dados”RunDataProvider
Seção intitulada “RunDataProvider”Um protocolo (interface em Kotlin) com um único método: samples(), que entrega SensorSample em ordem de tempo. Implemente para conectar a sua própria fonte (um arquivo de outra ferramenta, dados de teste).
PhoneSensorProvider
Seção intitulada “PhoneSensorProvider”Os sensores do celular. iOS: PhoneSensorProvider() e await requestPermission(). Android: PhoneSensorProvider(context, fullTracking), com ACCESS_FINE_LOCATION já concedida; gnss (StateFlow<GnssInfo?>: satellitesInFix, satellitesVisible, meanCn0).
PhoneBarometer
Seção intitulada “PhoneBarometer”A pressão da estação para Weather: isAvailable e stationPressureHpa() (async no Swift, suspend no Kotlin).
RecordedRunProvider
Seção intitulada “RecordedRunProvider”RecordedRunProvider(run, speed:): speed 0 (padrão) reproduz o mais rápido possível; 1, em tempo real. RecordedRunProvider.demo(seed:) é a arrancada simulada.
Amostras
Seção intitulada “Amostras”| Tipo | Campos |
|---|---|
RawMotionSample |
t, user (aceleração sem gravidade, m/s²), gravity |
GPSSample |
t, speed, speedAccuracy, latitude, longitude, horizontalAccuracy, altitude |
Coordinate |
latitude, longitude |
Formato
Seção intitulada “Formato”TorkeRun
Seção intitulada “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)). Veja Formato torke.run.
Análise
Seção intitulada “Análise”Weather
Seção intitulada “Weather”Weather(temperatureC:humidity:pressureHpa:). Propriedades: vaporPressureHpa, dryPressureHpa, airDensity, densityAltitude, correctionFactor. Métodos: corrected(time:), corrected(speed:) (Kotlin: correctedTime, correctedSpeed).
PowerEstimate
Seção intitulada “PowerEstimate”fromTrapSpeed(massKg:quarterMileKmh:), fromElapsedTime(massKg:quarterMile:), wheelPower(_:massKg:dragArea:rollingResistance:airDensity:) -> [PowerPoint], peakWheelHp(…). PowerPoint: t, speedKmh, watts.
RunQuality
Seção intitulada “RunQuality”grade (good, fair, poor), issues, gpsRate, speedAccuracy, longestGpsGap, slope, tiltChange, disagreement. RunQuality.assess(run, limits:) com RunQuality.Limits. Veja Qualidade da arrancada.
Validação
Seção intitulada “Validação”| Tipo | O que é |
|---|---|
Timeslip |
O ticket: sixtyFeet, threeThirtyFeet, eighthMile, eighthMileSpeed, thousandFeet, quarterMile, quarterMileSpeed, speedUnit (kmh, mph), reactionTime, notes. |
ValidationMark |
As marcas comparáveis; isSpeed, value(in:). |
MarkComparison |
mark, measured, reference, error. |
RunComparison |
label, marks. Swift: RunComparison(result:timeslip:label:); Kotlin: RunComparison.of(…). TorkeRun.compare(with:) analisa de novo e compara. |
ValidationReport |
runs, skipped, summaries, targets, passed. Kotlin: ValidationReport.of(inputs). |
MarkSummary |
count, bias, meanAbsolute, rms, worst, limit, passed. |
ValidationTargets |
O erro permitido por marca; por padrão as metas do TorkeKit. |
ValidationSet |
O JSON torke.validation: decode, report(relativeTo:) (Kotlin: report(directory)). |
Veja Validação com tickets.
| Tipo | O que é |
|---|---|
ChristmasTree |
type (pro, sportsman), activatedAt, lights, greenAt, lit(at:), reaction(leftStageAt:), estimatedReaction(launchedAt:); ChristmasTree.start(type:stagedAt:seed:). |
TreeLight, Reaction |
Uma luz (kind, time); a reação (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 |
Uma linha de dois pontos; uma volta (number, start, time, sectors, distance). |
Geofence |
circle(center:radius:) ou polygon(_:), contains; [Geofence].first(containing:) (Kotlin: firstContaining). |
GeofenceCheck |
TorkeRun.check(_:): startInside, shareInside, allInside. |
Geo |
distance(_:_:) (haversine) e local(_:origin:). |
Veja Ferramentas de pista.
Suspensão
Seção intitulada “Suspensão”| Tipo | O que é |
|---|---|
SuspensionSetup |
kind (fourLink, ladderBar, torqueArm), unit, wheelbase, cgHeight, points, notes. Construtores fourLink, ladderBar, torqueArm; converted(to:), geometry(). |
SuspensionGeometry |
instantCenter, icLength, icHeight, antiSquat, bars, warnings. |
Bar |
name, rear, front, angle, length. |
Point2, LengthUnit |
Um ponto x, y; inches ou centimeters. |
ValueRange |
min, max, contains, miss. |
TargetWindow |
icLength, icHeight, antiSquat, nearShare; status(_:of:), score(_:). |
FourLinkHoles |
Os furos de cada suporte; ranked(base:target:limit:) -> [HoleOption]. |
HoleOption |
holes, setup, geometry, score. |
SetupChange |
icLength, icHeight, antiSquat, moved. Swift: SetupChange(from:to:); Kotlin: SetupChange.between(before, after). |