public String createGLL(SignalKModel model) { if (model.get(vessels_dot_self_dot + nav_position_latitude) != null && model.get(vessels_dot_self_dot + nav_position_longitude) != null) { GLLSentence sen = (GLLSentence) sf.createParser(TalkerId.GP, SentenceId.GLL); sen.setTime(new Time()); sen.setStatus(DataStatus.ACTIVE); sen.setPosition( new Position( (double) model.get(vessels_dot_self_dot + nav_position_latitude), (double) model.get(vessels_dot_self_dot + nav_position_longitude))); return sen.toSentence(); } return null; }
// RMC,GLL, GGA = position public String createRMC(SignalKModel model) { if (model.get(vessels_dot_self_dot + nav_position_latitude) != null && model.get(vessels_dot_self_dot + nav_position_longitude) != null) { RMCSentence sen = (RMCSentence) sf.createParser(TalkerId.GP, SentenceId.RMC); sen.setDate(new Date()); sen.setStatus(DataStatus.ACTIVE); sen.setMode(FaaMode.AUTOMATIC); sen.setPosition( new Position( (double) model.get(vessels_dot_self_dot + nav_position_latitude), (double) model.get(vessels_dot_self_dot + nav_position_longitude))); if (model.getValue(vessels_dot_self_dot + nav_speedOverGround) != null) { sen.setSpeed( (double) model.getValue(vessels_dot_self_dot + nav_speedOverGround) * MS_TO_KNOTS); } if (model.get(vessels_dot_self_dot + nav_courseOverGroundTrue) != null) { sen.setCourse( Math.toDegrees( (double) model.getValue(vessels_dot_self_dot + nav_courseOverGroundTrue))); } if (model.get(vessels_dot_self_dot + nav_magneticVariation) != null) { Double variation = (Double) model.getValue(vessels_dot_self_dot + nav_magneticVariation); if (variation != null) { sen.setVariation(Math.toDegrees(Math.abs(variation))); sen.setDirectionOfVariation((variation < 0) ? CompassPoint.WEST : CompassPoint.EAST); } } return sen.toSentence(); } return null; }