Hello all,
I am trying to get a communication between the nRF8001 and the nRF51822 using the UART service. The nRF8001 is connected to an Arduino and is working fine. I checked this with the nRF UART v2.0 app. The communication from the nRF51822 to the nRF8001 is however not working.
I think there might be a problem with the db_discovery_evt_handler function as i implemented it. This is teh function that searches for the characteristic, but the UART service has two characteristics.
The code for the discovery of the characteristics is below. Is this implementation correct?
static void db_discovery_evt_handler(ble_db_discovery_evt_t * p_evt)
{
// Find the client using the connection handle.
client_t * p_client;
uint32_t index;
bool is_valid_srv_found = false;
index = client_find(p_evt->conn_handle);
p_client = &m_client[index];
if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE)
{
uint8_t i;
for (i = 0; i < p_evt->params.discovered_db.char_count; i++)
{
ble_db_discovery_char_t * p_characteristic;
p_characteristic = &(p_evt->params.discovered_db.charateristics[i]);
if ((p_characteristic->characteristic.uuid.uuid == MULTILINK_PERIPHERAL_RX_CHARACTERISTIC_UUID)
&&
(p_characteristic->characteristic.uuid.type == m_base_uuid_type))
{
p_client->char_index = i;
is_valid_srv_found = true;
}
if ((p_characteristic->characteristic.uuid.uuid == MULTILINK_PERIPHERAL_TX_CHARACTERISTIC_UUID)
&&
(p_characteristic->characteristic.uuid.type == m_base_uuid_type))
{
p_client->char_index = i;
is_valid_srv_found = true;
}
}
}
if (is_valid_srv_found)
{
// Enable notification.
notif_enable(p_client);
}
else
{
p_client->state = STATE_ERROR;
}
}