I am building a Central BLE app using the Rigado BMD-200 but my current peripherals are running RFDuino code. The peripherals all work with the IOS and Android Apps but I cannot get the RFDUINOs to respond to the BLE Central. I CAN connect to the RFDuinos successfully but CANNOT Send them data.
main.c can be viewed here: main.c
I am using the code below on the Central. I started with the HRS code and modified it for my purpose; primarily switching out the UUIDs to the RFDuino ones 0x2220. I believe that my connection handle and characteristic handles are valid. They are 0 and 15 respectively. I am trying to call our to the Peripheral from the hrs_c_evt_handler function by creating a simple function called SendCommndtoDevice(p_hrs_c); Code below:
/
**@brief Heart Rate Collector Handler.
*/
static void hrs_c_evt_handler(ble_hrs_c_t * p_hrs_c, ble_hrs_c_evt_t * p_hrs_c_evt)
{
uint32_t err_code;
switch (p_hrs_c_evt->evt_type)
{
case BLE_HRS_C_EVT_DISCOVERY_COMPLETE:
// Initiate bonding.
err_code = dm_security_setup_req(&m_dm_device_handle);
APP_ERROR_CHECK(err_code);
// Heart rate service discovered. Send Soft Button Command
err_code = SendCommndtoDevice(p_hrs_c);
//err_code = ble_hrs_c_hrm_notif_enable(p_hrs_c);
APP_ERROR_CHECK(err_code);
printf("QIQI-Heart rate service discovered \r\n");
break;
case BLE_HRS_C_EVT_HRM_NOTIFICATION:
{
APPL_LOG("[APPL]: HR Measurement received %d \r\n", p_hrs_c_evt->params.hrm.hr_value);
printf("Heart Rate = %d\r\n", p_hrs_c_evt->params.hrm.hr_value);
break;
}
default:
break;
}
}
static uint32_t SendCommndtoDevice(ble_hrs_c_t * p_ble_hrs_c)
{
uint32_t err_code;
ble_gattc_write_params_t write_params;
//printf("CCCD Handle = %d, Conn Handle = %d\r\n", handle_cccd, conn_handle);
printf("Transmit\n");
memset(&write_params, 0, sizeof(write_params));
write_params.write_op = BLE_GATT_OP_WRITE_CMD;
write_params.handle = p_ble_hrs_c->hrm_cccd_handle;
write_params.len = 0x05;
write_params.offset = 0;
write_params.p_value = soft_button_cmd;
err_code = sd_ble_gattc_write(p_ble_hrs_c->conn_handle, &write_params);
APP_ERROR_CHECK(err_code);
//printf("Error: %lu\n", err_code);
return err_code;
}
The RFDuino never receives the message and err_code = 0 every time. Is the RFDuino compatible with S120, S130?
Any insight would be appreciated.