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

Specify Port for L2CAP Communication

Hi all,

I am trying to specify a fixed port for a L2CAP connection on the nRF51822. The client is a Linux box running bluez (which has BLE support). The client software is designed in Qt, which exposes the underlying bluetooth in a cross platform way.

My goal is to set up a L2CAP connection to send and receive data since Qt does not have full BLE support yet but does have L2CAP which, for my application, is more suitable as it is not a traditional BLE sensor app.

So far I can:

  1. Send L2CAP data to the Master Control using example code Ole graciously gave to me. The data shows up in the Log file correctly.
  2. Scan and identify the nRF51822 using Qt API calls.

What I am unsure about is how to specify a fixed L2CAP port number on the nRF51822 side to establish communication.

Thanks in advance,

Nick

Parents
  • There is one way that you can send data on other L2CAP CID's (as long as they are greater than BLE_L2CAP_CID_DYN_BASE) and you cannot have more than 8 custom CID Channels

    uint32_t sd_ble_l2cap_cid_register(uint16_t cid)
    
    uint32_t sd_ble_l2cap_tx ( uint16_t conn_handle,
        ble_l2cap_header_t const *const p_header,
        uint8_t const *const p_data
    )
    
    

    When you send something with sd_ble_l2cap_tx, then you will receive a BLE_EVT_TX_COMPLEPLETE when the packet is received by the peer, and a BLE_L2CAP_EVT_RX when you receive something on that CID from the peer.

Reply
  • There is one way that you can send data on other L2CAP CID's (as long as they are greater than BLE_L2CAP_CID_DYN_BASE) and you cannot have more than 8 custom CID Channels

    uint32_t sd_ble_l2cap_cid_register(uint16_t cid)
    
    uint32_t sd_ble_l2cap_tx ( uint16_t conn_handle,
        ble_l2cap_header_t const *const p_header,
        uint8_t const *const p_data
    )
    
    

    When you send something with sd_ble_l2cap_tx, then you will receive a BLE_EVT_TX_COMPLEPLETE when the packet is received by the peer, and a BLE_L2CAP_EVT_RX when you receive something on that CID from the peer.

Children
No Data
Related