Page 1 of 1

What is the use of esp_gatt_if_t?

Posted: Sun Jan 14, 2018 1:48 pm
by spazmo
I am working on a BLE client and I see function esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, bool is_direct) suceeds only with gattc_if = 0x03.

I tried finding relevant documentation and walking through the forums and found nothing definite.

My asumption is esp_gatt_if_t gattc_if has got to do with BLE addressing.

The reason being, my server is set with a Random Static Address, but in that light gattc_if = 0x01 should have worked

Code: Select all

typedef enum {
    BLE_ADDR_TYPE_PUBLIC        = 0x00,
    BLE_ADDR_TYPE_RANDOM        = 0x01,
    BLE_ADDR_TYPE_RPA_PUBLIC    = 0x02,
    BLE_ADDR_TYPE_RPA_RANDOM    = 0x03,
} esp_ble_addr_type_t;
What confuses me further is that we use different parameters for gattc_app_register/unregister

Code: Select all

esp_err_t esp_ble_gattc_app_register(uint16_t app_id);
esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if);
In btc_ble_gattc_args_t we store two different types for register and unregister

Code: Select all

    //BTC_GATTC_ACT_APP_REGISTER,
    struct app_reg_arg {
        uint16_t app_id;
    } app_reg;
    //BTC_GATTC_ACT_APP_UNREGISTER,
    struct app_unreg_arg {
        esp_gatt_if_t gattc_if;
    } app_unreg;
To sum it up. What is gattc_if?

Thank you so much

Re: What is the use of esp_gatt_if_t?

Posted: Tue Jul 03, 2018 8:39 am
by boyanatmage
GATT(S)_IF stands for GATT Interface Type. Different GATT clients will use different GATT interfaces, and its ID is passed to the registered callback. Documentation about this is still fairly murky.