Exemple #1
0
Ais8_1_26_Wx::Ais8_1_26_Wx(const AisBitset &bits,
                           const size_t offset) {
  air_temp = bits.ToInt(offset, 11) / 10.;
  air_temp_sensor_type = bits.ToUnsignedInt(offset + 11, 3);
  precip = bits.ToUnsignedInt(offset + 14, 2);
  horz_vis = bits.ToUnsignedInt(offset + 16, 8) / 10.;
  dew_point = bits.ToInt(offset + 24, 10) / 10.;
  dew_point_type = bits.ToUnsignedInt(offset + 34, 3);
  air_pressure = (bits.ToUnsignedInt(offset + 37, 9) + 800) / 100.0;  // Pa.
  air_pressure_trend = bits.ToUnsignedInt(offset + 46, 2);
  air_pressor_type = bits.ToUnsignedInt(offset + 48, 3);
  salinity = bits.ToUnsignedInt(offset + 51, 9) / 10.;
  spare = bits.ToUnsignedInt(offset + 60, 25);
}
Exemple #2
0
Ais8_1_26_WaterLevel::Ais8_1_26_WaterLevel(const AisBitset &bits,
                                           const size_t offset) {
  type = bits[offset];
  level = bits.ToInt(offset + 1, 16) / 100.;
  trend = bits.ToUnsignedInt(offset + 17, 2);
  vdatum = bits.ToUnsignedInt(offset + 19, 5);
  sensor_type = bits.ToUnsignedInt(offset + 24, 3);
  forecast_type = bits[offset + 27];
  level_forecast = bits.ToInt(offset + 28, 16) / 100.;
  utc_day_forecast = bits.ToUnsignedInt(offset + 44, 5);
  utc_hour_forecast = bits.ToUnsignedInt(offset + 49, 5);
  utc_min_forecast = bits.ToUnsignedInt(offset + 54, 6);
  duration = bits.ToUnsignedInt(offset + 60, 8);
  spare = bits.ToUnsignedInt(offset + 68, 17);
}
Exemple #3
0
// IMO Circ 289 - Tidal Window
// See also Circ 236
Ais6_1_14::Ais6_1_14(const char *nmea_payload, const size_t pad)
    : Ais6(nmea_payload, pad), utc_month(0), utc_day(0) {
  // TODO(schwehr): untested - no sample of the correct length yet
  assert(dac == 1);
  assert(fi == 14);

  if (num_bits != 376) {
    status = AIS_ERR_BAD_BIT_COUNT;
    return;
  }

  AisBitset bs;
  const AIS_STATUS r = bs.ParseNmeaPayload(nmea_payload, pad);
  if (r != AIS_OK) {
    status = r;
    return;
  }

  bs.SeekTo(88);
  utc_month = bs.ToUnsignedInt(88, 4);
  utc_day = bs.ToUnsignedInt(92, 5);

  for (size_t window_num = 0; window_num < 3; window_num++) {
    Ais6_1_14_Window w;
    const size_t start = 97 + window_num * 93;
    // Reversed order for lng/lat.
    float y = bs.ToInt(start, 27) / 600000.;
    float x = bs.ToInt(start + 27, 28) / 600000.;
    w.position = AisPoint(x, y);
    w.utc_hour_from = bs.ToUnsignedInt(start + 55, 5);
    w.utc_min_from = bs.ToUnsignedInt(start + 60, 6);
    w.utc_hour_to = bs.ToUnsignedInt(start + 66, 5);
    w.utc_min_to = bs.ToUnsignedInt(start + 71, 6);
    w.cur_dir = bs.ToUnsignedInt(start + 77, 9);
    w.cur_speed  = bs.ToUnsignedInt(start + 86, 7) / 10.;

    windows.push_back(w);
  }

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
Exemple #4
0
Ais8_1_26_SeaState::Ais8_1_26_SeaState(const AisBitset &bits,
                                       const size_t offset) {
  swell_height = bits.ToUnsignedInt(offset, 8) / 10.;
  swell_period = bits.ToUnsignedInt(offset + 8, 6);
  swell_dir = bits.ToUnsignedInt(offset + 14, 9);
  sea_state = bits.ToUnsignedInt(offset + 23, 4);
  swell_sensor_type = bits.ToUnsignedInt(offset + 27, 3);
  water_temp = bits.ToInt(offset + 30, 10) / 10.;
  water_temp_depth = bits.ToUnsignedInt(offset + 40, 7) / 10.;
  water_sensor_type = bits.ToUnsignedInt(offset + 47, 3);
  wave_height = bits.ToUnsignedInt(offset + 50, 8) / 10.;
  wave_period = bits.ToUnsignedInt(offset + 58, 6);
  wave_dir = bits.ToUnsignedInt(offset + 64, 9);
  wave_sensor_type = bits.ToUnsignedInt(offset + 73, 3);
  salinity = bits.ToUnsignedInt(offset + 76, 9) / 10.;
}