PySide6.QtBluetooth.QLowEnergyAdvertisingData¶
- class QLowEnergyAdvertisingData¶
- The - QLowEnergyAdvertisingDataclass represents the data to be broadcast during Bluetooth Low Energy advertising. More…- Synopsis¶- Methods¶- def - __init__()
- def - localName()
- def - manufacturerId()
- def - __ne__()
- def - __eq__()
- def - rawData()
- def - services()
- def - setLocalName()
- def - setRawData()
- def - setServices()
- def - swap()
 - Static functions¶- Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- This data can include the device name, GATT services offered by the device, and so on. The data set via this class will be used when advertising is started by calling - startAdvertising(). Objects of this class can represent an Advertising Data packet or a Scan Response packet.- Note - The actual data packets sent over the advertising channel cannot contain more than 31 bytes. If the variable-length data set via this class exceeds that limit, it will be left out of the packet or truncated, depending on the type. On Android, advertising will fail if advertising data is larger than 31 bytes. On Bluez DBus backend the advertising length limit and the behavior when it is exceeded is up to BlueZ; it may for example support extended advertising. For the most predictable behavior keep the advertising data short. - class Discoverability¶
- The discoverability of the advertising device as defined by the Generic Access Profile. - Constant - Description - QLowEnergyAdvertisingData.DiscoverabilityNone - The advertising device does not wish to be discoverable by scanning devices. - QLowEnergyAdvertisingData.DiscoverabilityLimited - The advertising device wishes to be discoverable with a high priority. Note that this mode is not compatible with using a white list. The value of - filterPolicy()is always assumed to be- IgnoreWhiteListwhen limited discoverability is used.- QLowEnergyAdvertisingData.DiscoverabilityGeneral - The advertising device wishes to be discoverable by scanning devices. 
 - __init__()¶
 - Creates a new object of this class. All values are initialized to their defaults according to the Bluetooth Low Energy specification. - __init__(other)
- Parameters:
- other – - QLowEnergyAdvertisingData
 
 - Constructs a new object of this class that is a copy of - other.- discoverability()¶
- Return type:
 
 - Returns the discoverability mode of the advertising device. The default is - DiscoverabilityNone.- See also - includePowerLevel()¶
- Return type:
- bool 
 
 - Returns whether to include the device’s transmit power level in the advertising data. The default is - false.- See also - static invalidManufacturerId()¶
- Return type:
- int 
 
 - Returns an invalid manufacturer id. If this value is set as the manufacturer id (which it is by default), no manufacturer data will be present in the advertising data. - localName()¶
- Return type:
- str 
 
 - Returns the name of the local device that is to be advertised. - See also - manufacturerData()¶
- Return type:
 
 - Returns the manufacturer data. The default is an empty byte array. - See also - manufacturerId()¶
- Return type:
- int 
 
 - Returns the manufacturer id. The default is - invalidManufacturerId(), which means the data will not be advertised.- __ne__(b)¶
- Parameters:
- Return type:
- bool 
 
 - Returns - trueif- data1and- data2are not equal with respect to their public state, otherwise returns- false.- __eq__(b)¶
- Parameters:
- Return type:
- bool 
 
 - Returns - trueif- data1and- data2are equal with respect to their public state, otherwise returns- false.- rawData()¶
- Return type:
 
 - Returns the user-supplied raw data to be advertised. The default is an empty byte array. - See also - services()¶
- Return type:
- .list of QBluetoothUuid 
 
 - Returns the list of service UUIDs to be advertised. By default, this list is empty. - See also - setDiscoverability(mode)¶
- Parameters:
- mode – - Discoverability
 
 - Sets the discoverability type of the advertising device to - mode.- Note - Discoverability information can only appear in an actual advertising data packet. If this object acts as scan response data, a call to this function will have no effect on the scan response sent. - See also - setIncludePowerLevel(doInclude)¶
- Parameters:
- doInclude – bool 
 
 - Specifies whether to include the device’s transmit power level in the advertising data. If - doIncludeis- true, the data will be included, otherwise it will not.- See also - setLocalName(name)¶
- Parameters:
- name – str 
 
 - Specifies that - nameshould be broadcast as the name of the device. If the full name does not fit into the advertising data packet, an abbreviated name is sent, as described by the Bluetooth Low Energy specification.- On Android, the local name cannot be changed. Android always uses the device name. If this local name is not empty, the Android implementation includes the device name in the advertisement packet; otherwise the device name is omitted from the advertisement packet. - See also - setManufacturerData(id, data)¶
- Parameters:
- id – int 
- data – - QByteArray
 
 
 - Sets the manufacturer id and data. The - idparameter is a company identifier as assigned by the Bluetooth SIG. The- dataparameter is an arbitrary value.- Note - macOS and iOS do not support advertising of manufacturer id or data, so the provided parameters will be ignored on these platforms. - See also - setRawData(data)¶
- Parameters:
- data – - QByteArray
 
 - Sets the data to be advertised to - data. If the value is not an empty byte array, it will be sent as-is as the advertising data and all other data in this object will be ignored. This can be used to send non-standard data.- Note - If - datais longer than 31 bytes, it will be truncated. It is the caller’s responsibility to ensure that- datais well-formed.- Setting raw advertising data is only supported on the Linux Bluetooth Kernel API backend. Other backends do not allow to specify the raw advertising data as a global field. - See also - setServices(services)¶
- Parameters:
- services – .list of QBluetoothUuid 
 
 - Specifies that the service UUIDs in - servicesshould be advertised. If the entire list does not fit into the packet, an incomplete list is sent as specified by the Bluetooth Low Energy specification.- See also - swap(other)¶
- Parameters:
- other – - QLowEnergyAdvertisingData
 
 - Swaps this object with - other.