Check whether AF_BLUETOOTH sockets are supported on this host.
()
| 169 | |
| 170 | |
| 171 | def _have_socket_bluetooth(): |
| 172 | """Check whether AF_BLUETOOTH sockets are supported on this host.""" |
| 173 | try: |
| 174 | # RFCOMM is supported by all platforms with bluetooth support. Windows |
| 175 | # does not support omitting the protocol. |
| 176 | s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) |
| 177 | except (AttributeError, OSError): |
| 178 | return False |
| 179 | else: |
| 180 | s.close() |
| 181 | return True |
| 182 | |
| 183 | |
| 184 | def _have_socket_bluetooth_l2cap(): |
no test coverage detected