Skip to contentSkip to conversation

does bluez support dynamic psm for l2cap?

Bluez-devel Albert Huang 1 participant 1 message May 12, 2004 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

I want a simple client/server that operates as follows.

server listens for l2cap connections. accepts a connection, does something with it.

client discovers server by entering inquiry mode and then checking SDP records for service id of the server.

I don't want to hard-code the l2cap psm, as that seems like it defeats half the point of SDP, but I can't figure out how to request a dynamic psm. I want to be able to do somethiing like this:

int s;
struct sockaddr_l2 s_addr;
s = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);

s_addr.l2_family = AF_BLUETOOTH;
bacopy( &s_addr.l2_bdaddr, BDADDR_ANY );
s_addr.l2_psm = L2CAP_PSM_ANY;

bind(s, (struct sockaddr *)&s_addr, sizeof(s_addr) );

struct sockaddr_l2 local_addr;
struct socklen_t addr_len = sizeof(local_addr); getsockname( s, (struct sockaddr *)&local_addr, &addr_len); int psm = btohs( local_addr.l2_psm );

// register service with SDP using dynamic psm

Is this possible with bluez? Or do I have to do the ugly thing and pick an arbitrary psm?

thanks!
-albert

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel