aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-06-15tankinfomodel.cpp: clamp row index to [0 - MAX_TANK_INFO]Gravatar Lubomir I. Ivanov
MAX_TANK_INFO is a new macro in dive.h to define the maximum number of tank_info_t objects. TankInfoModel's data() and setData() now check for valid row indexes before accessing the tank_info[] array directly. Without this patch TankInfoMode::data() can cause a SIGSEGV. Reported-by: Pedro Neves <nevesdiver@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-15Fix buffer overrun and primary sensor id issues in Liquivision importGravatar Robert Bodily
This changeset fixes 5 issues specific to importing from Liquivision dive logs: Issue #1: Buffer overrun causes segmentation fault. At the end of a dive record, untranslatable data is skipped and the file is scanned for the start of the next dive. This scan was implemented without regard to buffer size and so the scan ran over the buffer boundary when trying to scan for the next record after importing the last record in the file. Issue #2: Incorrect identification of the primary sensor. The primary tank pressure transmitter was being identified by using the sensor ID reported in the first pressure event record encountered. When diving with multiple transmitters (buddy, student, or group transmitters), this is often not the case and results in the buddy or other group transmitter's pressure data being imported instead of the primary's. Through empirical observation of several multi-sensor logs, I identified a previously unhandled event code (0x10) as marking a sensor identification event record. Parsing this record allows the primary and other sensors to be definitively identified regardless of which one sends the first pressure event. Issue #3: Sensor values added to the sample collection regardless of sensor ID. When processing events, the code previously dropped through to create a sample for every pressure event record, regardless of which sensor ID that event is associated with. Pressure events for sensors other than the primary are now ignored and omitted from the sample collection. Issue #4: Duplicate samples when pressure event time syncs with sample time. The sample index (d) was not incremented in this specific case resulting in a duplicate sample (for the same sample time) being created when processing the next pressure event record. Issue #5: Unsigned time difference results in erroneous interpolated samples. When interpolating/extrapolating depth and temperature values for a between- samples pressure event, a signed time value is subtracted from an unsigned time value, resulting in an unsigned term. This term is used as a scaling factor and should be signed to allow for a negative value. Currently, negative values are instead treated as large unsigned values which result in erroneous scaled depth and temperature values. Signed-off-by: Robert Bodily <robert@bodily.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-16code cleanup: one more unused includeGravatar Jan Mulder
See c7a35098008b2. A forgotten include is now removed as well. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-16code cleanup: remove unimplemented classes and structsGravatar Jan Mulder
Remove forward declared but not implemented classes and structs. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-16code cleanup: remove 2 unused structsGravatar Jan Mulder
Luckily these 2 structs in this ugly code are not used. Remove them. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-15Correctly hook up libdivecomputer log and dumpGravatar Dirk Hohndel
This was checking the status of the wrong UI elements. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-13Parse He when importing from DM5Gravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-06-13QML UI: small fix and whitespace cleanupGravatar Dirk Hohndel
In the JS code we should use assignment with '='. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12BT Discovery: add Shearwater Petrel and PerdixGravatar Jan Mulder
Add Shearwater Petrel and Perdix to automatic detection Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-12Don't declare static function in .h fileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Mobile: wrap up fixes for BT download on AndroidGravatar Jan Mulder
Major functional change in this commit is the addition of found static BT devices to the internal administration (on Android), in a way that is equivalent to mobile-on-desktop. So, in both cases, the list of devices in the app are as in the list of devices on the host OS (Linux or Android). To minimize code duplication, the btDeviceDiscovered slot is split in two parts, the part to act as slot for the Qt BT discovery agent (Linux, so mobile-on-desktop), and the part only needed for Android. Remaining to be fixed: the correct handling of the QML UI selection of vendor/product. The first default dive computer is correctly detected, all paired devices from the virtual vendow can be selected, but clicking through vendors results in non logical selections. It is obvious why this is, but a fix is not straigforward at this point. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Mobile: add BT name to vendor/product capabilityGravatar Jan Mulder
This adds a central function to convert a BT name to a vendor/product pair known to Subsurface. This allows interfacing from a paired BT dive computer, without actively selecting its type, but by selecting it from the list of paired BT devices. So, after this, downloading from multiple (paired) DCs is also possible. And not the niced piece of code ... Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Mobile: do not BT Discover on Android (Q_OS_ANDROID vs Q_OS_LINUX)Gravatar Jan Mulder
This seems a very trivial commit, but it is not. It appears that on an Android build, with defined(Q_OS_ANDROID) the Q_OS_LINUX variable is also defined. This results in a very tricky discovery process: 1) the JNI stuff pulls the paired devices from the local BT controller, and 2) The QT discovry agent gets active BT devices. 1) is a static list, that is, not dependent on actual visual/discoverable BT devices; it is just cached data from the phone. 2) On Android, this results in a list of actively visible (paired and not paired) devices. On desktop, however (with QT/bluez BT stack) the QT discovery agent just gets the list of paired devices, so more or less equivalent to the situation described under 1) for Android. Ok, a long story, but just do not do a discovery on Android at all. Basically, we need the BT address, device name, and possibly a specific SPP service UUID. This are fixed and known for HW and Shearwater at this point, so there is no need for a (lengthy) discovery process, and making sure the the dive computer is discoverable at the moment the app wants to construct its data to show in the UI. So, the static list of paired devices is all we need. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12BT discovery: distinguish names with addressesGravatar Dirk Hohndel
It's possible that the user has more than one dive computer with the same name paired with their computer / device. So let's just add the address to the name to make it possible to tell those apart. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12QML UI: add internal admin for virtual vendorGravatar Jan Mulder
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 <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Android BT: fix compile bugGravatar Jan Mulder
One Andorid JNI include was missing. And removed the unused ones from QMLManager. [Dirk Hohndel: I had added the missing include elsewhere, so this commit now only has the removal of the unused includes] Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12QML UI: call correct function for BT addressGravatar Jan Mulder
After the recent refactoring of QMLManager to btdiscovery, the manager.getBtAddress() got superseeded by downloadThread.data().getDetectedDeviceAddress(). Corrected this here. Futher some debug output is modified, so that it report the proper function names. This corrects the download from an automatically detected OSTC 3. Manul selection of the same device from the fake vendor "Paired BT Devices" does not work, however. Still work to be done in that area. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12QML UI: do not crash on selecting dive computersGravatar Jan Mulder
For reasons unknown to me, the DCDeviceData instance was freed way too early, and used afterwards, obviously resulting in a SIGSEGV. This commit creates the DCDeviceData as a direct child of the QMLManager instance, ensuring it does not get freed prematurely. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Download dialog showed time incorrectlyGravatar Miika Turkia
The used time format was h:mh: i.e. 1:16h: This patch gets rid of the colon after the hour indicator. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-06-11qthelper.cpp: leave lbs rounding to QString().arg() with 'f'Gravatar Lubomir I. Ivanov
The following call in weight_string(): str = QString("%1").arg(lbs, 0, 'f', lbs >= 40.0 ? 0 : 1); will make values in lbs larger or equal to 40 to have no fractional part and be rounded to nearest, while values less than 40 will have one decimal place. fixes #412 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11TabDiveInformation.cpp: use lrint() for sac.mliter in updateData()Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11simplewidgets.cpp: silence warning about parenthesesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11datatrak.c: don't use POSIX %m format for sscanf() in dtrak_prepare_data()Gravatar Lubomir I. Ivanov
The format option "%m" doesn't work for MINGW/Windows and is reported as an unknown conversation type and this sscanf() call would not work. The alternative is to malloc() enough space manually - e.g. strlen(input) + 1. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11Android build fixGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11Fix a few warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11smtk2ssrf-mxe-build.sh: add a flag for git repoGravatar Salvador Cuñat
Previous script would fail on git folders that pull from more than one repo. That's not a general case, but pretty usual for developers pulling/pushing to github. BTW in this cases, a lind git pull doesn't ensure we are pulling from the right repo. When run without flag, default to pull --rebase. At the same time introduce a tiny func to return a message and bail out after some command failures.
2017-06-11QML UI: move BT handling into core codeGravatar Dirk Hohndel
This shouldn't be part of the UI (qmlmanager), but part of our overall handling of dive computers and BT devices. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11QML UI: adjust to modified logging APIGravatar Dirk Hohndel
appendTextToLog prepends the elapsed time which can be useful, so let's not remove that but instead have it log to qDebug() instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11Make message handler write to console as wellGravatar Dirk Hohndel
This way we can see the debug output even if the app is hung or crashes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11Add a messageHandler to take care of qDebug & friends on QMLGravatar Tomaz Canabrava
all qDebug / qCDebug and friends now will be properly logged into developer -> log, on QML. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11QML UI: add paired BT devices as vendorGravatar Dirk Hohndel
This way the user can explicitly chose which dive computer they want to download from. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11QML UI: correctly set up the divecomputer for downloadGravatar Dirk Hohndel
If we find a paired BT divecomputer, this will populate vendor and product correctly for that device. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11smtk-import portability: avoid using %m[] in sscanfGravatar Salvador Cuñat
As Lubomir pointed out in his patch for datatrak.c, the format option %m for sscanf doesn't work in mingw/windows. Fortunately it's unnecessary as dates are dropped and we just get times. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-06-11smtk-import: portability: rework non portable funcsGravatar Salvador Cuñat
For different reasons some used functions aren't portable or simply are not included in mingw. This includes index, rindex, strptime, and timegm. A workaround for this is needed, if we want to build for windows using mingw based mxe environment. This patch does: - drops index and rindex in favor of strchr and strrchr - substitute strptime with a sscanf parsing - emulate timegm with a private func smtk_timegm() - remove definitions needed by strptime Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-06-11smtk-import: portability: rename DATEGravatar Salvador Cuñat
DATE happens to be defined in wtypes.h. Redefining it may be a bad idea, so move it to _DATE Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-06-11smtk-import: portability: include windows.hGravatar Salvador Cuñat
Include windows.h if we are cross building to windows Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
2017-06-11Let command line version not open an X windowGravatar Robert C. Helling
So we can run it on a headless system Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-06-11smtk-import: Add mxe cross-building scriptGravatar Salvador Cuñat
Add to packaging/windows an script to build an installer for the importer tool.
2017-06-11smtk-import: add cmake modules and .nsi skeletonGravatar Salvador Cuñat
Needed to crossbuild to windows. The cmake modules are just clones from those under subsurface/cmake/Modules, tweaked to build smtk-import for windows.
2017-06-11smtk-import: Add build script for smtk2ssrfGravatar Salvador Cuñat
Add a bash script to build the linux version of smtk2ssrf tool. It works mostly like build.sh, but have some flags avaliable.
2017-06-11smtk-import: change CMakeLists.txtGravatar Salvador Cuñat
As SmartTrak importer is building separately from Subsurface, a full CMakeLists.txt file is necessary for the smtk-import directory. It includes cross building to windows capability.
2017-06-11CMakeLists.txt: Remove SmartTrak import optionsGravatar Salvador Cuñat
Remove SmartTrak import options from Subsurface's CMakeLists,txt, as a first step to keep the importer apart from the main application.
2017-06-04QML UI: show selection box on the Download from DC listGravatar Tomaz Canabrava
QML and C++ model don't interact too much, a new Rule should be created and used on the QML Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-02Silence compiler warningsGravatar Jan Mulder
Silence some compiler warnings about implicit double to int conversions. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-02Android BT: generalize pairing dataGravatar Jan Mulder
This adds a list of paired BT devices to the QMLManager class. In addition, a very simple implementation is made of getting the paired BT devices on Linux, so that we can test further processing of selecting the proper devices, in a mobile-on-desktop situation. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01Android BT: do not force BT onGravatar Jan Mulder
It is very impolite to force BT on at start of the mobile app. We cannot know if the user is going to import dives over BT. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01Android BT: pull the pairing data from a deviceGravatar Jan Mulder
As Qt is not able to pull the pairing data from a device, a lengthy discovery process is needed to see what devices are paired. On https://forum.qt.io/topic/46075/solved-bluetooth-list-paired-devices user s.frings74 does, however, present a solution to this using JNI. Currently, this code is taken "as is". Currently, only for Android (so not mobile-on-desktop, or even desktop). And only generating logging data in the logcat. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-06-01Enable BT for iOS buildGravatar Robert C. Helling
and add some new source files to .pro file Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-01Use #if defined() instead of #ifGravatar Jan Mulder
qtcreator (4.3.0) got confused whether BT_SUPPORT was defined. Using work as expected. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-05-31Android BT download: hardcode UUIDGravatar Dirk Hohndel
While it seemed logical to use the advertized service UUID that doesn't appear to be working - instead using this hard coded UUID seems to do the trick. I now did a successful download from my Shearwater Petrel. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>