28 November 2011

Packetlogger documentation: the analyzer program

The analyzer program contains the 'secret sauce'. It uses a database of PGN contents that has been painstakingly reverse engineered from observation of my network. I have not seen, read or otherwise obtained any material that I was not allowed to redistribute. Again this utility is very simple. It consumes the 'raw' ASCII PGNs produced by the reader utilities on stdin, and writes out the parsed PGNs. In a second mode it can also produce a human or computer readable form of the PGN database that it contains. So if you have saved the output of the reader in a file, you can analyze the data at a later data like this:
analyzer < your-actisense-output.log
For instance if we do that for the following output:
and use the above command to analyze this we get:
N2K packet analyzer $Rev: 233 $ from $Date: 2011-11-27 22:21:08 +0100 (zo, 27 nov 2011) $
(C) 2009-2011 Keversoft B.V., Harlingen, The Netherlands

New PGN 127251 for device 36 (heap 5452 bytes)
2011-11-24-22:42:04.388 2  36 255 127251 Rate of Turn:  SID = 125; Rate = 0.0934 deg/s
New PGN 127250 for device 36 (heap 5467 bytes)
2011-11-24-22:42:04.390 2  36 255 127250 Vessel Heading:  SID = 0; Heading = 182.4 deg; Deviation = 0.0 deg; Variation = 0.0 deg; Reference = Magnetic
New PGN 130306 for device 36 (heap 5480 bytes)
2011-11-24-22:42:04.437 2  36 255 130306 Wind Data:  SID = 177; Wind Speed = 0.92 m/s; Wind Angle = 353.4 deg; Reference = Apparent
Now this output is readable for humans, but not very good for computers to parse and process further. If you want to use the analyzer in your software you're better of using the -json option which will produce lines like this:
{"timestamp":"2011-11-24-22:42:04.388","prio":"2","src":"36","dst":"255","pgn":"127251","description":"Rate of Turn","fields":{"SID":"125","Rate":"0.0934"}}
{"timestamp":"2011-11-24-22:42:04.390","prio":"2","src":"36","dst":"255","pgn":"127250","description":"Vessel Heading","fields":{"SID":"0","Heading":"182.4","Deviation":"0.0","Variation":"0.0","Reference":"Magnetic"}}
{"timestamp":"2011-11-24-22:42:04.437","prio":"2","src":"36","dst":"255","pgn":"130306","description":"Wind Data","fields":{"SID":"177","Wind Speed":"0.92","Wind Angle":"353.4","Reference":"Apparent"}}
The analyzer's second mode of producing the database that is kept within it can be accessed with the -explain and -explain-xml arguments. Further arguments are used when you are analyzing a particular PGN or a particular device.
-rawShow the raw bytes of the message data following the parsed data
-debugShows internal values of the parser; probably not readable for anyone but me.
-geo {dd|dm|dms}Choose which format is used to print geographical locations.
-jsonFormat the output as JSON computer readable data.
-src <src>Ignore input coming from other sources than the specified one.
<pgn>Ignore PGNs other than this one.
-clocksrc <src>Set the computer's clock with data from this source.
-explainProduce the human readable list of PGNs that the parser understands.
-explain-xmlProduce the computer readable list, in XML format, of PGNs that the parser understands.
The -clocksrc argument is only supported on Linux and OS X. There is a -data argument, but that is not complete yet and will crash the analyzer.

No comments:

Post a Comment