mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
android/usb: pass in the UsbDevice when downloading
This finally allows us to download from not just the first device, but specifically the device that the user picks. Passing the object through a void pointer is not nice - but since this traverses C code other solutions (like passing an index into the list) seemed even worse. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1495aa2dbf
commit
ec3a968df9
8 changed files with 38 additions and 11 deletions
|
@ -1999,6 +1999,18 @@ void QMLManager::DC_setProduct(const QString& product)
|
|||
void QMLManager::DC_setDevName(const QString& devName)
|
||||
{
|
||||
DCDeviceData::instance()->setDevName(devName);
|
||||
#if defined(Q_OS_ANDROID)
|
||||
// get the currently valid list of devices and set up the USB device descriptor
|
||||
// if the connection string matches a connection in that list
|
||||
androidSerialDevices = serial_usb_android_get_devices();
|
||||
std::string connection = devName.toStdString();
|
||||
for (unsigned int i = 0; i < androidSerialDevices.size(); i++) {
|
||||
if (androidSerialDevices[i].uiRepresentation == connection) {
|
||||
appendTextToLog(QString("setDevName matches USB device %1").arg(i));
|
||||
DCDeviceData::instance()->setUsbDevice((void *)&androidSerialDevices[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void QMLManager::DC_setDevBluetoothName(const QString& devBluetoothName)
|
||||
|
|
|
@ -233,6 +233,7 @@ public slots:
|
|||
void btRescan();
|
||||
#if defined(Q_OS_ANDROID)
|
||||
void showDownloadPage(QAndroidJniObject usbDevice);
|
||||
QString getProductVendorConnectionIdx(android_usb_serial_device_descriptor descriptor);
|
||||
#endif
|
||||
void divesChanged(const QVector<dive *> &dives, DiveField field);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue