This patch changes the address format used for
Bluetooth addresses from a tuple of six numbers into a
string of the form "XX:XX:XX:XX:XX:XX", as is more
commonly seen elsewhere. I've also extended
makesockaddr so that it returns a Python object of the
type expected by bind, connect, etc, when given a
Bluetooth address struct.
A full summary of the changes to socketmodule.c:
* Added setbdaddr and makebdaddr (conditional on the
definition of USE_BLUETOOTH), which work a bit like
setipaddr and makeipaddr.
* Extended makesockaddr to understand Bluetooth
addresses, and added a proto argument to distinguish
between the protocols.
* Changed getsockaddr to expect the Bluetooth
addresses as a string, not a six element tuple.
* Changed the BDADDR_ANY and BDADDR_LOCAL constants to
strings.
* Reformatted some of the Bluetooth code to be more
consistent with PEP 7.
I have only tested this patch under Linux, but I've
tried to follow the changes introduced by patch #888148
so it should also work under FreeBSD.
|