aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)Author
2015-01-10Refactor dctype -> divemodeGravatar Robert C. Helling
... and repair a failed rebase (sorry). Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-08Adjust array size to fit all csv paramsGravatar Anton Lundin
Back in e544796199eb ("Add missing divemaster field to the manual import"), divemaster field got added without extending the array length. This corrects that. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Add missing divemaster field to the manual importGravatar Dirk Hohndel
No idea why I didn't notice earlier that this was missing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-04Do not add uninitialized setpoint or ndlGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-31Add duration format to XSLT callGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-28Initial support for Divesoft FreedomGravatar Miika Turkia
This parses the dive profile from Divesoft Freedom log file. Only the depth profile is currently supported. There is also something wrong as the log file cannot be given as parameter but must be opened or imported once Subsurface is running. Note that so far no metadata is parsed. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-20Glue between GUI and XSLT for additions in CSV importGravatar Miika Turkia
This code sets the parameters properly to support the new fields in manual CSV import. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-20Bare implementation of Cobalt Divelog ProgramGravatar Miika Turkia
This implements importing of dive profile and temperature graph along with some meta data from a Cobalt Divelog database. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-13Remove debug printfGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-08Mark new string for translationGravatar Dirk Hohndel
This needs to be the same string as used for the entry in the Import dialog... since translate() is a macro in this .c file and defined to have only two arguments, I'm using the NOOP3 macro to get this correctly added to the translation sources, including the comment. That makes the code a little odd, but seems to work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-08Don't ignore when we can't parse a fileGravatar Dirk Hohndel
We are quite inconsistent when it comes to reporting back errors. One case where this caused somewhat unexpected behavior was when the user would try to open a .csv file by passing it as command line argument. The file was silently ignored, but treated as if it had been opened successfully. Now we issue a somewhat reasonable error message. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-08Fix a crash on CSV importGravatar Miika Turkia
Seems that there was not enough space reserved for the whole mem buffer when adding XML tags around CSV file. When unlucky, the metadata of memory allocation was overwritten. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-01file.c: fix uninitialized variableGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-25Allow user to select date format on manual CSV importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-25More O₂Gravatar Tim Wootton
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-20De-obfuscated Poseidon gaschange event buildingGravatar Anton Lundin
After some feedback on the mailing list, bitwise XOR wasn't the preferred way to build the gaschange event. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-20Adjust Poseidon Mouth piece event stringsGravatar Anton Lundin
After some feedback on the mailing list, these strings where preferred. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Document more about fields in Poseidon MkVI logsGravatar Anton Lundin
This is based on the great work done by Søren Reinke's on his MKVI Logfile Analyzer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Create more events from Poseidon MkVI logsGravatar Anton Lundin
This is based on the great work done by Søren Reinke's on his MKVI Logfile Analyzer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Create gaschange events from Poseidon MkVI logsGravatar Anton Lundin
This is based on the great work done by Søren Reinke's on his MKVI Logfile Analyzer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Create events from mouthpiece positionGravatar Anton Lundin
This is based on the great work done by Søren Reinke's on his MKVI Logfile Analyzer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Add support for importing CEILING from MKVI logsGravatar Anton Lundin
This is based on the great work done by Søren Reinke's on his MKVI Logfile Analyzer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19Import NDL from Poseidon MKVI logsGravatar Anton Lundin
This is based on the great work done by Søren Reinke's on his MKVI Logfile Analyzer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-18Fix issues in CCR handlingGravatar willem ferguson
In commit 0d7c192e6edc ("For CCR dives, the diluent cylinder is the current cylinder") a few things got broken. This tries to undo those changes and adds expanded XML output. 1) Calculate correct partial pressure of oxygen to be plotted on dive profile, taking into account the oxygen sensor data. Currently, erroneously, OC PO2 values are shown, due to an erroneous calling parameter to fill_pressures(). 2) Read start and end cylinder pressured correctly. some wrong assignments were done in file.c. This is now corrected and the correct cylinder pressures are shown in the equipment tab. 3) Write correct cylinder pressures to XML. Currently the data for the two cylinders are written to XML the wrong way round (diluent pressures = oxygen and vice versa). 4) Expand XML output: a) Write oxygen sensor data to XML b) Write no_of_02sensors to XML Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-17For CCR dives, the diluent cylinder is the current cylinderGravatar Robert C. Helling
Change the meaning that _the_ cylinder (as we treat it in OC dives) is the diluent cylinder (rather than the O2 cylinder). This eliminates special cases. Now, for CCR, we have to handle the O2 cylinder in addition (rather than the diluent in addition). Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-16Some gas handling improvementsGravatar Robert C. Helling
Add a time linear gas interpolation strategy. Some minor changes. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-15Initial support for Suunto DM5 importGravatar Miika Turkia
This implements import from Suunto DM5 database, but there is something wrong with some of the sample dives in the database I received as sample. It seems that we should detect missing/bogus data and treat it properly as divelogs.de does with the same dives. Anyway, when we have proper data, this import appears to produce sensible results. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-15Fix parsing of Windows new lines on Mk6 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-10Fix memory leakGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-10Use the new extra data interface for Poseidon importGravatar Miika Turkia
Rather than overflowing the notes field, let's add all the details from DC using the extra data API. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-08Remove unused variables and code from seabear-csvGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-07Added import for Liquivision LVD log filesGravatar John Van Ostrand
Support includes cylinder pressures and works for v3.0 log files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-06Reset counters when importing new MK6 logGravatar Miika Turkia
Naturally the pressure counters and cylinder index must be reset to zero when reading in a new Poseidon dive log. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-03Calculate nitrogen and helium gas pressures for CCR after import from CSVGravatar willem ferguson
Currently the gas pressures stored in structures of pressure are calculated using the gasmix composition of the currently selected cylinder. But with CCR dives the default cylinder is the oxygen cylinder (here, index 0). However, the gas pressures need to be calculated using gasmix data from cylinder 1 (the diluent cylinder). This patch allows setting the appropriate cylinder for calculating the values in the structures of pressure. It also allows for correctly calculating gas pressures for any open circuit cylinders (e.g. bailout) that a CCR diver may use. This is performed as follows: 1) In dive.h create an enum variable {oxygen, diluent, bailout} 2) Within the definition of cylinder_t, add a member: cylinder_use_type This stores an enum variable, one of the above. 3) In file.c where the Poseidon CSV data are read in, assign the appropriate enum values to each of the cylinders. 4) Within the definition of structure dive, add two members: int oxygen_cylinder_index int diluent_cylinder_index This will keep the indices of the two main CCR cylinders. 5) In dive.c create a function get_cylinder_use(). This scans the cylinders for that dive, looking for a cylinder that has a particular cylinder_use_type and returns that cylinder index. 6) In dive.c create a function fixup_cylinder_use() that stores the indices of the oxygen and diluent cylinders in the variables dive->oxygen_cylinder_index and dive->diluent_cylinder_index, making use of the function in 4) above. 7) In profile.c, modify function calculate_gas_information_new() to use the above functions for CCR dives to find the oxygen and diluent cylinders and to calculate partail gas pressures based on the diluent cylinder gas mix. This results in the correct calculation of gas partial pressures in the case of CCR dives, displaying the correct partial pressure graphs in the dive profile widget. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01Add pressures to cylinder declaration for MK6 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31Add .txt to notes on MK6 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-31Add gas mixes to MK6 importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30Set the number of O2 sensors for Poseidon MK6Gravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-28Assigment in if statementsGravatar Dirk Hohndel
This is one of the warnings that I agree with. The original code was very hard on my eyes... the explicit comparison to NULL is just so much easier to understand when reading the code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-28Parse meta information from Seaber logGravatar Miika Turkia
This will parse date information from Seabear log file and skips the "header" data to allow parsing of the CSV content. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27Finished Cochran dive log importGravatar John Van Ostrand
I fixed up the decode and finished the parse for Cochran EMC, Commander and Gemini computers. I suspect that this code may only work with files from certain versions of Cochran Analyst. It works with my own CAN files and with the samples that came with Analyst v4.01v. A seemingly arbitrary offset of 0x4914 is needed to access data. The previous code uses 0x4a14 and 0x4b14. I suspect these are from different version of Analyst. [Dirk Hohndel: whitespace cleanup, add files to subsurface.pro, made sure this compiles without the corresponding patch to libdivecomputer (that isn't upstream, yet), cleaned up the usage of structs, removed a few unused variables] Signed-off-by: John Van Ostrand <john@vanostrand.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27Quiet some warningsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27Set old setpoint value, if new one is not recordedGravatar Miika Turkia
Since the setpoint value is initialized as zero, we have to set the previous value if we do not have a current reading. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-26Support for importing Poseidon MK6 logsGravatar Miika Turkia
This patch adds support for importing the logs from a Poseidon MK6 rebreather. This DC produces logs that contain of a .txt file that has all the meta data and a .csv file that contains the sample readings. The CSV file is different from the others in that it has a line per each sample reading at given time. Thus we have to merge all the lines from one point in time into one sample reading of ours. [Dirk Hohndel: addressed some compiler warnings] Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-13Ignore pictures when parsing divelogs.de importGravatar Miika Turkia
Do not do XML parse on pictures. Currently just ignore them, in the future we might want to save them somewhere and include them in Subsurface logs. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10Add support for importing pressure from CSV filesGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09Add support for importing TTS from CSV filesGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09Add support for importing NDL from CSV filesGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14Convert other users of showError() to the new world orderGravatar Linus Torvalds
The "report_error()" interface is a lot simpler, although some of the C++ code uses QStrings which make them a bit annoying, especially for the varargs model. Still, even with the explicit conversion to UTF8 and "char *", the report_error() model is much nicer. This also just makes refreshDisplay() do the error reporting in the UI automatically, so a number of error paths don't even have to worry. And the multi-line model of error reporting means that it all automatically does the right thing, and reports errors for each file rather than just for the last file that failed to open. So this removes closer to a hundred lines of cruft, while being a simpler interface and doing better error reporting. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-12Stop using the "git descriptor file" modelGravatar Linus Torvalds
Instead, just encode the git repository information in the filename. We want to make it much harder to make it match a real filename, but to still allow easy browsing with the file manager interface. So the git repository "filename" format is the path to the git repository directory, with the branch name encoded as "[branch]" at the end rather than the "path:branch" format that we used in the descriptor file. [ For example, on Windows, a filename like "c:\my.xml" could be interpreted as the branchame "\my.xml" in the repository in the directory "c" ] In particular, with this model, no filename that ends with ".xml" could possibly ever be considered a git repository name, since the last character of a git pathname is always ']'. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>