Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

released libais 0.4

git-svn-id: https://cowfish.unh.edu/projects/schwehr/trunk/src/libais@13676 a19cddd1-5311-0410-bb07-9ca93daf0f0b
  • Loading branch information...
commit e467c62471d4917579854a8e5996870840377353 1 parent 738335f
schwehr authored
Showing with 75 additions and 6 deletions.
  1. +6 −5 ChangeLog.html
  2. +1 −1  VERSION
  3. +68 −0 ais_decode_normed.cpp
View
11 ChangeLog.html
@@ -7,13 +7,14 @@
<ul> <!-- list of all releases -->
- <li>0.3 - 2010-05-
+ <li>0.3 - 2010-05-10
<ul>
- <li></li>
- <li></li>
+ <li>ais.c: added check_error_messages to make sure they are not out of sync</li>
+ <li>-D_GLIBCXX_DEBUG appears broken in GCC 4.[0-2] so do not use</li>
+ <li>ais_decode_normed.cpp: temporary C++ side decoding of normed AIVDM messages</li>
<li>nais2pg: added vesselname class to manage updates to postgresql</li>
<li>Added message 24</li>
- <li>Fixed python reference counting</li>
+ <li>Fixed python reference counting. Added XXSafeSetItem functions</li>
</ul>
<li>0.2 - 2010-05-06
@@ -49,5 +50,5 @@
<hr>
<address></address>
-<!-- hhmts start --> Last modified: Mon May 10 10:45:51 EDT 2010 <!-- hhmts end -->
+<!-- hhmts start --> Last modified: Mon May 10 10:57:55 EDT 2010 <!-- hhmts end -->
</body> </html>
View
2  VERSION
@@ -1 +1 @@
-0.2
+0.3
View
68 ais_decode_normed.cpp
@@ -0,0 +1,68 @@
+#include "ais.h"
+
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <cstring>
+//using namespace std;
+
+#define UNUSED __attribute((__unused__))
+
+// http://stackoverflow.com/questions/236129/c-how-to-split-a-string
+std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
+ std::stringstream ss(s);
+ std::string item;
+ while(std::getline(ss, item, delim)) {
+ elems.push_back(item);
+ }
+ return elems;
+}
+
+std::vector<std::string> split(const std::string &s, char delim) {
+ std::vector<std::string> elems;
+ return split(s, delim, elems);
+}
+
+
+
+//int main(UNUSED char *argc, UNUSED char* argv[]) {
+int main( int argc, char* argv[]) {
+ build_nmea_lookup();
+
+ assert(2<=argc);
+ //std::string filename(argv[1]);
+ std::ifstream infile(argv[1]);
+ if (! infile.is_open() ) {
+ std::cerr << "Unable to open file: " << argv[1] << std::endl;
+ exit(1);
+ }
+
+ int i = 0;
+ std::string line;
+ //char line[1024];
+ while (!infile.eof()) {
+ i++;
+ getline(infile,line); // G++ problem with this and a string
+ //infile.getline(line,1024);
+
+
+ //if (strlen(line) < 20) {continue;}
+ if (line.size() < 20) {continue;}
+ if ('!' != line[0] || 'A' != line[1] ) {continue;}
+ std::string line_str(line);
+ std::vector<std::string> fields = split(line_str,',');
+ {
+ if (fields.size() < 7) continue;
+ if (fields[5].size() < 5) continue;
+ if (fields[5][0] != '5') continue;
+ Ais5 m5(fields[5].c_str());
+ if (m5.had_error()) continue;
+ std::cout << m5.mmsi << "," << m5.name << "," << m5.callsign << "," << m5.type_and_cargo << std::endl;
+ }
+ }
+
+
+ return 0;
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.