Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anybody have experience reading ISOBUS (ISO 11783-10) binary timelog files?

I am trying to open and read a bunch of geo-referenced timelog files that are in binary format. They supposedly follow the ISO-11783 (ISOBUS) standard for agricultural machinery, but after reading 100s of pages of the standard I cannot figure out how to read the files either with a hex editor or programmatically with .NET c#. I know the timelog comes in file-pairs: an xml file and a binary file. The binary file, for example, is named TLG00004.bin and in notepad it looks like this (partial):

binary file in Notepad

and when I open that file in Visual Studio 2015 (Community) as a binary file the hex looks like this:

enter image description here

which does not help me. I don't even know how to begin reading this as a byte stream in code (or anything else for that matter).

I know the file is supposed to look like this in human readable form: (TimeStart, PositionNorth, PositionEast, PositionStatus, # DLV, DLV 0, PDV 0, DLV 1, PDV 1, DLV 2, PDV 2,...) it can have up to 255 DLV-PDV pairs which I believe are 32-bit integers. An example was shown as: (2005-05-02T16:32:00,51.00678,6.03489,1,2,0,10,1,15)

Little hints I have seen in the documentation indicate to me this must be utf-8 and perhaps base64 encoding with little endian and no Byte Order Mark. But I tried opening this in the free version of Hexinator and can't (human) read it using any of the dozens of encodings in that app, including utf-8, 16, 32...

I know this is not normal programming stuff but am throwing it out there to see if I'm lucky enough that someone has done this before and sees this. Any hints or resource-pointing would find me grateful, and I would be very thankful if someone can share any code that reads this kind of file.

like image 667
hullflyer Avatar asked Jan 21 '17 20:01

hullflyer


1 Answers

Your data seems to follow the ISO 11783-10 standard for "Log data binary file structure" data exchange.

You will need to unpack your binary data into data types according to the specification. For example, the first 32 bits of the data are the milliseconds since midnight stored as a 32 bit unsigned integer. The next 16 bits are the days since 1980-01-01 stored as a 16 bit unsigned integer.

Unpacking binary data is programming language specific and some programming languages have useful libraries to assist in shifting through binary data.

As your question is about the general parsing of ISOBUS and I'm not proficient in your given language (C#), I can only give you an initial pointer.

BinaryReader looks to be the ideal way of unpacking a binary file by reading a number of bits from a stream and advancing the pointer through it:

using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
        {
            milliSecondsSinceMidnight = reader.ReadUInt32();
            daysSince1980 = reader.ReadUInt16();
        }

If you need further help, you can now ask a specific question about byte parsing in C#.

like image 173
Alastair McCormack Avatar answered Oct 15 '22 05:10

Alastair McCormack