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

multilink central send byte packets

Hi, I use Multilink Central and Experimental_ble_app_blinky examples.

Multilink Central sends only 1 byte. I want to send more. Blinky does not work when I change the code. MultiLink will send 10 bytes and it will get Blinky.

What should I do?

Multilink Central Send Codes:

    uint32_t ble_lbs_led_status_send(ble_lbs_c_t * p_ble_lbs_c, uint8_t status)
{
VERIFY_PARAM_NOT_NULL(p_ble_lbs_c);

if (p_ble_lbs_c->conn_handle == BLE_CONN_HANDLE_INVALID)
{
    return NRF_ERROR_INVALID_STATE;
}

NRF_LOG_DEBUG("writing LED status 0x%x\r\n", status);

tx_message_t * p_msg;

p_msg              = &m_tx_buffer[m_tx_insert_index++];
m_tx_insert_index &= TX_BUFFER_MASK;

p_msg->req.write_req.gattc_params.handle   = p_ble_lbs_c->peer_lbs_db.led_handle;
p_msg->req.write_req.gattc_params.len      = 2; //I changed but not it work
p_msg->req.write_req.gattc_params.p_value  = p_msg->req.write_req.gattc_value;
p_msg->req.write_req.gattc_params.offset   = 0;
p_msg->req.write_req.gattc_params.write_op = BLE_GATT_OP_WRITE_CMD;
p_msg->req.write_req.gattc_value[0]        = status;
  p_msg->req.write_req.gattc_value[1]        = 0x66;
p_msg->conn_handle                         = p_ble_lbs_c->conn_handle;
p_msg->type                                = WRITE_REQ;

    tx_buffer_process();
    return NRF_SUCCESS;
}

Blinky Receive Codes:

  int debug;
static void on_write(ble_lbs_t * p_lbs, ble_evt_t * p_ble_evt)
{
	 debug=1;
    ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
    if ((p_evt_write->handle == p_lbs->led_char_handles.value_handle) &&
        (p_evt_write->len > 1) &&
        (p_lbs->led_write_handler != NULL))
    {

      p_lbs->led_write_handler(p_lbs, p_evt_write->data[0]);
    }			
 
    }
}

Thank You.

Related