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

nRF52832 to Linux L2CAP socket?

I'm trying to get an nRF52832 to connect to a Linux host with a BLE adapter.  The Linux host is listening for connections via an L2CAP socket, as in the (simplified) code below:

import bluetooth
import socket

# When the L2CAP layer should discard packets that couldn't be sent
L2CAP_PACKET_TIMEOUT_MS = 100

# Create L2CAP listening socket
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

# Bind the socket and accept an incoming connection
s.bind( (socket.BDADDR_ANY, self._port), )
connectionSocket, addr = s.accept()

# Set the L2CAP timeout to a relatively low value
bluetooth.set_packet_timeout(addr[0], L2CAP_PACKET_TIMEOUT_MS)

# Send sample data
connectionSocket.send(b'Testing')
response = connectionSocket.recv()

How can I get the Nordic radio to connect to this?  I'm using SoftDevice S132 7.0.1.

I looked through the examples, but most of the examples that connect to Linux require 6LoWPAN, which we do not want to use.  I also looked through the Nordic Q&A, but the closest answer I found was from several years ago and the response is out-of-date compared to the S132 API now.

Parents Reply Children
No Data
Related