[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bluetooth-dev] l2cap communication


  see apps/userstack/test.c for how to use the l2cap layer. the
functions you will need will look very similar to those (actually you
can almost use them straight away). here is what they do:

_ind and _cfm functions
"void test_init(void)" registers the functions (with the l2cap layer)
that deal with the indications and confirm messages (suffix _ind and
_cfm). these messages are passed from the stack to your application for
connection establishment and connection configuration. supply your own
functions here.

registering these functions is done for a specific psm (protocol service
multiplexor). test.c uses #define L2CAP_TEST_LAYER 7. in older versions,
the axis stack supported values of up to and including 7 (the spec
requires odd values of up to 2^16). 1, 3, 5 are used by the service
discovery protocol, rfcomm, and the telephony control protocol,

question to all: has that has changed in the latest version? 

_req functions
the _req functions (test_connect_req, test_disconnect_req) need to be
called by your application directly (as opposed to the stack).
test_connect_psmreq(...) is the function your app wants to call to
establish a connection for a specified psm . test_disconnect_req(...)
disconnects a previously established connection.

sending data
use test_send_data(...) to send data. the packets must not be larger
than the mtu (maximum transfer unit) negotiated during connection
establishment (test_config_ind/ _cfm, test_connect_ind/_cfm).

Walter wrote:
> Hello,
> I'm getting L2Cap and HCI out of the stack.
> This are the layers I will use.
> How is the communication to the L2Cap layer?
> I call L2CA_Connect_req on the master side and a connection will be
> esthablished..
> What functions do I have to call for data-transfer etc.

in test.c (test_send_data(...)) the function l2cap_send_data(...) is
used to send data.
imho, this function should be called l2ca_send_data(), that's without
the P, shouldn't it? when using l2cap directly, the app playes the role
of the upper layer protocol.

i am using l2cap layer directly as well. i have started to pull some
facts together, which i found interesting. see:
http://www.inf.ethz.ch/~kasten/research/bathtub/bluetooth/ but don't
expect them to be too helpful.


Oliver Kasten                                phone: +41/ 1/ 63-2 06 63
ETH-Zurich                                     fax: +41/ 1/ 63-2 16 59
Haldeneggsteig 4, IFW D48.1                  email: kasten@xxxxxxx.ch
CH-8092 Zuerich, Switzerland           http://www.inf.ethz.ch/~kasten/
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com