Page 1 of 1

Calling esp_spp_write outside of bluedriod callbacks

Posted: Wed Jan 19, 2022 7:55 am
by grumpyEngineer12
Hi Everyone,

I'm sorry if this has been answered previously - but I just want to verify some code I wrote today.

I am extending the SPP acceptor demo (Classic bluetooth) and I need to trigger writes to the BLE client (on a phone) from a different task.

What I did was save a reference to the handle inside off the ESP_SPP_SRV_OPEN_EVT callback. My question is, will this handle ever change? In that case I would be SOL - I'm only familiar w/ BLE so I'm a little lost.

Code: Select all

   
    case ESP_SPP_SRV_OPEN_EVT:
        handle = param->open.handle;
        ESP_LOGI(SPP_TAG, "ESP_SPP_SRV_OPEN_EVT");
I'm cleaning up in the ESP_SPP_SRV_STOP_EVT (removing the handle) - this is for the tear-down.

Thanks everyone!