2020-11-15 03:44:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include "qt-models/diveimportedmodel.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QUndoStack>
|
|
|
|
|
2020-11-15 21:12:21 +00:00
|
|
|
|
2020-11-15 03:44:06 +00:00
|
|
|
void cliDownloader(const char *vendor, const char *product, const char *device)
|
|
|
|
{
|
|
|
|
DiveImportedModel *diveImportedModel = new DiveImportedModel();
|
|
|
|
DiveImportedModel::connect(diveImportedModel, &DiveImportedModel::downloadFinished, [] {
|
|
|
|
// do something useful at the end of the download
|
2020-11-22 19:31:57 +00:00
|
|
|
printf("Finished\n");
|
2020-11-15 03:44:06 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
auto data = diveImportedModel->thread.data();
|
|
|
|
data->setVendor(vendor);
|
|
|
|
data->setProduct(product);
|
2020-11-22 19:31:57 +00:00
|
|
|
data->setBluetoothMode(false);
|
2020-11-15 03:44:06 +00:00
|
|
|
if (data->vendor() == "Uemis") {
|
|
|
|
char *colon;
|
|
|
|
char *devname = strdup(device);
|
|
|
|
if ((colon = strstr(devname, ":\\ (UEMISSDA)")) != NULL) {
|
|
|
|
*(colon + 2) = '\0';
|
|
|
|
fprintf(stderr, "shortened devname to \"%s\"", devname);
|
|
|
|
}
|
|
|
|
data->setDevName(devname);
|
|
|
|
} else {
|
|
|
|
data->setDevName(device);
|
|
|
|
}
|
|
|
|
|
|
|
|
// some assumptiond - should all be configurable
|
|
|
|
data->setForceDownload(false);
|
2020-11-22 19:31:57 +00:00
|
|
|
data->setSaveLog(true);
|
2020-11-15 03:44:06 +00:00
|
|
|
data->setSaveDump(false);
|
|
|
|
|
|
|
|
// before we start, remember where the dive_table ended
|
|
|
|
diveImportedModel->startDownload();
|
|
|
|
}
|