SBCL Common Lisp implementation on Linux and Windows.
(asdf:load-system :sb-bluetooth)
(sb-bluetooth:open-rfcomm-channel "de:ad:be:af:00:01" 12)
In the example above, connection is opened using an RFCOMM channel number, and the device address designator is a string.
Device address can also be given as a sequence of octets:
(sb-bluetooth:open-rfcomm-channel #(1 2 3 4 5 6) 12)
MS Windows may find appropriate RFCOMM channel for a specific service in target device’s SDP database:
#+(win32) (sb-bluetooth:open-rfcomm-channel "de:ad:be:af:00:01" :obex-object-push)
:OBEX-OBJECT-PUSH
is resolved into appropriate UUID. The latter could
be given in one of the following forms as well:
"00001105,0000,1000,80,00,00,80,5F,9B,34,FB" ; string #(#x5 #x11 #x0 #x0 #x0 #x0 #x0 #x10 #x80 #x0 #x0 #x80 #x5F #x9B #x34 #xFB) ; octet sequence
On Linux, use sdptool to find out RFCOMM channel numbers supported by your device.
:dialup-networking, :dun
- modem connection for data calls
:serial-port
- generic serial port communication
:obex-object-push
- OBEX for PUSH object transfer (PC->device)
:obex-file-transfer
- OBEX protocol for FS access
It’s possible to define more UUID designators using
(DEF-BLUETOOTH-SERVICE-CLASS)
macro. See early-uuid.lisp for an
example.
Socket object may be created without immediate connection:
(sb-bluetooth:make-bluetooth-socket)
Miscellaneous facilities of SB-BSD-SOCKET should be used for other operations on resulting socket object.