BluetoothDeviceInfo
Base classes
â‹” Inheritance diagram
graph TD
2173760711["bluetooth.BluetoothDeviceInfo"]
3973124546["QtBluetooth.QBluetoothDeviceInfo"]
37984305["Shiboken.Object"]
2751680898["builtins.object"]
3973124546 --> 2173760711
37984305 --> 3973124546
2751680898 --> 37984305
🛈 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_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()]
|
:fa-brands-github: Show source on GitHub