Skip to content

bluetooth

Class info

Classes

Name Children Inherits
BluetoothAddress
prettyqt.bluetooth.bluetoothaddress
Assigns an address to the Bluetooth device.
    BluetoothDeviceDiscoveryAgent
    prettyqt.bluetooth.bluetoothdevicediscoveryagent
    Discovers the Bluetooth devices nearby.
      BluetoothDeviceInfo
      prettyqt.bluetooth.bluetoothdeviceinfo
      Stores information about the Bluetooth device.
        BluetoothHostInfo
        prettyqt.bluetooth.bluetoothhostinfo
        Encapsulates the details of a local QBluetooth device.
          BluetoothLocalDevice
          prettyqt.bluetooth.bluetoothlocaldevice
          Enables access to the local Bluetooth device.
            BluetoothServer
            prettyqt.bluetooth.bluetoothserver
            Uses the RFCOMM or L2cap protocol to communicate with a Bluetooth device.
              BluetoothServiceDiscoveryAgent
              prettyqt.bluetooth.bluetoothservicediscoveryagent
              Enables you to query for Bluetooth services.
                BluetoothServiceInfo
                prettyqt.bluetooth.bluetoothserviceinfo
                Enables access to the attributes of a Bluetooth service.
                  BluetoothSocket
                  prettyqt.bluetooth.bluetoothsocket
                  Enables connection to a Bluetooth device running a bluetooth server.
                    BluetoothUuid
                    prettyqt.bluetooth.bluetoothuuid
                    Generates a UUID for each Bluetooth service.

                      🛈 DocStrings

                      Provides access to Bluetooth hardware.

                      BluetoothAddress

                      Bases: QBluetoothAddress

                      Assigns an address to the Bluetooth device.

                      Source code in prettyqt/bluetooth/bluetoothaddress.py
                      class BluetoothAddress(QtBluetooth.QBluetoothAddress):
                          """Assigns an address to the Bluetooth device."""
                      
                          def __repr__(self):
                              return get_repr(self, self.toString())
                      
                          def __str__(self):
                              return self.toString()
                      
                          def __bool__(self):
                              """True when address is not null."""
                              return not self.isNull()
                      

                      __bool__()

                      True when address is not null.

                      Source code in prettyqt/bluetooth/bluetoothaddress.py
                      def __bool__(self):
                          """True when address is not null."""
                          return not self.isNull()
                      

                      BluetoothDeviceDiscoveryAgent

                      Bases: ObjectMixin, QBluetoothDeviceDiscoveryAgent

                      Discovers the Bluetooth devices nearby.

                      Source code in prettyqt/bluetooth/bluetoothdevicediscoveryagent.py
                      class BluetoothDeviceDiscoveryAgent(
                          core.ObjectMixin, bluetooth.QBluetoothDeviceDiscoveryAgent
                      ):
                          """Discovers the Bluetooth devices nearby."""
                      
                          device_discovered = core.Signal(object)  # bluetooth.BluetoothDeviceInfo casts signal.
                      
                          def __init__(self, *args, **kwargs):
                              super().__init__(*args, **kwargs)
                              self.deviceDiscovered.connect(self._on_device_discovered)
                      
                          def _on_device_discovered(self, info):
                              info = bluetooth.BluetoothDeviceInfo(info)
                              self.device_discovered.emit(info)
                      
                          # def set_inquiry_type(self, typ: InquiryTypeStr):
                          #     """Set inquiry type.
                      
                          #     Args:
                          #         typ: inquiry type
                          #     """
                          #     self.setInquiryType(INQUIRY_TYPES.get_enum_value(typ))
                      
                          # def get_inquiry_type(self) -> InquiryTypeStr:
                          #     """Get the current inquiry type.
                      
                          #     Returns:
                          #         inquiry type
                          #     """
                          #     return INQUIRY_TYPES.inverse[self.inquiryType()]
                      
                          def start_discovery(self, classic: bool = True, low_energy: bool = True):
                              """Start discovery of bluetooth devices.
                      
                              Arguments:
                                  classic: use classic method
                                  low_energy: use BLE mode
                              """
                              method = bluetooth.QBluetoothDeviceDiscoveryAgent.DiscoveryMethod
                              flag = method.NoMethod
                              if classic:
                                  flag |= method.ClassicMethod
                              if low_energy:
                                  flag |= method.LowEnergyMethod
                              self.start(flag)
                      
                          def get_error(self) -> ErrorStr:
                              """Get error type if available."""
                              return ERROR.inverse[self.error()]
                      
                          def get_supported_discovery_methods(self) -> list[DiscoveryMethodStr]:
                              """Return a list of supported discovery methods."""
                              return DISCOVERY_METHODS.get_list(self.supportedDiscoveryMethods())
                      

                      get_error() -> ErrorStr

                      Get error type if available.

                      Source code in prettyqt/bluetooth/bluetoothdevicediscoveryagent.py
                      def get_error(self) -> ErrorStr:
                          """Get error type if available."""
                          return ERROR.inverse[self.error()]
                      

                      get_supported_discovery_methods() -> list[DiscoveryMethodStr]

                      Return a list of supported discovery methods.

                      Source code in prettyqt/bluetooth/bluetoothdevicediscoveryagent.py
                      def get_supported_discovery_methods(self) -> list[DiscoveryMethodStr]:
                          """Return a list of supported discovery methods."""
                          return DISCOVERY_METHODS.get_list(self.supportedDiscoveryMethods())
                      

                      start_discovery(classic: bool = True, low_energy: bool = True)

                      Start discovery of bluetooth devices.

                      Parameters:

                      Name Type Description Default
                      classic bool

                      use classic method

                      True
                      low_energy bool

                      use BLE mode

                      True
                      Source code in prettyqt/bluetooth/bluetoothdevicediscoveryagent.py
                      def start_discovery(self, classic: bool = True, low_energy: bool = True):
                          """Start discovery of bluetooth devices.
                      
                          Arguments:
                              classic: use classic method
                              low_energy: use BLE mode
                          """
                          method = bluetooth.QBluetoothDeviceDiscoveryAgent.DiscoveryMethod
                          flag = method.NoMethod
                          if classic:
                              flag |= method.ClassicMethod
                          if low_energy:
                              flag |= method.LowEnergyMethod
                          self.start(flag)
                      

                      BluetoothDeviceInfo

                      Bases: QBluetoothDeviceInfo

                      Stores information about the Bluetooth device.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      class BluetoothDeviceInfo(bluetooth.QBluetoothDeviceInfo):
                          """Stores information about the Bluetooth device."""
                      
                          def __repr__(self):
                              return get_repr(self, self.get_address(), self.name())
                      
                          def __bool__(self):
                              """Return true if device info is valid."""
                              return self.isValid()
                      
                          def get_address(self) -> bluetooth.BluetoothAddress:
                              """Get bluetooth address."""
                              return bluetooth.BluetoothAddress(self.address())
                      
                          def get_device_uuid(self) -> bluetooth.BluetoothUuid:
                              """Get the device's UUID (Qt 6 has a single deviceUuid())."""
                              return bluetooth.BluetoothUuid(self.deviceUuid())
                      
                          def get_service_ids(self) -> list[bluetooth.BluetoothUuid]:
                              """Get list of service ids."""
                              return [bluetooth.BluetoothUuid(i) for i in self.serviceIds()]
                      
                          def get_service_uuids(self) -> list[bluetooth.BluetoothUuid]:
                              """Get list of service UUIDs."""
                              return [bluetooth.BluetoothUuid(i) for i in self.serviceUuids()]
                      
                          def get_major_device_class(self) -> MajorDeviceClassStr:
                              """Get major device class."""
                              return MAJOR_DEVICE_CLASS.inverse[self.majorDeviceClass()]
                      
                          def get_minor_device_class(self) -> str:  # noqa: PLR0911
                              """Get minor device class."""
                              major = self.get_major_device_class()
                              match major:
                                  case "computer":
                                      flag = mod.MinorComputerClass(self.minorDeviceClass())
                                      return MINOR_COMPUTER_CLASS.inverse[flag]
                                  case "phone":
                                      flag = mod.MinorPhoneClass(self.minorDeviceClass())
                                      return MINOR_PHONE_CLASS.inverse[flag]
                                  case "network":
                                      flag = mod.MinorNetworkClass(self.minorDeviceClass())
                                      return MINOR_NETWORK_CLASS.inverse[flag]
                                  case "audio_video":
                                      flag = mod.MinorAudioVideoClass(self.minorDeviceClass())
                                      return MINOR_AUDIO_VIDEO_CLASS.inverse[flag]
                                  case "peripheral":
                                      flag = mod.MinorPeripheralClass(self.minorDeviceClass())
                                      return MINOR_PERIPHERAL_CLASS.inverse[flag]
                                  case "imaging":
                                      flag = mod.MinorImagingClass(self.minorDeviceClass())
                                      return MINOR_IMAGING_CLASS.inverse[flag]
                                  case "wearable":
                                      flag = mod.MinorWearableClass(self.minorDeviceClass())
                                      return MINOR_WEARABLE_CLASS.inverse[flag]
                                  case "toy":
                                      flag = mod.MinorToyClass(self.minorDeviceClass())
                                      return MINOR_TOY_CLASS.inverse[flag]
                                  case "health":
                                      flag = mod.MinorHealthClass(self.minorDeviceClass())
                                      return MINOR_HEALTH_CLASS.inverse[flag]
                                  case "miscellaneous":
                                      return "uncategorized"
                                  case "uncategorized":
                                      return "misc"
                                  case _:
                                      raise ValueError(major)
                      
                          def get_service_classes(self) -> list[ServiceClassStr]:
                              """Get list of service classes."""
                              return SERVICE_CLASS.get_list(self.serviceClasses())
                      

                      __bool__()

                      Return true if device info is valid.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def __bool__(self):
                          """Return true if device info is valid."""
                          return self.isValid()
                      

                      get_address() -> bluetooth.BluetoothAddress

                      Get bluetooth address.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def get_address(self) -> bluetooth.BluetoothAddress:
                          """Get bluetooth address."""
                          return bluetooth.BluetoothAddress(self.address())
                      

                      get_device_uuid() -> bluetooth.BluetoothUuid

                      Get the device's UUID (Qt 6 has a single deviceUuid()).

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def get_device_uuid(self) -> bluetooth.BluetoothUuid:
                          """Get the device's UUID (Qt 6 has a single deviceUuid())."""
                          return bluetooth.BluetoothUuid(self.deviceUuid())
                      

                      get_major_device_class() -> MajorDeviceClassStr

                      Get major device class.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def get_major_device_class(self) -> MajorDeviceClassStr:
                          """Get major device class."""
                          return MAJOR_DEVICE_CLASS.inverse[self.majorDeviceClass()]
                      

                      get_minor_device_class() -> str

                      Get minor device class.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def get_minor_device_class(self) -> str:  # noqa: PLR0911
                          """Get minor device class."""
                          major = self.get_major_device_class()
                          match major:
                              case "computer":
                                  flag = mod.MinorComputerClass(self.minorDeviceClass())
                                  return MINOR_COMPUTER_CLASS.inverse[flag]
                              case "phone":
                                  flag = mod.MinorPhoneClass(self.minorDeviceClass())
                                  return MINOR_PHONE_CLASS.inverse[flag]
                              case "network":
                                  flag = mod.MinorNetworkClass(self.minorDeviceClass())
                                  return MINOR_NETWORK_CLASS.inverse[flag]
                              case "audio_video":
                                  flag = mod.MinorAudioVideoClass(self.minorDeviceClass())
                                  return MINOR_AUDIO_VIDEO_CLASS.inverse[flag]
                              case "peripheral":
                                  flag = mod.MinorPeripheralClass(self.minorDeviceClass())
                                  return MINOR_PERIPHERAL_CLASS.inverse[flag]
                              case "imaging":
                                  flag = mod.MinorImagingClass(self.minorDeviceClass())
                                  return MINOR_IMAGING_CLASS.inverse[flag]
                              case "wearable":
                                  flag = mod.MinorWearableClass(self.minorDeviceClass())
                                  return MINOR_WEARABLE_CLASS.inverse[flag]
                              case "toy":
                                  flag = mod.MinorToyClass(self.minorDeviceClass())
                                  return MINOR_TOY_CLASS.inverse[flag]
                              case "health":
                                  flag = mod.MinorHealthClass(self.minorDeviceClass())
                                  return MINOR_HEALTH_CLASS.inverse[flag]
                              case "miscellaneous":
                                  return "uncategorized"
                              case "uncategorized":
                                  return "misc"
                              case _:
                                  raise ValueError(major)
                      

                      get_service_classes() -> list[ServiceClassStr]

                      Get list of service classes.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def get_service_classes(self) -> list[ServiceClassStr]:
                          """Get list of service classes."""
                          return SERVICE_CLASS.get_list(self.serviceClasses())
                      

                      get_service_ids() -> list[bluetooth.BluetoothUuid]

                      Get list of service ids.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def get_service_ids(self) -> list[bluetooth.BluetoothUuid]:
                          """Get list of service ids."""
                          return [bluetooth.BluetoothUuid(i) for i in self.serviceIds()]
                      

                      get_service_uuids() -> list[bluetooth.BluetoothUuid]

                      Get list of service UUIDs.

                      Source code in prettyqt/bluetooth/bluetoothdeviceinfo.py
                      def get_service_uuids(self) -> list[bluetooth.BluetoothUuid]:
                          """Get list of service UUIDs."""
                          return [bluetooth.BluetoothUuid(i) for i in self.serviceUuids()]
                      

                      BluetoothHostInfo

                      Bases: QBluetoothHostInfo

                      Encapsulates the details of a local QBluetooth device.

                      Source code in prettyqt/bluetooth/bluetoothhostinfo.py
                      class BluetoothHostInfo(bluetooth.QBluetoothHostInfo):
                          """Encapsulates the details of a local QBluetooth device."""
                      
                          def set_address(self, address: bluetooth.QBluetoothAddress | int | str):
                              """Set address to given value."""
                              if isinstance(address, int | str):
                                  address = bluetooth.QBluetoothAddress(address)
                              self.setAddress(address)
                      
                          def get_address(self) -> bluetooth.BluetoothAddress:
                              """Get address."""
                              return bluetooth.BluetoothAddress(self.address())
                      

                      get_address() -> bluetooth.BluetoothAddress

                      Get address.

                      Source code in prettyqt/bluetooth/bluetoothhostinfo.py
                      def get_address(self) -> bluetooth.BluetoothAddress:
                          """Get address."""
                          return bluetooth.BluetoothAddress(self.address())
                      

                      set_address(address: bluetooth.QBluetoothAddress | int | str)

                      Set address to given value.

                      Source code in prettyqt/bluetooth/bluetoothhostinfo.py
                      def set_address(self, address: bluetooth.QBluetoothAddress | int | str):
                          """Set address to given value."""
                          if isinstance(address, int | str):
                              address = bluetooth.QBluetoothAddress(address)
                          self.setAddress(address)
                      

                      BluetoothLocalDevice

                      Bases: ObjectMixin, QBluetoothLocalDevice

                      Enables access to the local Bluetooth device.

                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      class BluetoothLocalDevice(core.ObjectMixin, bluetooth.QBluetoothLocalDevice):
                          """Enables access to the local Bluetooth device."""
                      
                          def __bool__(self):
                              """Return True when local device is valid."""
                              return self.isValid()
                      
                          def __repr__(self):
                              return get_repr(self, self.address())
                      
                          def set_host_mode(self, mode: HostModeStr | HostMode):
                              """Set host mode.
                      
                              Args:
                                  mode: host mode to use
                              """
                              self.setHostMode(HOST_MODE.get_enum_value(mode))
                      
                          def get_host_mode(self) -> HostModeStr:
                              """Return host mode.
                      
                              Returns:
                                  host mode
                              """
                              return HOST_MODE.inverse[self.hostMode()]
                      
                          def get_pairing_status(
                              self, address: bluetooth.QBluetoothAddress | int | str
                          ) -> PairingStr:
                              """Return pairing status.
                      
                              Arguments:
                                  address: bluetooth address
                      
                              Returns:
                                  pairing status
                              """
                              if isinstance(address, int | str):
                                  address = bluetooth.QBluetoothAddress(address)
                              return PAIRING.inverse[self.pairingStatus(address)]
                      
                          def request_pairing(
                              self,
                              address: bluetooth.QBluetoothAddress | int | str,
                              pairing: PairingStr | Pairing,
                          ):
                              """Request a pairing to given bluetooth address."""
                              if isinstance(address, int | str):
                                  address = bluetooth.QBluetoothAddress(address)
                              self.requestPairing(address, PAIRING.get_enum_value(pairing))
                      
                          def get_connected_devices(self) -> list[bluetooth.BluetoothAddress]:
                              """Get addresses for connected devices."""
                              return [bluetooth.BluetoothAddress(i) for i in self.connectedDevices()]
                      
                          @classmethod
                          def for_all_devices(cls) -> list[bluetooth.BluetoothHostInfo]:
                              """Get host info for all devices."""
                              return [bluetooth.BluetoothHostInfo(i) for i in cls.allDevices()]
                      

                      __bool__()

                      Return True when local device is valid.

                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      def __bool__(self):
                          """Return True when local device is valid."""
                          return self.isValid()
                      

                      for_all_devices() -> list[bluetooth.BluetoothHostInfo] classmethod

                      Get host info for all devices.

                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      @classmethod
                      def for_all_devices(cls) -> list[bluetooth.BluetoothHostInfo]:
                          """Get host info for all devices."""
                          return [bluetooth.BluetoothHostInfo(i) for i in cls.allDevices()]
                      

                      get_connected_devices() -> list[bluetooth.BluetoothAddress]

                      Get addresses for connected devices.

                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      def get_connected_devices(self) -> list[bluetooth.BluetoothAddress]:
                          """Get addresses for connected devices."""
                          return [bluetooth.BluetoothAddress(i) for i in self.connectedDevices()]
                      

                      get_host_mode() -> HostModeStr

                      Return host mode.

                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      def get_host_mode(self) -> HostModeStr:
                          """Return host mode.
                      
                          Returns:
                              host mode
                          """
                          return HOST_MODE.inverse[self.hostMode()]
                      

                      get_pairing_status(address: bluetooth.QBluetoothAddress | int | str) -> PairingStr

                      Return pairing status.

                      Parameters:

                      Name Type Description Default
                      address QBluetoothAddress | int | str

                      bluetooth address

                      required
                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      def get_pairing_status(
                          self, address: bluetooth.QBluetoothAddress | int | str
                      ) -> PairingStr:
                          """Return pairing status.
                      
                          Arguments:
                              address: bluetooth address
                      
                          Returns:
                              pairing status
                          """
                          if isinstance(address, int | str):
                              address = bluetooth.QBluetoothAddress(address)
                          return PAIRING.inverse[self.pairingStatus(address)]
                      

                      request_pairing(address: bluetooth.QBluetoothAddress | int | str, pairing: PairingStr | Pairing)

                      Request a pairing to given bluetooth address.

                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      def request_pairing(
                          self,
                          address: bluetooth.QBluetoothAddress | int | str,
                          pairing: PairingStr | Pairing,
                      ):
                          """Request a pairing to given bluetooth address."""
                          if isinstance(address, int | str):
                              address = bluetooth.QBluetoothAddress(address)
                          self.requestPairing(address, PAIRING.get_enum_value(pairing))
                      

                      set_host_mode(mode: HostModeStr | HostMode)

                      Set host mode.

                      Parameters:

                      Name Type Description Default
                      mode HostModeStr | HostMode

                      host mode to use

                      required
                      Source code in prettyqt/bluetooth/bluetoothlocaldevice.py
                      def set_host_mode(self, mode: HostModeStr | HostMode):
                          """Set host mode.
                      
                          Args:
                              mode: host mode to use
                          """
                          self.setHostMode(HOST_MODE.get_enum_value(mode))
                      

                      BluetoothServer

                      Bases: ObjectMixin, QBluetoothServer

                      Uses the RFCOMM or L2cap protocol to communicate with a Bluetooth device.

                      Source code in prettyqt/bluetooth/bluetoothserver.py
                      class BluetoothServer(core.ObjectMixin, bluetooth.QBluetoothServer):
                          """Uses the RFCOMM or L2cap protocol to communicate with a Bluetooth device."""
                      
                          def __init__(
                              self,
                              protocol: bluetooth.bluetoothserviceinfo.ProtocolStr
                              | bluetooth.QBluetoothServiceInfo.Protocol,
                              parent: core.QObject | None = None,
                          ):
                              protocol = bluetooth.bluetoothserviceinfo.PROTOCOL.get_enum_value(protocol)
                              super().__init__(protocol, parent)
                      
                          def get_error(self) -> ErrorStr:
                              """Get error code."""
                              return ERROR.inverse[self.error()]
                      
                          def get_server_type(self) -> bluetooth.bluetoothserviceinfo.ProtocolStr:
                              """Get server type."""
                              return bluetooth.bluetoothserviceinfo.PROTOCOL.inverse[self.serverType()]
                      
                          def get_server_address(self) -> bluetooth.BluetoothAddress:
                              """Return bluetooth server address."""
                              return bluetooth.BluetoothAddress(self.serverAddress())
                      

                      get_error() -> ErrorStr

                      Get error code.

                      Source code in prettyqt/bluetooth/bluetoothserver.py
                      def get_error(self) -> ErrorStr:
                          """Get error code."""
                          return ERROR.inverse[self.error()]
                      

                      get_server_address() -> bluetooth.BluetoothAddress

                      Return bluetooth server address.

                      Source code in prettyqt/bluetooth/bluetoothserver.py
                      def get_server_address(self) -> bluetooth.BluetoothAddress:
                          """Return bluetooth server address."""
                          return bluetooth.BluetoothAddress(self.serverAddress())
                      

                      get_server_type() -> bluetooth.bluetoothserviceinfo.ProtocolStr

                      Get server type.

                      Source code in prettyqt/bluetooth/bluetoothserver.py
                      def get_server_type(self) -> bluetooth.bluetoothserviceinfo.ProtocolStr:
                          """Get server type."""
                          return bluetooth.bluetoothserviceinfo.PROTOCOL.inverse[self.serverType()]
                      

                      BluetoothServiceDiscoveryAgent

                      Bases: ObjectMixin, QBluetoothServiceDiscoveryAgent

                      Enables you to query for Bluetooth services.

                      Source code in prettyqt/bluetooth/bluetoothservicediscoveryagent.py
                      class BluetoothServiceDiscoveryAgent(
                          core.ObjectMixin, bluetooth.QBluetoothServiceDiscoveryAgent
                      ):
                          """Enables you to query for Bluetooth services."""
                      
                          def start_discovery(self, full: bool = False):
                              """Start bluetooth service discovery.
                      
                              Arguments:
                                  full: full discovery instead of minimal discovery.
                              """
                              mode = bluetooth.QBluetoothServiceDiscoveryAgent.DiscoveryMode
                              flag = mode.FullDiscovery if full else mode.MinimalDiscovery
                              self.start(flag)
                      
                          def get_error(self) -> ErrorStr:
                              """Get error code."""
                              return ERRORS.inverse[self.error()]
                      
                          def set_remote_address(
                              self, address: str | int | bluetooth.QBluetoothAddress
                          ) -> bool:
                              """Set remote address.
                      
                              Arguments:
                                  address: address of the remote
                              """
                              address = bluetooth.BluetoothAddress(address)
                              return self.setRemoteAddress(address)
                      
                          def get_discovered_services(self) -> list[bluetooth.BluetoothServiceInfo]:
                              """Get list of discovered devices."""
                              return [bluetooth.BluetoothServiceInfo(i) for i in self.discoveredServices()]
                      

                      get_discovered_services() -> list[bluetooth.BluetoothServiceInfo]

                      Get list of discovered devices.

                      Source code in prettyqt/bluetooth/bluetoothservicediscoveryagent.py
                      def get_discovered_services(self) -> list[bluetooth.BluetoothServiceInfo]:
                          """Get list of discovered devices."""
                          return [bluetooth.BluetoothServiceInfo(i) for i in self.discoveredServices()]
                      

                      get_error() -> ErrorStr

                      Get error code.

                      Source code in prettyqt/bluetooth/bluetoothservicediscoveryagent.py
                      def get_error(self) -> ErrorStr:
                          """Get error code."""
                          return ERRORS.inverse[self.error()]
                      

                      set_remote_address(address: str | int | bluetooth.QBluetoothAddress) -> bool

                      Set remote address.

                      Parameters:

                      Name Type Description Default
                      address str | int | QBluetoothAddress

                      address of the remote

                      required
                      Source code in prettyqt/bluetooth/bluetoothservicediscoveryagent.py
                      def set_remote_address(
                          self, address: str | int | bluetooth.QBluetoothAddress
                      ) -> bool:
                          """Set remote address.
                      
                          Arguments:
                              address: address of the remote
                          """
                          address = bluetooth.BluetoothAddress(address)
                          return self.setRemoteAddress(address)
                      

                      start_discovery(full: bool = False)

                      Start bluetooth service discovery.

                      Parameters:

                      Name Type Description Default
                      full bool

                      full discovery instead of minimal discovery.

                      False
                      Source code in prettyqt/bluetooth/bluetoothservicediscoveryagent.py
                      def start_discovery(self, full: bool = False):
                          """Start bluetooth service discovery.
                      
                          Arguments:
                              full: full discovery instead of minimal discovery.
                          """
                          mode = bluetooth.QBluetoothServiceDiscoveryAgent.DiscoveryMode
                          flag = mode.FullDiscovery if full else mode.MinimalDiscovery
                          self.start(flag)
                      

                      BluetoothServiceInfo

                      Bases: QBluetoothServiceInfo, MutableMapping

                      Enables access to the attributes of a Bluetooth service.

                      Also implements MutableMapping interface, can be used as a dicionary.

                      Source code in prettyqt/bluetooth/bluetoothserviceinfo.py
                      class BluetoothServiceInfo(
                          QtBluetooth.QBluetoothServiceInfo, MutableMapping, metaclass=datatypes.QABCMeta
                      ):
                          """Enables access to the attributes of a Bluetooth service.
                      
                          Also implements MutableMapping interface, can be used as a dicionary.
                          """
                      
                          def __getitem__(self, value: str | int | AttributeId):
                              match value:
                                  case int():
                                      flag = value
                                  case str():
                                      if value not in ATTRIBUTE_IDS:
                                          raise KeyError(value)
                                      flag = ATTRIBUTE_IDS[value].value
                                  case AttributeId():
                                      flag = value.value
                                  case _:
                                      raise KeyError(value)
                              return self.attribute(flag)
                      
                          def __delitem__(self, value: str | int | AttributeId):
                              match value:
                                  case int():
                                      flag = value
                                  case str():
                                      flag = ATTRIBUTE_IDS[value].value
                                  case AttributeId():
                                      flag = value.value
                                  case _:
                                      raise KeyError(value)
                              return self.removeAttribute(flag)
                      
                          def __setitem__(self, index: str | int | AttributeId, value):
                              """Set attribute."""
                              match index:
                                  case int():
                                      flag = index
                                  case str():
                                      flag = ATTRIBUTE_IDS[index].value
                                  case AttributeId():
                                      flag = index.value
                                  case _:
                                      raise KeyError(index)
                              return self.setAttribute(flag, value)
                      
                          def __contains__(self, value: object) -> bool:
                              match value:
                                  case int():
                                      flag = value
                                  case str():
                                      if value not in ATTRIBUTE_IDS:
                                          return False
                                      flag = ATTRIBUTE_IDS[value].value
                                  case AttributeId():
                                      flag = value.value
                                  case _:
                                      return False
                              return self.contains(flag)
                      
                          def __iter__(self):
                              """Iter the info attributes."""
                              return iter(self.attributes())
                      
                          def __len__(self):
                              return len(self.attributes())
                      

                      __iter__()

                      Iter the info attributes.

                      Source code in prettyqt/bluetooth/bluetoothserviceinfo.py
                      def __iter__(self):
                          """Iter the info attributes."""
                          return iter(self.attributes())
                      

                      __setitem__(index: str | int | AttributeId, value)

                      Set attribute.

                      Source code in prettyqt/bluetooth/bluetoothserviceinfo.py
                      def __setitem__(self, index: str | int | AttributeId, value):
                          """Set attribute."""
                          match index:
                              case int():
                                  flag = index
                              case str():
                                  flag = ATTRIBUTE_IDS[index].value
                              case AttributeId():
                                  flag = index.value
                              case _:
                                  raise KeyError(index)
                          return self.setAttribute(flag, value)
                      

                      BluetoothSocket

                      Bases: IODeviceMixin, QBluetoothSocket

                      Enables connection to a Bluetooth device running a bluetooth server.

                      Source code in prettyqt/bluetooth/bluetoothsocket.py
                      class BluetoothSocket(core.IODeviceMixin, bluetooth.QBluetoothSocket):
                          """Enables connection to a Bluetooth device running a bluetooth server."""
                      
                          def __init__(
                              self,
                              protocol: bluetooth.bluetoothserviceinfo.ProtocolStr
                              | bluetooth.QBluetoothServiceInfo.Protocol
                              | None = None,
                              parent: core.QObject | None = None,
                          ):
                              if protocol is None:
                                  super().__init__(parent)
                              else:
                                  proto = bluetooth.bluetoothserviceinfo.PROTOCOL.get_enum_value(protocol)
                                  super().__init__(proto, parent)
                      
                          def get_error(self) -> SocketErrorStr:
                              return SOCKET_ERROR.inverse[self.error()]
                      
                          def get_state(self) -> SocketStateStr:
                              return SOCKET_STATE.inverse[self.state()]
                      
                          def get_local_address(self) -> bluetooth.BluetoothAddress:
                              return bluetooth.BluetoothAddress(self.localAddress())
                      
                          def get_peer_address(self) -> bluetooth.BluetoothAddress:
                              return bluetooth.BluetoothAddress(self.peerAddress())
                      
                          def get_socket_type(self) -> bluetooth.bluetoothserviceinfo.ProtocolStr:
                              return bluetooth.bluetoothserviceinfo.PROTOCOL.inverse[self.socketType()]
                      

                      BluetoothUuid

                      Bases: UuidMixin, QBluetoothUuid

                      Generates a UUID for each Bluetooth service.

                      Source code in prettyqt/bluetooth/bluetoothuuid.py
                      class BluetoothUuid(core.UuidMixin, QtBluetooth.QBluetoothUuid):
                          """Generates a UUID for each Bluetooth service."""
                      
                          @classmethod
                          def characteristic_to_string(cls, characteristic: CharacteristicTypeStr | md) -> str:
                              """Return string representation for given characteristic."""
                              return cls.characteristicToString(
                                  CHARACTERISTIC_TYPES.get_enum_value(characteristic)
                              )
                      
                          @classmethod
                          def descriptor_to_string(cls, descriptor: DescriptorTypeStr | dt) -> str:
                              """Return string representation for given descriptor."""
                              return cls.descriptorToString(DESCRIPTOR_TYPE.get_enum_value(descriptor))
                      
                          @classmethod
                          def protocol_to_string(cls, protocol: ProtocolUuidStr | pu) -> str:
                              """Return string representation for given protocol."""
                              return cls.protocolToString(PROTOCOL_UUID.get_enum_value(protocol))
                      
                          @classmethod
                          def service_class_to_string(cls, service_class: ServiceClassUuidStr | su) -> str:
                              """Return string representation for given service class."""
                              return cls.serviceClassToString(SERVICE_CLASS_UUID.get_enum_value(service_class))
                      

                      characteristic_to_string(characteristic: CharacteristicTypeStr | md) -> str classmethod

                      Return string representation for given characteristic.

                      Source code in prettyqt/bluetooth/bluetoothuuid.py
                      @classmethod
                      def characteristic_to_string(cls, characteristic: CharacteristicTypeStr | md) -> str:
                          """Return string representation for given characteristic."""
                          return cls.characteristicToString(
                              CHARACTERISTIC_TYPES.get_enum_value(characteristic)
                          )
                      

                      descriptor_to_string(descriptor: DescriptorTypeStr | dt) -> str classmethod

                      Return string representation for given descriptor.

                      Source code in prettyqt/bluetooth/bluetoothuuid.py
                      @classmethod
                      def descriptor_to_string(cls, descriptor: DescriptorTypeStr | dt) -> str:
                          """Return string representation for given descriptor."""
                          return cls.descriptorToString(DESCRIPTOR_TYPE.get_enum_value(descriptor))
                      

                      protocol_to_string(protocol: ProtocolUuidStr | pu) -> str classmethod

                      Return string representation for given protocol.

                      Source code in prettyqt/bluetooth/bluetoothuuid.py
                      @classmethod
                      def protocol_to_string(cls, protocol: ProtocolUuidStr | pu) -> str:
                          """Return string representation for given protocol."""
                          return cls.protocolToString(PROTOCOL_UUID.get_enum_value(protocol))
                      

                      service_class_to_string(service_class: ServiceClassUuidStr | su) -> str classmethod

                      Return string representation for given service class.

                      Source code in prettyqt/bluetooth/bluetoothuuid.py
                      @classmethod
                      def service_class_to_string(cls, service_class: ServiceClassUuidStr | su) -> str:
                          """Return string representation for given service class."""
                          return cls.serviceClassToString(SERVICE_CLASS_UUID.get_enum_value(service_class))