Class NMEA2000Message

java.lang.Object
org.episteme.natural.device.loaders.nmea.NMEA2000Message

public class NMEA2000Message extends Object
NMEA 2000 (CAN-based marine protocol) message parser and representation.

NMEA 2000 uses PGNs (Parameter Group Numbers) to identify message types. This parser handles the binary CAN frame format used by NMEA 2000.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • NMEA2000Message

      public NMEA2000Message(int pgn, int priority, int source, int destination, byte[] data)
  • Method Details

    • fromCANFrame

      public static NMEA2000Message fromCANFrame(int canId, byte[] data)
      Parses a CAN frame into an NMEA 2000 message.
      Parameters:
      canId - the 29-bit CAN extended identifier
      data - the CAN frame data (up to 8 bytes)
    • getPGN

      public int getPGN()
    • getPGNType

      public NMEA2000Message.PGN getPGNType()
    • getPriority

      public int getPriority()
    • getSource

      public int getSource()
    • getDestination

      public int getDestination()
    • getData

      public byte[] getData()
    • getTimestamp

      public long getTimestamp()
    • getInt16

      public int getInt16(int offset)
      Gets a signed 16-bit value from the data at the specified byte offset.
    • getUInt16

      public int getUInt16(int offset)
      Gets an unsigned 16-bit value from the data at the specified byte offset.
    • getInt32

      public long getInt32(int offset)
      Gets a 32-bit value from the data at the specified byte offset.
    • parseLatitude

      public double parseLatitude()
      Parses latitude from GNSS position PGN (129029).
      Returns:
      latitude in degrees or NaN if not applicable
    • parseLongitude

      public double parseLongitude()
      Parses longitude from GNSS position PGN (129029).
      Returns:
      longitude in degrees or NaN if not applicable
    • parseHeading

      public double parseHeading()
      Parses heading from Vessel Heading PGN (127250).
      Returns:
      heading in radians or NaN if not applicable
    • parseDepth

      public double parseDepth()
      Parses depth from Water Depth PGN (128267).
      Returns:
      depth in meters or NaN if not applicable
    • parseWindSpeed

      public double parseWindSpeed()
      Parses wind speed from Wind Data PGN (130306).
      Returns:
      wind speed in m/s or NaN if not applicable
    • parseWindAngle

      public double parseWindAngle()
      Parses wind angle from Wind Data PGN (130306).
      Returns:
      wind angle in radians or NaN if not applicable
    • toString

      public String toString()
      Overrides:
      toString in class Object