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

Characteristics when connecting a peripheral to central

Hi, I have a peripheral device which has buttons that connects to a central device which is the NRF52 board. When the peripheral device is connected and buttons are inputted, the characteristics of the button are not displayed on the UART terminal when I press it. I was not sure why because I have the correct UUID and the RX and TX characteristics. I have implemented the UART example to the HRS example, but it was because I wanted to have the board act as both the central and the peripheral but connect to any or multiple peripheral. I know that inside the ble_nus_c_evt_handler() method there is ble_nus_c_rx_notif_enable(), but it does not work.

Here is my code so far. Please let me know if there are any errors.

gist.github.com/.../41be2f1584a462dd2c2971764595305f

Any help would be appreciated. Thanks.

Parents
  • Can't you just do something like this when you receive an advertising report:

        case BLE_GAP_EVT_ADV_REPORT:
        {
            const ble_gap_evt_adv_report_t * p_adv_report = &p_gap_evt->params.adv_report;
    
            if (is_uuid_present(&m_nus_uuid, p_adv_report))
            {
                err_code = sd_ble_gap_connect(&p_adv_report->peer_addr,
                                              &m_scan_params,
                                              &m_connection_param);
                APP_ERROR_CHECK(err_code);
            }
        }break;
    

    Instead of checking the name like you are doing now. I'm have trouble understand what the problem is, maybe I'm misunderstanding you?

Reply
  • Can't you just do something like this when you receive an advertising report:

        case BLE_GAP_EVT_ADV_REPORT:
        {
            const ble_gap_evt_adv_report_t * p_adv_report = &p_gap_evt->params.adv_report;
    
            if (is_uuid_present(&m_nus_uuid, p_adv_report))
            {
                err_code = sd_ble_gap_connect(&p_adv_report->peer_addr,
                                              &m_scan_params,
                                              &m_connection_param);
                APP_ERROR_CHECK(err_code);
            }
        }break;
    

    Instead of checking the name like you are doing now. I'm have trouble understand what the problem is, maybe I'm misunderstanding you?

Children
No Data
Related