This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

IOS bonding procedure?

I understand that in order to trigger bonding procedure you need to read/write a secure characteristic.

I am using the nRF Connect application on IPhone and trying to see when if a bonding passcode will pop-up when I read a characteristic.

For my nRF52 board I am trying to set up my own secure characteristic using :

    static uint32_t our_char_add(ble_os_t * p_our_service)
{   
	// Step 2.A 
	  uint32_t   err_code = 0;
   	ble_uuid_t          char_uuid;
    ble_uuid128_t       base_uuid = BLE_UUID_OUR_BASE_UUID;
    char_uuid.uuid      = BLE_UUID_OUR_CHARACTERISTC_UUID;
	  sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type);
    APP_ERROR_CHECK(err_code);
	
	// Step 2.B 
	ble_gatts_attr_md_t attr_md;
  memset(&attr_md, 0, sizeof(attr_md)); // bare minimum of what is needed to describe the attributes of the characteristic 
  attr_md.vloc   = BLE_GATTS_VLOC_STACK; // Storing the attributes in the Soft Device stack

And I know that ble_gatts_attr_md_t allows me to change permissions for the characteristic I think? So I was wondering how do I set a read/write permission for this characteristic??

Is it something like

ble_gatts_attr_md_t attr_md;
attr_md.rd_auth =  4; ??   /**< Read authorization and value will be requested from the application on every read operation. */

Am i doing this right?

Related