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

Speed up DB Discovery

Hi,

I have a device in the central role that connects to a device with a specific name. I then do a db_discovery_start to get the handles of two of the characteristics. However, it takes a while for the BLE_DB_DISCOVERY_COMPLETE to be triggered (approx 750 - 1000ms). Is there anyway I can speed this up, or get rid of db_discovery altogether? Some additional points:

  • I know the UUID of the characteristics
  • I know the properties of the characteristic
  • I will only ever connect to a device with these characteristics (if I do connect to a device without these characteristics I am happy for an error to be thrown and a reset triggered)

I am using:

  • nRF52832
  • S132 v4.0.2
  • SDK13

My current ble_db_discovery_evt_handler() code is below:

static void ble_db_discovery_evt_handler(ble_db_discovery_evt_t *p_evt)
{
	ble_gatt_db_char_t * p_chars = p_evt->params.discovered_db.charateristics;
	uint8_t second_handle;
	if(p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE)
	{
		if(p_evt->params.discovered_db.srv_uuid.uuid == BLE_UNIQUE_SERVICE_UUID)
		{
			NRF_LOG_INFO("Found Service \r\n");
			for (uint32_t i = 0; i < p_evt->params.discovered_db.char_count; i++)
			{
				switch(p_chars[i].characteristic.uuid.uuid)
				{
					case FIRST_CHARACTERISTC_UUID:
						first_handle = p_chars[i].characteristic.handle_value;
					break;
					case SECOND_CHARACTERISTC_UUID:
						second_handle = p_chars[i].characteristic.handle_value;
					break;
					default:
					break;
						
				}
			}
			sd_ble_gattc_read(p_evt->conn_handle, second_handle, 0);
		}
	}
	else
	{
		ble_db_discovery_start(&m_ble_db_discovery[p_evt->conn_handle], p_evt->conn_handle);
		NRF_LOG_WARNING("No DB Discovered: %d \r\n", p_evt->evt_type);
	}
}

Thanks in advance,

Related