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

multilink send data

Hi, I used the ble_peripheral and ble_central example and I send messages from one to the other.

Know I need to do the same with multilink. I managed to connect ble_multilink_central with a ble_uart but I can't see the messages I send.

should I use NUS functions in multilink_central to receive data ?

I use nRF51 dongle as central, and nRF52 as peripheral.

Any help would be appreciated!

  • to be more precise : I send data with this :

    le_gatts_hvx_params_t params;
    static uint8_t test[2] = {0x24, 0x33};
    static uint16_t testLen = 2;
    memset(&params, 0, sizeof(params));
    params.type = BLE_GATT_HVX_NOTIFICATION;
    params.handle = m_lbs.button_char_handles.value_handle;
    params.offset = 0;
    //params.p_data = test;
    params.p_data = (uint8_t*)(&test[0]);
    params.p_len = &testLen;
    sd_ble_gatts_hvx(m_lbs.conn_handle, &params);
    

    and I try to receive data with this :

        static void lbs_c_evt_handler(ble_lbs_c_t * p_lbs_c, ble_lbs_c_evt_t * p_lbs_c_evt)
     {
        const uint16_t conn_handle = p_lbs_c_evt->conn_handle;
        switch (p_lbs_c_evt->evt_type)
        {
        case BLE_LBS_C_EVT_DISCOVERY_COMPLETE:
        {
            ret_code_t err_code;
    
            NRF_LOG_PRINTF("[APP]: LED Button service discovered on conn_handle 0x%x\r\n", 
                            conn_handle);
            
            err_code = app_button_enable();
            APP_ERROR_CHECK(err_code);
    
            // LED Button service discovered. Enable notification of Button.
            err_code = ble_lbs_c_button_notif_enable(p_lbs_c);
            APP_ERROR_CHECK(err_code);
        } break; // BLE_LBS_C_EVT_DISCOVERY_COMPLETE
    
        case BLE_LBS_C_EVT_BUTTON_NOTIFICATION:
        {
            NRF_LOG_PRINTF("[APP]: Link 0x%x, Button state changed on peer to 0x%x\r\n",//   0x%x
                           conn_handle,
                           p_lbs_c_evt->params.button.button_state);//,
    					   //&(p_lbs_c_evt->params.button).button_state+1);
            if (p_lbs_c_evt->params.button.button_state)
            {
                LEDS_ON(LEDBUTTON_LED);
            }
            else
            {
                LEDS_OFF(LEDBUTTON_LED);
            }
        } break; // BLE_LBS_C_EVT_BUTTON_NOTIFICATION
    
        default:
            // No implementation needed.
            break;
    }
    

    }

    I managed to send one byte, but when I change it to an array I get a very strange behaviour, and it print the data I sent last time.

  • Why have you added this as an answer? Just edit your question and add it there.

Related