Skip to content

BluetoothDeviceInfo

Qt Base Class: QBluetoothDeviceInfo

Signature: QBluetoothDeviceInfo(self) -> None QBluetoothDeviceInfo(self, address: PySide6.QtBluetooth.QBluetoothAddress, name: str, classOfDevice: int) -> None QBluetoothDeviceInfo(self, other: PySide6.QtBluetooth.QBluetoothDeviceInfo) -> None QBluetoothDeviceInfo(self, uuid: Union[PySide6.QtBluetooth.QBluetoothUuid, PySide6.QtBluetooth.QBluetoothUuid.CharacteristicType, PySide6.QtBluetooth.QBluetoothUuid.DescriptorType, PySide6.QtBluetooth.QBluetoothUuid.ProtocolUuid, PySide6.QtBluetooth.QBluetoothUuid.ServiceClassUuid, PySide6.QtCore.QUuid], name: str, classOfDevice: int) -> None

Base classes

Name Children Inherits
QBluetoothDeviceInfo
PySide6.QtBluetooth
QBluetoothDeviceInfo(self) -> None

⋔ Inheritance diagram

graph TD
  1473367534624["bluetooth.BluetoothDeviceInfo"]
  1473367233632["QtBluetooth.QBluetoothDeviceInfo"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473367233632 --> 1473367534624
  1473291690208 --> 1473367233632
  140713234304496 --> 1473291690208

🛈 DocStrings

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_ids(self) -> list[bluetooth.BluetoothUuid]:
        """Get list of device ids."""
        return [bluetooth.BluetoothUuid(i) for i in self.deviceIds()]

    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:
        """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 "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_ids() -> list[bluetooth.BluetoothUuid]

Get list of device ids.

Source code in prettyqt\bluetooth\bluetoothdeviceinfo.py
def get_device_ids(self) -> list[bluetooth.BluetoothUuid]:
    """Get list of device ids."""
    return [bluetooth.BluetoothUuid(i) for i in self.deviceIds()]

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:
    """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 "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()]