<!-- Canonical source: https://github.com/deancochran/ftms/blob/2586e33ac88d5d945d9658e063bb909cd58462bd/docs/api.md; revision: 2586e33ac88d5d945d9658e063bb909cd58462bd -->

# Public API index

## References by language

Start with the public reference or package guide for your language. There is not
yet a uniform generated reference for all nine ports; guides below are real entry
points, not promises of equivalent documentation tooling.

| Language   | Reference / usage guide                                                                                                                                                            |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| C          | [Public header index](https://deancochran.github.io/ftms/reference/api/index.md#c-public-headers) and [C guide](https://deancochran.github.io/ftms/reference/c/index.md)           |
| C#         | [Public API](https://github.com/deancochran/ftms/blob/main/packages/csharp/docs/api.md)                                                                                            |
| Dart       | [Dart package guide](https://deancochran.github.io/ftms/start/dart/index.md)                                                                                                       |
| Go         | [Go package guide](https://deancochran.github.io/ftms/start/go/index.md) and [capabilities](https://github.com/deancochran/ftms/blob/main/packages/go/docs/capabilities.md)        |
| Kotlin/JVM | [Kotlin and Java guide](https://deancochran.github.io/ftms/start/kotlin/index.md)                                                                                                  |
| Python     | [Python package guide](https://deancochran.github.io/ftms/start/python/index.md)                                                                                                   |
| Rust       | [Rust package guide](https://deancochran.github.io/ftms/start/rust/index.md)                                                                                                       |
| Swift      | [Swift package guide](https://deancochran.github.io/ftms/start/swift/index.md)                                                                                                     |
| TypeScript | [Task index](https://deancochran.github.io/ftms/reference/api/index.md#typescript-reference) and [package guide](https://deancochran.github.io/ftms/reference/typescript/index.md) |

Need installation first? [Choose a language](https://deancochran.github.io/ftms/start/choose-language/index.md).
The detailed task tables below cover TypeScript and C. Import TypeScript APIs
from `@deancochran/ftms`, never `src/` or unexported subpaths. Include installed C
headers as `<ftms/measurement.h>`, for example, and link `ftms::ftms`.

## TypeScript reference

The documentation site publishes searchable TypeDoc HTML from public exports and
source comments. The installed package's `dist/index.d.ts` and referenced
declarations remain the offline API authority. Generated HTML is not included in
the npm artifact. Contributors can reproduce it using the
[site development instructions](https://github.com/deancochran/ftms/blob/main/site/README.md).

| Task                    | Public API                                                                                                                                                                      |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Measurement, normalized | `decodeFtmsMeasurement` (one UUID-selected API for all six machine-data families); named family parsers and `decodeIndoorBikeData` remain available for compatibility           |
| Characteristic dispatch | `parseRegisteredFtmsPayload`, `FTMS_CHARACTERISTICS`, `FTMS_DATA_CHARACTERISTICS`                                                                                               |
| Features                | `decodeFtmsFeatures`; `decodeFtmsFeaturesRaw` / `encodeFtmsFeaturesRaw`                                                                                                         |
| Ranges                  | `decodeFtmsRange`, `decodeSupportedPowerRange` and the other named range decoders; `decodeFtmsRangeRaw` / `encodeFtmsRangeRaw`; `inspectFtmsRangeRaw`                           |
| Measurements, raw       | `decodeFtmsMeasurementRaw` / `encodeFtmsMeasurementRaw`                                                                                                                         |
| Requests, normalized    | `tryEncodeFtmsControlRequest` (result union), `encodeFtmsControlRequest` (throwing)                                                                                             |
| Requests, raw           | `decodeFtmsControlRequestRaw` / `encodeFtmsControlRequestRaw`                                                                                                                   |
| Responses               | `decodeFtmsControlResponse` (validated result); `decodeFtmsControlResponseRaw` / `encodeFtmsControlResponseRaw`                                                                 |
| Statuses                | `parseFtmsTrainingStatus`, `parseFtmsMachineStatus`; `decodeFtmsTrainingStatusRaw` / `encodeFtmsTrainingStatusRaw`; `decodeFtmsMachineStatusRaw` / `encodeFtmsMachineStatusRaw` |
| Capability evidence     | `evaluateFtmsCapabilities`, `FtmsCapabilitySnapshot`, `FtmsCapabilityReport`                                                                                                    |

Normalized names carry units (`speedMps`, `cadenceRpm`, `powerWatts`). Missing or
unavailable metrics are `null`; diagnostics are separate from metrics. Raw codecs
preserve wire-scale values and have API-specific validation/throw behavior. Use
the generated signatures and comments, not a guessed common decoder contract.

## C public headers

| Installed header                                                                                       | Operations and ownership                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ftms.h](https://github.com/deancochran/ftms/blob/main/packages/c/include/ftms/ftms.h)                 | `ftms_decode_features`, `ftms_encode_features`, `ftms_decode_range`, `ftms_encode_range`, `ftms_inspect_range` and explicit-format variants; result codes and masks |
| [measurement.h](https://github.com/deancochran/ftms/blob/main/packages/c/include/ftms/measurement.h)   | `ftms_decode_measurement`, `ftms_encode_measurement`, `ftms_measurement_plan`, explicit-format variants and caller-owned `ftms_record_*` assembly APIs              |
| [control.h](https://github.com/deancochran/ftms/blob/main/packages/c/include/ftms/control.h)           | `ftms_encode_control_request`, `ftms_decode_control_request`, format variants, `ftms_encode_control_response`, `ftms_decode_control_response`                       |
| [status.h](https://github.com/deancochran/ftms/blob/main/packages/c/include/ftms/status.h)             | Machine and Training Status encode/decode APIs, partial evidence and text-span rules                                                                                |
| [capabilities.h](https://github.com/deancochran/ftms/blob/main/packages/c/include/ftms/capabilities.h) | `ftms_capability_requirements*` and matching `ftms_evaluate_capabilities*`; caller-owned buffers, discovery evidence and C.7 options                                |

C values use documented fixed-point integers, not normalized JavaScript floats.
Read each header's capacity, lifetime, overlap and unchanged-output error contracts.
Only consume output after the function's success contract is satisfied; success
may still carry payload diagnostics. The library's C++ linkage guards permit C++
consumers, but the implementation is compiled as C99.

These indexes describe codecs and static evidence, not an executable control
session. See the [cookbook](https://deancochran.github.io/ftms/integration/cookbook/index.md) for application responsibilities.
