aboutsummaryrefslogtreecommitdiffstats
path: root/core
AgeCommit message (Collapse)Author
2018-09-29Bluetooth: turn on logging earlierGravatar Dirk Hohndel
This way we should get logging output for the discovery phase as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-28Parser: parse text-based files into arbitrary tableGravatar Berthold Stoeger
In d815e0c9476ef62e6b84fb28ce48ab7cddefe77e a dive_table pointer was added to the parsing functions to allow parsing into tables other than the global dive table. This will be necessary for undo of import and implementation a cleaner interface. A few cases, notably CSV and proprietary formats were forgotten. Implement parsing into arbitrary tables also for these cases. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-28Cleanup: remove redundant prototypes from dive.hGravatar Berthold Stoeger
A few of these prototypes were already in import-csv.h. Put them in an 'extern "C" { ... }' block. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-28Cleanup: Make add_sample_data() local to translation unitGravatar Berthold Stoeger
This function in parse_csv.c was not used anywhere. Make it of static linkage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-26qt-ble: allow reading of partial packet dataGravatar Linus Torvalds
The existing BLE dive computers treat BLE as the packetized protocol it is, and read whole packets at a time. However, the Mares BlueLink backend treats it as just a basic "serial over BLE" transport, and for historical reasons reads the reply packets in smaller chunks. This allows that kind of IO behavior, where if the divecomputer backend reads just a part of a packet, we'll split the packet, return the part the user asked for, and push back the leftover packet onto the received packet queue. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-26Allow XML sample times to have hh:mm:sec formatGravatar Linus Torvalds
We traditionally only allow samples to have a time format of 'mm:ss', so if you have a dive over an hour, you would just have a minutes field larger than 60 minutes. But Matthew Critchley is trying to import some dives from his VMS Redbare CCR, and the sample timestamp format he has is of the type 'hh:mm:ss'. That could be fixed by a xslt translation, but there's no real reason why we couldn't just support that format too. Reported-by: Matthew Critchley <matthew.s.critchley@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-25qt-ble: add BLE packet debugging codeGravatar Linus Torvalds
This is perhaps overly verbose, but the timing details helped figure out some EON Core download issues, and it's nice to see when things actually happen. It's also good to see when the data actually enters our queues, and when we read and write the packets. That might help debug the issues Fabio is seeing with the Mares Bluelink. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-25qt-ble: only connect the signals to the preferred serviceGravatar Linus Torvalds
We used to just find all services and connect the characteristics change signal etc to them all, but we really only care about the actual preferred service that we'll be using. So move the qt ble signal connection to after we've selected the preferred service that we will actually be enabling notifications on and do the writes to. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-25Metadata: rudimentary support for XMP metadataa in MP4-based videosGravatar Berthold Stoeger
XMP is a media-metadata standard based on XML which may be used across a variety of media formats. Some video-processing software writes XMP data without updating the native metadata fields. Therefore, we should aim at reading XMP metadata and give priority of XMP data over native fields. Pros: - Support for *all* common media formats. Cons: - XML (complex, verbose, chaotic). - Does not even come close to fulfilling its promise of being well defined (see below). Implement a simple XMP-parser using libxml2. Connect the XMP-parser to the existing Quicktime/MP4 parser. First problem encountered: According to the spec, XMP data supposed to be put in the 'XMP_' atom. But for example exiftools instead writes an 'uuid' atom with a special 16-byte uid. Implement both, more options will probably follow. Second problem: two versions of recording the creation date were found 1) The content of a <exif:DateTimeOriginal> tag. 2) The xmp::CreateDate attribute of a <rdf:Description> tag. Here too, more versions are expected to surface and will have to be supported in due course (with an obvious priority problem). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-25cleanup: do not compare doubles like thisGravatar Jan Mulder
Cleanup another possibly dangerous compare of doubles. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-25qPref: don't compare doubles for equalityGravatar Dirk Hohndel
This is a much safer way to do this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-25qPref: add mobile_scale preferenceGravatar Dirk Hohndel
We use that in the mobile app to scale the whole app, as all sizes there are relative to the default font. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-24qt-ble: re-organize how we pick the GATT characteristics to read and writeGravatar Linus Torvalds
We used to just blindly pick "first" and "last" characteristic from the preferred service, and that was stupid but happened to work for the dive computers we supported. Note that for some of them, "first" and "last" was actually the *same* characteristic, since it could be a single one that supported both. However, this first/last hack definitely doesn't work for the Mares BlueLink BLE dongle, and it's really all pretty wrong anyway. So re-organize the code to actually look at the properties of the characteristics. I don't have a BlueLink to test with, but my EON Core and Shearwater Perdix AI are still happy with this, and the code conceptually makes a lot more sense. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-24macOS: always list 'FTDI' as a serial connectionGravatar Dirk Hohndel
We now link against the user space FTDI driver. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-24cleanup: remove more GPS webservice codeGravatar Jan Mulder
And remove some includes and defines that are not used any more after removal of the GPS webservice code. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-24core: fix connect callGravatar Jan Mulder
Fix multiple run-time errors in connect call introduced in 504e9125126. 1) Set the proper signature of the signal. 2) make the used slot a real slot (so move it to the proper section in the header) and 3) set the proper signature for the slot. Highly unlikely that normal users notice the runtime errors and possibly unwantend behavior, as this all deals with the subtile GPS service update threshold. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-23qt-ble: set up infrastructure for better preferred service choiceGravatar Linus Torvalds
We used to just pick the first non-standard service we found (with a special case for the Heinrichs Weikamp dive computers that have an actual registered standard service). We then waited for that service to finish discovery, and started using it. This changes the logic to wait for _all_ services to finish discovery, and then after that we pick the one we like best. Right now the rule for picking a preferred service is the same one we had before, but the difference is that we now have the full discovery data, so we *could* do something better. Plus this makes our debug messages a lot more legible, when we don't have the mix of overlapping service discovery with the actual IO we do to the preferred service. NOTE! This doesn't much matter for most of the dive computers that we currently support BLE for. They don't tend to have a lot of odd services. But at least both the Mares BlueLink and the Garmin Descent both have multiple services and it's not obvious which one to use, and this will make it not only easier to debug those, it will make it easier to pick the right preferred service descriptor to use. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-23qt-ble: use the WAITFOR() macro rather than open-coding wait loopsGravatar Linus Torvalds
This is not only much clearer (and smaller code), but it also lowers the latency for the waiting, since we don't always wait for the full 100ms. Get rid of the now unused "waitfor()" function that just unconditionally waited for 100ms. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-09-23Core: split process_dives() in post-import and post-load versionsGravatar Berthold Stoeger
process_dives() is used to post-process the dive table after loading or importing. The first parameter states whether this was after load or import. Especially in the light of undo, load and import are fundamentally different things. Notably, that latter should be undo-able, whereas the former is not. Therefore, as a first step to make import undo-able, split the function in two versions and remove the first parameter. It turns out the the load-version is very light. It only sets the DC nicknames and sorts the dive-table. There seems to be no reason to merge dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-23Mobile/remember DCs: try to match device namesGravatar Dirk Hohndel
We only store the address part of the connection name, so don't try to find an exact match, try to find the sub-string. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23Desktop/remember DCs: move non-UI-specific code into the core layerGravatar Dirk Hohndel
This way we can use the same functionality from the mobile UI as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-23qPref: add ability to remember recently used dive computersGravatar Dirk Hohndel
This does feel clumsy and complicated. This is a lot of special case handling and a lot of boilerplate for something that really should be quite simple. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-22Trivial: un-static function-local bufferGravatar Berthold Stoeger
In visit_on_node() in core/parse-xml.c the name is extracted into a static buffer. There seems to be no need for this being static, as the name is only passed to the entry() function which (hopefully) does not store a reference to the name anywhere. If it does, this would need a *big* *fat* comment. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-22Actually create a UUID when creating a dive site during downloadGravatar Linus Torvalds
The existing code creates a deterministic ID (not exactly "unique") in order to help us avoid merge conflicts in git-storage mode. But as a side effect, if we re-download the same dive twice from a dive computer that supports GPS (right now only the Garmin Descent Mk1) we are guaranteed to create the same dive site uuid when we do this. So when we download a dive - whether we will actually *use* that dive later or not - we will be filling in the dive site information with the data we got from the dive computer. ... and in the process we will be overwriting any data that was filled in manually. The name of the dive site, but also possibly even the GPS of the dive site (maybe the user decided to edit that using the map, because while the automatically downloaded GPS data was "correct", maybe the user wanted to change it to be the actual under-water location using the satellite data, rather than the place where you started the dive or where you surfaced). In order to avoid this collision, this patch just makes the libdivecomputer download not use the dive time, but "time of download" for the dive site time, and thus effectively generate a new uuid for every download. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-19Dive media: on import read metadata only onceGravatar Berthold Stoeger
On import of dive media, the timestamp is read from the metadata to check if the image belongs to the selected dives. The pictures are then listed in a dialog. Currently, the metadata is read twice if images are outside of a dive: once in picture_check_valid() and if it turns out that the picture is not valid again in picture_get_time() to display the proper timestamp. Even though metadata-extraction is reasonably fast, this is a bit of an embarrassment. Instead, read the timestamps only once in the constructor of the dialog and from then on only used these timestamps. Keep the timestamps in a QVector. Rename the picture_check_valid() function to picture_check_valid_time() and pass a timestamp instead of a filename. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-19Cleanup: make surface sample in merge_one_sample() non-staticGravatar Berthold Stoeger
The merge_one_sample() function adds a sample to the destination dive if dives are merged. For long periods between samples at surface depths, it adds a surface interval. To decrease the number of global objects, make the sample structure non-static. Of course, initialization of an on-stack structure is slower. Therefore move it into the corresponding if. Thus, the structure will be initialized only once per surface-interval. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-19Mobile: always update the preferences when set_unit_system is calledGravatar Jocke
Unit_system is read from git storage but units are set from locale when the app starts. To prevent a miss-match between unit and unit_system we have to always update the preferences variable when set_unit_system is called so that the user doesn't end up with imperial units when the preferences say metric. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-16Always return status from ftdi_open when calledGravatar Anton Lundin
Using dc_serial_open as a fallback to ftdi_open is just wrong, and will never work, just mask the real error and introduce read herrings. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-09-13Optional anonymization upon exportGravatar Robert C. Helling
Add a checkbox that triggers replacement of all English characters by x's in notes, buddy, dive guide and (while we are at it) suit. This is ment for people sharing logs for debugging that are concious about privacy issues. It leaves the lenth of strings in tact as well as special charcters as those might be needed to track down a particular parsing problem. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-09-12core: connect qPref..::time_thresholdChanged to setGpsTimeThresholdGravatar jan Iversen
Automate calling of setGpsTimeThreshold when qPref..::time_threshold changes and thus avoiding the need to call setGpsTimeThreshold directly. Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-12serial_ftdi: use Sleep() on Win32Gravatar Lubomir I. Ivanov
Windows doesn't have nanosleep() unless libwinpthread is used. Since the nanosleep() usage in serial_ftdi_sleep(): - does not break in case of EINTR - has input in milliseconds the WINAPI Sleep() should be a good alternative. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-09-12Planner: fix display of "overlapping dives" messageGravatar Berthold Stoeger
1) Add a missing <div> 2) More importantly: recognize html content via <div>-tags instead of <table>-tags. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-12DLF import: Remove old debug printGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-09-12DLF import: Decode all sensors, when we got them.Gravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-09-12DLF import: Set initial gas as first cylinderGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-09-12DLF import: Name dive siteGravatar Anton Lundin
The UI doesn't behave all that nice without name on the dive site. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-09-12DLF import: Decode device configuration into extra stringsGravatar Anton Lundin
These save a lot of different info about the computer, so decode them into extra strings. Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-09-12DLF import: Create separate solenoid open/close eventsGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-09-12BLE: add Teric to list of auto-detected Shearwater computersGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-12DLF import: record starting battery levelGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-09-12DLF import: use battery_end in preparationGravatar Miika Turkia
Prepare for recording both start and end pressures. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2018-09-11core/settings: correct UserSurvey -> userSurvey in qPrefDisplayGravatar jan Iversen
QML is quite special, the variables needs to start with lower case in C++ and are used starting with upper case in QML Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core/settings: optimize base_url functions.Gravatar jan Iversen
Remove unused variable and create of QString. Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core/settings: use instance() in qPref macrosGravatar jan Iversen
use instance() instead of <class>::instance() Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core/settings: change bestmixend to int, to allow qml to workGravatar jan Iversen
depth_t is a good struct in C, but bad in QML. Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core/settings: correct wrong emit in qPrefFacebookGravatar jan Iversen
Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core/settings ... : remove qPref* includes in qPref.hGravatar jan Iversen
reduce number of includes by removing qPref* includes in qPref.h Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core: declare cloud_status in qPrefCloudStorageGravatar jan Iversen
qml declaration of cloud_status (defined in pref.h) does not belong in qPref.h but in qPrefCloudStorage Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core/tests: change short to int in pref.hGravatar jan Iversen
Simplify structure preferences by removing short. Update test cases to not do (int). Signed-off-by: Jan Iversen <jani@apache.org>
2018-09-11core,tests: change qml register functionGravatar jan Iversen
In order to address the C++ object directy in qml, a different registration is needed. qmlRegisterType, registers the C++ class, allowing qml code to inherit from it and make qml objects. This is needed for graphical elemnets like profile and map setContentProperty, registers the C++ object, thus allowing signals to be catched. Signed-off-by: Jan Iversen <jani@apache.org>