SPP with Legacy Paring and STATIC pin code
Posted: Sat Dec 01, 2018 2:53 am
I'm having a hard time coming up with a solution to this desired use case:
- BT Classic
- Legacy Pairing (NOT SSP)
- ESP has a static PIN for bt connections
- Phone scans and wishes to connect, provides with a static PIN when pairing
- ESP verifies PIN and pair occurs
- Then can proceed with SSP inti/accept
I understand pretty clearly the role of initiator and acceptor for spp. thats not really our issue at the moment.
Heres the kicker:
for BT classic:
Responding:
esp_bt_gap_set_pin()
- Used with a non esp32 legacy device to set a response to a legacy request w/fixed pin
in esp_bt_gap_cb
ESP_BT_GAP_PIN_REQ_EVT
esp_bt_gap_pin_reply()
- Used with a non esp32 legacy device to set a static response to a legacy request w/dynamic pin
Other similar functions:
esp_bt_gap_ssp_passkey_reply()
- Again, SSP so no go, but sends SSP key response
esp_bt_gap_ssp_confirm_reply()
- Allows you to confirm key with SSP
Then, looking around a bit more there exists a function to supply a static key for bluetooth LE:
uint32_t passkey = 123456;
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_STATIC_PASSKEY, &passkey, sizeof(uint32_t));
This is exactly what i want but for BT classic, not BLE.
Does this currently exist with the ESP bluedroid implementation?
You can clearly see where its implemented in bluedroid/esp_gap_ble_api.c
but nothing like that exists in bluedroid/esp_gap_bt_api.c
If its not available through bluedroid, is there another option to explore? How can i have a fixed pin code for classic pairing?
Don't want SSP and definitely don't want a "just works" scenario".
- BT Classic
- Legacy Pairing (NOT SSP)
- ESP has a static PIN for bt connections
- Phone scans and wishes to connect, provides with a static PIN when pairing
- ESP verifies PIN and pair occurs
- Then can proceed with SSP inti/accept
I understand pretty clearly the role of initiator and acceptor for spp. thats not really our issue at the moment.
Heres the kicker:
for BT classic:
Responding:
esp_bt_gap_set_pin()
- Used with a non esp32 legacy device to set a response to a legacy request w/fixed pin
in esp_bt_gap_cb
ESP_BT_GAP_PIN_REQ_EVT
esp_bt_gap_pin_reply()
- Used with a non esp32 legacy device to set a static response to a legacy request w/dynamic pin
Other similar functions:
esp_bt_gap_ssp_passkey_reply()
- Again, SSP so no go, but sends SSP key response
esp_bt_gap_ssp_confirm_reply()
- Allows you to confirm key with SSP
Then, looking around a bit more there exists a function to supply a static key for bluetooth LE:
uint32_t passkey = 123456;
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_STATIC_PASSKEY, &passkey, sizeof(uint32_t));
This is exactly what i want but for BT classic, not BLE.
Does this currently exist with the ESP bluedroid implementation?
You can clearly see where its implemented in bluedroid/esp_gap_ble_api.c
but nothing like that exists in bluedroid/esp_gap_bt_api.c
If its not available through bluedroid, is there another option to explore? How can i have a fixed pin code for classic pairing?
Don't want SSP and definitely don't want a "just works" scenario".