From 790c0dcfc876d50b21791ad7b81f693796e2173b Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Sat, 10 Jun 2017 10:09:56 +0200 Subject: QML UI: add internal admin for virtual vendor Added a list of paired BT devices for the "Paired BT Devices" vendor. The devices under this vendor represent all BT devces that can be found from the local BT interface. Some special processing is required, as the BT provided data is (obviously) missing the specific data needed to open a BT device using libdc code. This processing is not in this commit, but will follow. This commit is preparation for that. Signed-off-by: Jan Mulder Signed-off-by: Dirk Hohndel --- core/btdiscovery.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'core/btdiscovery.cpp') diff --git a/core/btdiscovery.cpp b/core/btdiscovery.cpp index cf68bf8eb..2edddb300 100644 --- a/core/btdiscovery.cpp +++ b/core/btdiscovery.cpp @@ -66,6 +66,7 @@ void BTDiscovery::btDeviceDiscovered(const QBluetoothDeviceInfo &device) this_d.address = device.address(); this_d.name = device.name(); btPairedDevices.append(this_d); + struct btVendorProduct btVP; QString newDevice = device.name(); @@ -77,20 +78,27 @@ void BTDiscovery::btDeviceDiscovered(const QBluetoothDeviceInfo &device) addBtUuid(id); qDebug() << id.toByteArray(); } - qDebug() << "Found new device " + newDevice + " (" + device.address().toString() + ")"; - QString vendor, product; + qDebug() << "Found new device:" << newDevice << device.address(); + QString vendor; foreach (vendor, productList.keys()) { if (productList[vendor].contains(newDevice)) { qDebug() << "this could be a " + vendor + " " + (newDevice == "OSTC 3" ? "OSTC family" : newDevice); - struct btVendorProduct btVP; btVP.btdi = device; btVP.vendorIdx = vendorList.indexOf(vendor); btVP.productIdx = productList[vendor].indexOf(newDevice); - qDebug() << "adding new btDCs entry" << newDevice << btVP.vendorIdx << btVP.productIdx; + qDebug() << "adding new btDCs entry (detected DC)" << newDevice << btVP.vendorIdx << btVP.productIdx << btVP.btdi.address();; btDCs << btVP; + break; } } + productList[QObject::tr("Paired Bluetooth Devices")].append(this_d.name); + + btVP.btdi = device; + btVP.vendorIdx = vendorList.indexOf(QObject::tr("Paired Bluetooth Devices")); + btVP.productIdx = productList[QObject::tr("Paired Bluetooth Devices")].indexOf(this_d.name); + qDebug() << "adding new btDCs entry (all paired)" << newDevice << btVP.vendorIdx << btVP.productIdx << btVP.btdi.address(); + btAllDevices << btVP; } QList BTDiscovery::getBtDcs() @@ -98,6 +106,10 @@ QList BTDiscovery::getBtDcs() return btDCs; } +QList BTDiscovery::getBtAllDevices() +{ + return btAllDevices; +} // Android: As Qt is not able to pull the pairing data from a device, i // a lengthy discovery process is needed to see what devices are paired. On -- cgit v1.2.3-70-g09d2