Use moto_terminal_report_state for a complete snapshot sampled from the vehicle controller and moto_terminal_report_fault for fault events. Complete first adding and primary connection and enable the corresponding reporting capabilities in the model.
Report battery and mileage
Read the vehicle and submit its complete current state. Replace the two variables below with your measured values:
moto_vehicle_state state = {0};
state.present = MOTO_CAP(MOTO_BATTERY) | MOTO_CAP(MOTO_MILEAGE);
state.values[MOTO_BATTERY] = actual_soc_percent; // percent
state.values[MOTO_MILEAGE] = actual_total_metres; // metres
moto_result rc = moto_terminal_report_state(terminal, &state);
present: fields included in this report.values: values for those fields.unknown: included fields whose readings are unavailable; these must also be inpresent.
A snapshot replaces previously cached state; it is not a patch. The battery/mileage-only example is insufficient for a product also reporting lock or power. Include all integrated fields in one sample.
For an unavailable battery reading, set state.unknown |= MOTO_CAP(MOTO_BATTERY) while retaining its present bit. Do not report 0, which means empty. The SDK maintains the state revision automatically.
Lock and power state
The state has 13 fields. Lock and power must reflect the controller’s observed state:
| Field | Meaning |
|---|---|
field 3, MOTO_LOCK |
Actual lock state shared by manual and proximity unlock; drives the home-screen lock icon |
field 11, MOTO_RANGE_METRES |
Remaining range in metres, not proximity state |
field 12, MOTO_POWER |
0 off, 1 on; mark unknown if unavailable |
To include power, add MOTO_CAP(MOTO_POWER) to the full report and populate state.values[MOTO_POWER]. Command completion and telemetry are separate: a successful send does not establish observed state.
Report a vehicle fault
Call moto_terminal_report_fault(t, id, active, module, code, severity):
| Argument | Value |
|---|---|
id |
Nonzero fault ID; keep the same ID when retrying the same fault |
active |
true when raised, false when cleared |
module / code |
Module name and manufacturer fault code, such as a battery fault |
severity |
Severity level, from 0 to 3 |
Retain and retry state and fault reports on MOTO_FULL. See the API reference for return values.
