Use the managed FreeRTOS interface for call state, answer, reject and hang-up actions. Implement HFP or the agreed call driver on your target hardware before declaring call support.
Call controls and audio
Confirm the Bluetooth chip, audio stack and HFP driver first. The P4+C6 reference application has no HFP integration and keeps calls disabled. BLE alone does not provide hands-free audio. The primary Wi-Fi connection carries controls and state. A separate Wi-Fi audio channel can carry permitted playback capture, but does not provide HFP calls. See audio integration for A2DP, Wi-Fi audio and capture boundaries.
Managed applications with an implemented call driver may enable c.calls=true and use:
| Direction | API |
|---|---|
| Driver reports new state | moto_terminal_report_call(t, call_id, state, actions) |
| User acts on a valid call | moto_terminal_call_action(t, &saved_call_event, action) |
Receive MOTO_EVENT_CALL_ACTION |
Execute once through the driver; report with moto_terminal_complete and the original event |
call_id is nonzero. States: 0 unknown, 1 ringing, 2 active, 3 held, 4 ended. The allowed-action mask uses 1 answer, 2 reject, 4 hang up; an individual action uses 0 answer, 1 reject, 2 hang up. Unknown/ended states have no allowed actions. Remove buttons when data.call.valid=false. Update the UI from subsequent observed driver state.
Call audio plays through the phone, helmet or an integrated Bluetooth audio device. Keep phone numbers out of ordinary logs.
From observed driver state to the APP
Call this function after the real HFP driver confirms state. For ringing, use the driver’s nonzero call_id, state 1 and action mask 3 (answer or reject). For ended, use the same ID, state 4 and mask 0.
Check the result. On a full queue, retain the pending snapshot for retry. Execute an incoming action once and follow the completion rules. Preserve the observed driver state when execution fails.
#include <moto_freertos/terminal.h>
moto_result report_observed_call(moto_terminal *terminal,
uint64_t call_id, uint32_t state,
uint32_t allowed_actions) {
return moto_terminal_report_call(terminal, call_id,
state, allowed_actions);
}
