Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/ble/hal/blercu/blercucontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ bool BleRcuControllerImpl::startPairingAutoWithTimeout(int timeoutMs)
{
m_ignorePairingFailure = false;

if (m_config->modelSettings().empty()) {
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfigSettings::modelSettings() returns the vector by value, so calling m_config->modelSettings().empty() copies the entire model list just to check emptiness. If this path can be hit repeatedly, consider caching the returned vector in a local variable (or adding a cheap hasModelSettings() / const-ref accessor on ConfigSettings).

Copilot uses AI. Check for mistakes.
m_lastError = BleRcuError(BleRcuError::General, "No BLE RCU models configured");
XLOGD_WARN("cannot start BLE auto pairing - no RCU models configured");
return false;
}
Comment on lines +203 to +207
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This guard only checks whether modelSettings() is empty, but "no supported models" can also occur when the config contains only disabled models (see ConfigModelSettings::disabled() and the pairing state machine filtering out disabled models). In that case auto-pairing would still start with an empty supported-name list. Consider checking for at least one enabled model (e.g., any_of(models, !disabled)) and failing if none are enabled.

Copilot uses AI. Check for mistakes.

// check we're not currently pairing
if (m_pairingStateMachine.isRunning()) {
m_lastError = BleRcuError(BleRcuError::General, "currently performing pairing, cannot start new scan");
Comment on lines +203 to 211
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new early-return runs before the existing m_pairingStateMachine.isRunning() check. If auto-pair is requested while another pairing operation is already running, callers will now see a config error instead of the expected "busy" error. Consider keeping the busy check first (or otherwise ensuring the reported error prioritizes the in-progress operation).

Copilot uses AI. Check for mistakes.
Expand Down