Mobile: add helper function to fill in the BT name

For some devices the BT device name is different from the product name.
Make sure that name is available to the mobile UI. This helper fills it
in from the scan data (based on the device address).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-12-21 14:52:02 -08:00
parent 6ba1cf8cf7
commit ef8656998a
2 changed files with 13 additions and 0 deletions

View file

@ -1757,6 +1757,17 @@ void QMLManager::setStatusbarColor(QColor)
#endif
void QMLManager::retrieveBluetoothName()
{
QString name = DC_devName();
QList<BTDiscovery::btVendorProduct> btDCs = BTDiscovery::instance()->getBtDcs();
foreach (BTDiscovery::btVendorProduct btDC, btDCs) {
qDebug() << "compare" <<name << btDC.btpdi.address;
if (name.contains(btDC.btpdi.address))
DC_setDevBluetoothName(btDC.btpdi.name);
}
}
QString QMLManager::DC_vendor() const
{
return DCDeviceData::instance()->vendor();

View file

@ -62,6 +62,8 @@ public:
QString DC_devName() const;
void DC_setDevName(const QString& devName);
Q_INVOKABLE void retrieveBluetoothName();
QString DC_devBluetoothName() const;
void DC_setDevBluetoothName(const QString& devBluetoothName);