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 f7a4327cd4
commit 0f350bef98
2 changed files with 13 additions and 0 deletions

View file

@ -1637,6 +1637,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 m_device_data->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);