void message_10::read_data(const raw & bits) { bits.get(repeat_indicator, 6, 2); bits.get(mmsi, 8, 30); // spare 38 - 39 bits.get(dest_mmsi, 40, 30); // spare 70 - 71 }
void message_23::read_data(const raw & bits) { bits.get(repeat_indicator, 6, 2); bits.get(mmsi, 8, 30); // spare: 38 - 39 bits.get(ne_lon, 40, 18); bits.get(ne_lat, 58, 17); bits.get(sw_lon, 75, 18); bits.get(sw_lat, 93, 17); bits.get(station_type, 110, 4); bits.get(shiptype, 114, 8); // spare: 122 - 143 bits.get(txrx_mode, 144, 2); bits.get(interval, 146, 4); bits.get(quiet_time, 150, 4); // spare: 154 - 159 }
/// Reads a string from the AIS message at the specified offset. /// The string is decoded and returned. /// /// @param[in] bits The AIS message. /// @param[in] ofs The offset at which the string is being read. /// @param[in] count_sixbits Number of sixbits to be read. /// @return The decoded string. /// /// @todo consider to hide characters after '@' std::string binary_data::read_string( const raw & bits, raw::size_type ofs, raw::size_type count_sixbits) { std::string s; s.reserve(count_sixbits); for (raw::size_type i = 0; i < count_sixbits; ++i) { uint8_t sixbit = 0; bits.get(sixbit, ofs + i * 6, 6); s += decode_sixbit_ascii(sixbit); } return s; }
void message_01::read_data(const raw & bits) { bits.get(repeat_indicator, 6, 2); bits.get(mmsi, 8, 30); bits.get(nav_status, 38, 4); bits.get(rot, 42, 8); bits.get(sog, 50, 10); bits.get(position_accuracy, 60, 1); bits.get(longitude_minutes, 61, 28); bits.get(latitude_minutes, 89, 27); bits.get(cog, 116, 12); bits.get(hdg, 128, 9); bits.get(timestamp, 136, 6); bits.get(maneuver_indicator, 143, 2); // spare: 145 - 147 bits.get(raim, 148, 1); bits.get(radio_status, 149, 19); }