Discussion:
[Gpsbabel-code] New Format: GDF binary
Jon Weissman
2016-08-17 22:49:48 UTC
Permalink
Hi all,

I am new to the gps development community. I work in wildlife
tracking, and two of the major GPS collar manufacturers use an
undocumented binary format they call GDF. I reverse engineered it and
wrote a ruby module to read/write it
(https://github.com/rgzn/gdf-ruby/blob/master/gdf.rb).

I know a lot of people who use gpsbabel, and it would be useful to the
wildlife tracking community to include the GDF format in gpsbabel. Is
this possible? Should I translate that stuff into C++ for the project?
If so, can you recommend a similar binary format already in the
codebase that I could use as a guide?

Thanks,
Jon Weissman
California Dept. of Fish and Wildlife

------------------------------------------------------------------------------
Robert Lipe
2016-08-17 23:38:52 UTC
Permalink
Hi, Jon, and welcome.

I think that format is the basis of what's used in our skytraq modules;
it's possible that the miniHomer file format might even work. It does the
same kind of squirreley "adjacent fields are in different endinaness"
things. I can't particularly point to it as a model of easy-to-read code;
it's very clearly a C file focused on banging bits and bytes and not C++
style where you could have a class TimeRecord that did the masks and shifts
for you.

We have an embarrassing wealth of options for reading and writing binary
files of weird endianness like this. I can't tell which endianness
dominates, so I'll just talk out aloud.
gbfopen{_be, _le) and use gbf{get,put)intXX and "fix" the endianness with
endian_read and endian_write or the (badly named) [bl]_{read,write}
brothers in defs.h.
You could use http://doc.qt.io/qt-4.8/qdatastream.html#raw - our ggv_bin.cc
module does that.


You almost certainly don't want to define a struct and fread them as
records and hope you can get the alignment and padding right on all
platforms; that rarely works.


At a higher level than the bit-banging, you should find "format_skeleton" a
reasonable high-level introductions to the callbacks and data structures.
README.contrib is meant to be our intro guide, but it doesn't get a lot of
new eyes on it, so what it describes and what you see may not always match.
We're a 15 year old project and things evolve.

geo.cc and easygps.cc are examples of XML and Binary formats that are
simple enough to recognize without a lot of study.

Generally, as you climb the stack from XML->Text->Binary->Comm Protocol,
the amount of WAT doubles at each level.

If you're a C++ dev, you'll notice that a lot of our older formats are very
much C code that happens to be legal C++. You'll see a lot of things like
calls to xmalloc/xfree vs. locally scoped objects that self-destruct, for
example.

Feel free to ask anything.
RJL
Post by Jon Weissman
Hi all,
I am new to the gps development community. I work in wildlife
tracking, and two of the major GPS collar manufacturers use an
undocumented binary format they call GDF. I reverse engineered it and
wrote a ruby module to read/write it
(https://github.com/rgzn/gdf-ruby/blob/master/gdf.rb).
I know a lot of people who use gpsbabel, and it would be useful to the
wildlife tracking community to include the GDF format in gpsbabel. Is
this possible? Should I translate that stuff into C++ for the project?
If so, can you recommend a similar binary format already in the
codebase that I could use as a guide?
Thanks,
Jon Weissman
California Dept. of Fish and Wildlife
------------------------------------------------------------
------------------
_______________________________________________
Gpsbabel-code mailing list http://www.gpsbabel.org
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code
Loading...