Clean up AIS lat/lon types and formatting.

This commit is contained in:
Jared Boone 2016-01-15 15:25:32 -08:00
parent 1e92d416c7
commit f3989050e8
4 changed files with 82 additions and 13 deletions

View file

@ -178,13 +178,13 @@ DateTime Packet::datetime(const size_t start_bit) const {
Latitude Packet::latitude(const size_t start_bit) const {
// Shifting and dividing is to sign-extend the source field.
// TODO: There's probably a more elegant way to do it.
return static_cast<int32_t>(field_.read(start_bit, 27) << 5) / 32;
return field_.read(start_bit, 27);
}
Longitude Packet::longitude(const size_t start_bit) const {
// Shifting and dividing is to sign-extend the source field.
// TODO: There's probably a more elegant way to do it.
return static_cast<int32_t>(field_.read(start_bit, 28) << 4) / 16;
return field_.read(start_bit, 28);
}
bool Packet::crc_ok() const {