ble_app_lecb L2CAP application can’t handle different src and dest cids

ID: LPCBARESDK-1056

Status: Fixed

First reported: 6.0.22.1401

Fixed in: 6.0.24.1464

Description

The ble_app_lecb application 6.0.22.1401\projects\target_apps\misc\ble_app_lecb demonstrates Bluetooth LE Credit-Based Flow Control for L2CAP Connection-Oriented Channels. For more details about connected oriented channel, refer to BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 3, Part A page 1164.

This application implements a dummy data exchange scenario between two peers in loopback mode. Hence, same src and dest numbers are used. It cannot be used for the reported scenario. This is an application issue (not in the SDK) and occurs at user_app_lecb_data_recv_ind( ) function where the src is used to send instead of dest.

void user_app_lecb_data_recv_ind(uint8_t conidx,
                                 struct l2cc_lecnx_data_recv_ind const *param)
{
    user_lecb_conn.src_credits = param->src_credit;
    arch_printf(" \r\n Received message: %d", param->data);
    app_lecb_send_sdu(conidx, param->src_cid, sizeof(test_string), test_string);
    arch_printf(" \r\n Send message: %s", test_string);
}

Workaround

User must use param->dest_cid:

void user_app_lecb_data_recv_ind(uint8_t conidx,
                                 struct l2cc_lecnx_data_recv_ind const *param)
{
    user_lecb_conn.src_credits = param->src_credit;
    arch_printf(" \r\n Received message: %d", param->data);
    app_lecb_send_sdu(conidx, param->dest_cid, sizeof(test_string), test_string);
    arch_printf(" \r\n Send message: %s", test_string);
}