4.1.1. BluetoothSocket¶
Todo
Add documentation for the BluetoothSocket methods.
-
class
bluetooth.
BluetoothSocket
(proto=<sphinx.ext.autodoc.importer._MockObject object>, _sock=None)¶ Bases:
object
A Bluetooth Socket representing one endpoint of a Bluetooth connection.
Parameters: proto (int) – The protocol the socket will use. The options are HCI, L2CAP, RFCOMM, or SCO. The default is RFCOMM.
Note
RFCOMM is the only protocol available for Windows and macOS systems.
-
accept
()¶ Accept a connection.
Returns: A tuple containing a BluetoothSocket
and a Bluetooth address.Return type: tuple Raises: BluetoothError
– When an attempt to accept a connection fails.
-
bind
(addrport)¶ Bind the socket to a local address and port.
Parameters: addrport (tuple) – A tuple of the form (address str, port int) Raises: BluetoothError
– When an attempt to bind the socket fails.
-
close
(*args, **kwargs)¶
-
connect
(*args, **kwargs)¶
-
connect_ex
(*args, **kwargs)¶
-
dup
()¶ Duplicate the socket
Returns: A new BluetoothSocket
connected to the same system resource.Return type: BluetoothSocket
-
family
¶
-
fileno
(*args, **kwargs)¶
-
get_l2cap_options
(sock, mtu)¶ Gets L2CAP options for the specified L2CAP socket. Options are: omtu, imtu, flush_to, mode, fcs, max_tx, txwin_size.
-
getpeername
(*args, **kwargs)¶
-
getsockname
(*args, **kwargs)¶
-
getsockopt
(*args, **kwargs)¶
-
gettimeout
(*args, **kwargs)¶
-
listen
(*args, **kwargs)¶
-
makefile
(*args, **kwargs)¶
-
proto
¶
-
recv
(*args, **kwargs)¶
-
recvfrom
(*args, **kwargs)¶
-
send
(*args, **kwargs)¶
-
sendall
(*args, **kwargs)¶
-
sendto
(*args, **kwargs)¶
-
set_l2cap_mtu
(sock, mtu)¶ Adjusts the MTU for the specified L2CAP socket. This method needs to be invoked on both sides of the connection for it to work! The default mtu that all L2CAP connections start with is 672 bytes.
mtu must be between 48 and 65535, inclusive.
-
set_l2cap_options
(sock, options)¶ Sets L2CAP options for the specified L2CAP socket. The option list must be in the same format supplied by get_l2cap_options().
-
setblocking
(*args, **kwargs)¶
-
setl2capsecurity
(*args, **kwargs)¶
-
setsockopt
(*args, **kwargs)¶
-
settimeout
(*args, **kwargs)¶
-
shutdown
(*args, **kwargs)¶
-
timeout
¶
-
type
¶
-