Commit graph

69 commits

Author SHA1 Message Date
Dirk Hohndel
cb48db275e Fix stupid packing error on Windows
I guess no one has ever tried to import Uemis dive data under Windows.

The glib-2 libraries for Windows (at least the ones that are part of the
mingw package, but my guess is this is true for all of them), force the
whole program to be compiled with Windows packing rules for structures.
That broke the structure we use for decoding Uemis binary data.

This commit changes the data structure to no longer use unaligned 16bit
values but instead two 8bit values and assemble them in the actual code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-09-26 10:58:39 -07:00
Dirk Hohndel
1d6903c65a Oddly, finishing a sample doesn't require a sample
So let's not pass it around

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2012-01-05 08:16:50 -08:00
Dirk Hohndel
0a9e5aa735 Return is not a function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-12-14 20:53:25 -08:00
Dirk Hohndel
485b02937d Even more places with pressure and volume conversions
Amazing at how many spots we are re-implementing the wheel.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-11-01 21:34:06 -07:00
Dirk Hohndel
3615675a62 Stop including regex.h
I removed the regex code from the uemis parser a long time ago, but forgot
to remove the #include <regex.h>

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-24 12:18:26 -07:00
Dirk Hohndel
831df38e05 Fixed off by one error in uemis importer
I clearly had never tried this with a dive that used the "just air"
setting the uemis. With this fix the cylinder data for that one tank is
read correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-20 13:11:26 -07:00
Dirk Hohndel
d7e35c512c Fix small typo in uemis event name
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-04 12:06:42 -07:00
Dirk Hohndel
0c343f2a47 Much nicer implementation of uemis sample parsing - and add events, too
This is something I wanted to do for a while. Every uemis sample is simply
a packed structure with no padding. Instead of grabbing random bytes from
the middle of an unstructured data blob let's just define the structure
and access its members.

And while we do that, add support for the more useful uemis events as
well.

A couple of the warnings are disabled by default (compile time flag) as
they are just crazy - any normal dive will give you dozens and dozens of
speed warnings. Same goes for the PO2 green warning (I haven't looked but
this seems to trigger on a PO2 over 1.0 or something). Completely useless
and just hides actually useful info.

I still want to redo the way we visualize events in general - just
printing the text ontop of the profile really is suboptimal. Especially as
the uemis really seems to love to repeat several of the warnings quite
frequently.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03 12:31:56 -07:00
Dirk Hohndel
09ef299044 Add working pressure to uemis tank data
Turns out they use 202.6bar as default working pressure. WTF?
Also I had misunderstood the way I should record the pressure internally
(which happened to work since I didn't set the working pressure). This is
now fixed as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03 09:58:24 -07:00
Dirk Hohndel
c15f798a85 Remove the ability to 'Import' .SDA files
We can instead 'Open' these files as they are just bastardized XML files.

This gets us back to a more consistent point where 'Import' gets data
directly from the dive computer (and hopefully soon we will add the
ability to load a dive directly from a uemis SDA to libdivecomputer),
and 'Open' loads a file from the filesystem of the computer we are
running on (this last sentence phrased so awkwardly as the uemis Zurich
SDA is a computer and presents a file system when connected via USB - it
just doesn't have the dive data in an accessible format in that file
system).

As a bonus we get to throw away quite a bit of code (the uemis specific
file handling, mini-XML parser with helper functions, the file open dialog
in the importer). Yay!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-03 08:34:56 -07:00
Dirk Hohndel
254b851e44 Integrate loading of uemis SDA files into the regular xml parsing
There are a few interesting issues with this:

- this requires a change to the SDA file format; thankfully I control that
  format, too (the default files are not valid XML files)
- once again, the fact that adding samples can change the dive pointer
  messes with me - I decided to change the interface of ALL of the
  XXX_dive_match functions to take a struct dive**
  I know this is not ideal as all the other functions don't need that -
  but I would have hated the inconsistency
- there is the issue that we now overload two _different_ uemis formats in
  the same function - that's certainly a potential point of confusion
- a minor detail is the problem that the SDA format is kinda odd to parse
  and that we trigger on the duration field by it being the only float.
  Yeah, that's not ideal - but again, I control the format, so I _know_
  this is true.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-02 22:20:29 -07:00
Dirk Hohndel
f2566ba561 First steps towards integrating SDA files into the default XML loading
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-02 22:18:41 -07:00
Dirk Hohndel
fe0eff8f1e prepare_sample reallocs the dive - don't keep pointers around
Thanks Valgrind

This diff looks pointless at first until you see that I reference dive
again earlier in the loop and then after the end of the loop.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-10-02 10:38:28 -07:00
Dirk Hohndel
775a081769 Correctly parse the braindamaged tank size information from uemis
Admittedly the cuft ratings are stupid, but still, it's not that hard.
In order to correctly describe a tank based on the cuft system you need to
know the cuft AND the working pressure. But the uemis Zurich always
assumes that the working pressure is 200bar. That's pretty close to
3000psi and therefore works "good enough" for Aluminum tanks - but in
general this will of course fail (e.g. for HP or LP tanks).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-29 22:12:42 -07:00
Dirk Hohndel
529412aa37 Fix uemis parser to work with base64 data that isn't a multiple of 3
I had forgotten the '=' sign as valid character in base64 code

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-29 18:01:58 -07:00
Dirk Hohndel
682135838f Separate out the UI from the program logic
The following are UI toolkit specific:
gtk-gui.c   - overall layout, main window of the UI
divelist.c  - list of dives subsurface maintains
equipment.c - equipment / tank information for each dive
info.c      - detailed dive info
print.c     - printing

The rest is independent of the UI:
main.c i    - program frame
dive.c i    - creates and maintaines the internal dive list structure
libdivecomputer.c
uemis.c
parse-xml.c
save-xml.c  - interface with dive computers and the XML files
profile.c   - creates the data for the profile and draws it using cairo

This commit should contain NO functional changes, just moving code around
and a couple of minor abstractions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2011-09-20 12:48:56 -07:00
Dirk Hohndel
fa76733d25 Fix depth calculations in SDA import
stole and fixed Linus' code in the uemis XML importer

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00
Dirk Hohndel
9ddef6854e Fix incorrect data dereference
This caused incorrect "missing Dive100" messages when importing SDA file
from the uemis Zurich.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00
Dirk Hohndel
518ec33ba3 First pass to parse uemis Zurich '.SDA' files
This is missing a ton of the information in the .SDA files It only
parses the divelog.SDA file, not the dive.SDA file It ignores the
information on the gas(es) used and all the data on the tanks.

It still draws some strange artefacts at the end of the dive

But it correctly hooks into the import dialogue, it gives you a file
select box (somewhere, I'm sure, a gtk developer cries quietly) and then
parses enough of this file to serve as a proof of concept.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 08:52:55 -07:00