HACK: auto-accept CFM pairing, and increase the connection timeout

This gets Tangara connecting to most non-trivial devices, including car
headunits and my laptop. We can add a real UI / better timeout handling
for this later (likely via a new BluetoothState?)
custom
jacqueline 1 year ago
parent 4cec85af2d
commit dd3346d381
  1. 7
      src/drivers/bluetooth.cpp

@ -515,7 +515,7 @@ static void timeoutCallback(TimerHandle_t) {
} }
void Connecting::entry() { void Connecting::entry() {
sTimeoutTimer = xTimerCreate("bt_timeout", pdMS_TO_TICKS(5000), false, NULL, sTimeoutTimer = xTimerCreate("bt_timeout", pdMS_TO_TICKS(15000), false, NULL,
timeoutCallback); timeoutCallback);
xTimerStart(sTimeoutTimer, portMAX_DELAY); xTimerStart(sTimeoutTimer, portMAX_DELAY);
@ -568,8 +568,9 @@ void Connecting::react(const events::internal::Gap& ev) {
transit<Idle>(); transit<Idle>();
break; break;
case ESP_BT_GAP_CFM_REQ_EVT: case ESP_BT_GAP_CFM_REQ_EVT:
ESP_LOGW(kTag, "user needs to do cfm. idk man."); // FIXME: Expose a UI for this instead of auto-accepting.
transit<Idle>(); ESP_LOGW(kTag, "CFM request, PIN is: %lu", ev.param->cfm_req.num_val);
esp_bt_gap_ssp_confirm_reply(ev.param->cfm_req.bda, true);
break; break;
case ESP_BT_GAP_KEY_NOTIF_EVT: case ESP_BT_GAP_KEY_NOTIF_EVT:
ESP_LOGW(kTag, "the device is telling us a password??"); ESP_LOGW(kTag, "the device is telling us a password??");

Loading…
Cancel
Save