Skip to content

Commit

Permalink
compiles but does not work
Browse files Browse the repository at this point in the history
git-svn-id: https://cowfish.unh.edu/projects/schwehr/trunk/src/libais@14085 a19cddd1-5311-0410-bb07-9ca93daf0f0b
  • Loading branch information
schwehr committed Jul 7, 2010
1 parent c2c9498 commit 089da02
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ais15.cpp
Expand Up @@ -2,21 +2,25 @@

#include "ais.h"

Ais9::Ais9(const char *nmea_payload) {
Ais15::Ais15(const char *nmea_payload) {
assert(nmea_payload);
init();

const int num_char = str_len(nmea_payload);
if !(num_char == 162/6 || num_char== ) {
status = AIS_ERR_BAD_BIT_COUNT;
return;
const int num_char = std::strlen(nmea_payload);
if (!(num_char >= 14/6 && num_char<=27)) {
// 88-160 bits
status = AIS_ERR_BAD_BIT_COUNT;
return;
}

std::bitset<162> bs; // 160 / 6 = 26.66
status = aivdm_to_bits(bs, nmea_payload);
if (had_error()) return;

message_id = ubits(bs, 0, 6);
if (9 != message_id) { status = AIS_ERR_WRONG_MSG_TYPE; return; }
if (15 != message_id) { status = AIS_ERR_WRONG_MSG_TYPE; return; }
repeat_indicator = ubits(bs,6,2);
mmsi = ubits(bs,8,30);

// FIX: write the rest
}

0 comments on commit 089da02

Please sign in to comment.