Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/libais/ais.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,16 @@ enum Dac {

class AisBitset;

class AisMdate
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this class adds alot. For starters, the class name doesn't mean anything to me. Perhaps a better class name and definitely needs a comment.

{
public:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be formatted with the clang-format using the google style.

int month;
int day;
int hour;
int min;
AisMdate() { month = day = hour = min = 0; };
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialization should be done as an initializer list.

};

class AisPoint {
public:
double lng_deg;
Expand Down Expand Up @@ -631,15 +641,9 @@ class Ais6_1_5 : public Ais6 {
class Ais6_1_12 : public Ais6 {
public:
string last_port;
int utc_month_dep; // actual time of departure
int utc_day_dep;
int utc_hour_dep;
int utc_min_dep;
AisMdate utc_dep; // actual time of departure
string next_port;
int utc_month_next; // estimated arrival
int utc_day_next;
int utc_hour_next;
int utc_min_next;
AisMdate utc_next; // estimated arrival
string main_danger;
string imo_cat;
int un;
Expand Down
4 changes: 1 addition & 3 deletions src/libais/ais6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@ Ais6_1_5::Ais6_1_5(const char *nmea_payload, const size_t pad)
// IMO Circ 289 - Dangerous cargo
// See also Circ 236
Ais6_1_12::Ais6_1_12(const char *nmea_payload, const size_t pad)
: Ais6(nmea_payload, pad), utc_month_dep(0), utc_day_dep(0),
utc_hour_dep(0), utc_min_dep(0), utc_month_next(0),
utc_day_next(0), utc_hour_next(0), utc_min_next(0),
: Ais6(nmea_payload, pad),
un(0), value(0), value_unit(0), spare2(0) {
assert(dac == 1);
assert(fi == 12);
Expand Down
2 changes: 1 addition & 1 deletion src/libais/ais_decode_normed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) {
if (fields.size() < 7) continue;
if (fields[5].size() < 5) continue;
if (fields[5][0] != '5') continue;
Ais5 m5(fields[5].c_str(), 2);
libais::Ais5 m5(fields[5].c_str(), 2);
if (m5.had_error()) continue;
std::cout << m5.mmsi << "," << m5.name << "," << m5.callsign << ","
<< m5.type_and_cargo << std::endl;
Expand Down
16 changes: 8 additions & 8 deletions src/libais/ais_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,15 @@ ais6_1_12_append_pydict(const char *nmea_payload, PyObject *dict,
}

DictSafeSetItem(dict, "last_port", msg.last_port);
DictSafeSetItem(dict, "utc_month_dep", msg.utc_month_dep); // actual
DictSafeSetItem(dict, "utc_day_dep", msg.utc_day_dep);
DictSafeSetItem(dict, "utc_hour_dep", msg.utc_hour_dep);
DictSafeSetItem(dict, "utc_min_dep", msg.utc_min_dep);
DictSafeSetItem(dict, "utc_month_dep", msg.utc_dep.month); // actual
DictSafeSetItem(dict, "utc_day_dep", msg.utc_dep.day);
DictSafeSetItem(dict, "utc_hour_dep", msg.utc_dep.hour);
DictSafeSetItem(dict, "utc_min_dep", msg.utc_dep.min);
DictSafeSetItem(dict, "next_port", msg.next_port);
DictSafeSetItem(dict, "utc_month_next", msg.utc_month_next); // estimated
DictSafeSetItem(dict, "utc_day_next", msg.utc_day_next);
DictSafeSetItem(dict, "utc_hour_next", msg.utc_hour_next);
DictSafeSetItem(dict, "utc_min_next", msg.utc_min_next);
DictSafeSetItem(dict, "utc_month_next", msg.utc_next.month); // estimated
DictSafeSetItem(dict, "utc_day_next", msg.utc_next.day);
DictSafeSetItem(dict, "utc_hour_next", msg.utc_next.hour);
DictSafeSetItem(dict, "utc_min_next", msg.utc_next.min);
DictSafeSetItem(dict, "main_danger", msg.main_danger);
DictSafeSetItem(dict, "imo_cat", msg.imo_cat);
DictSafeSetItem(dict, "un", msg.un);
Expand Down