Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 161 lines (127 sloc) 5.393 kb
383b8c0 @rolker use Roland's include guards
rolker authored
1 #ifndef AIS8_366_22_H
2 #define AIS8_366_22_H
3
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
4 // -*- c++ -*-
5 // Way complicated
6
34ae14d @schwehr starting on IMO 8 1 22
authored
7 // Which spec was I coding to? Probably the Nav55
8
5f364d8 @schwehr minor cleanup and checks
authored
9 // FIX: remove cout's and this include will not be needed
10 #include <iostream>
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
11
12 enum Ais8_366_22_AreaShapeEnum {
13 AIS8_366_22_SHAPE_ERROR = -1,
14 AIS8_366_22_SHAPE_CIRCLE = 0,
15 AIS8_366_22_SHAPE_RECT = 1,
16 AIS8_366_22_SHAPE_SECTOR = 2,
17 AIS8_366_22_SHAPE_POLYLINE = 3,
18 AIS8_366_22_SHAPE_POLYGON = 4,
19 AIS8_366_22_SHAPE_TEXT = 5,
20 AIS8_366_22_SHAPE_RESERVED_6 = 6,
21 AIS8_366_22_SHAPE_RESERVED_7 = 7
22 };
23
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
24 extern const char *shape_names[8];
25
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
26
27
28 class Ais8_366_22_SubArea {
29 public:
30 //Ais8_366_22_AreaShapeEnum area_shape;
31 virtual Ais8_366_22_AreaShapeEnum getType()=0;
32 // FIX: make the destructor pure virtual
33 virtual ~Ais8_366_22_SubArea() { std::cout << "Ais8_366_22_Circle: destructor" << std::endl; };
34 virtual void print()=0;
35 };
36
37 Ais8_366_22_SubArea* ais8_366_22_subarea_factory(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
38
39 // or Point if radius is 0
40 class Ais8_366_22_Circle : public Ais8_366_22_SubArea {
41 public:
42 float x,y; // longitude and latitude
43 // Going to assume that the precision is load of crap
44 //int precision; // How many decimal places for x and y. FIX: is this really supposed to be here????
45 int radius_m;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
46 unsigned int spare; // 18 bits
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
47
48 Ais8_366_22_Circle(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
49 ~Ais8_366_22_Circle() { std::cout << "Ais8_366_22_Circle: destructor" << std::endl;};
50 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_CIRCLE;}
51 void print();
52 };
53
54 class Ais8_366_22_Rect : public Ais8_366_22_SubArea {
55 public:
56 float x,y; // longitude and latitude
57 //int precision; // How many decimal places for x and y. FIX: in IMO, but not RTCM
58 int e_dim_m; // East dimension in meters
59 int n_dim_m;
60 int orient_deg; // Orientation in degrees from true north
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
61 unsigned int spare; // 5 bits
62
63 Ais8_366_22_Rect(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
64 ~Ais8_366_22_Rect() { std::cout << "Ais8_366_22_Rect: destructor" << std::endl;};
65 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_RECT;}
66 void print();
67
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
68 };
69
70 class Ais8_366_22_Sector : public Ais8_366_22_SubArea {
71 public:
72 float x,y; // longitude and latitude
73 //int precision; // How many decimal places for x and y FIX: in IMO, but not RTCM
74 int radius_m;
75 int left_bound_deg;
76 int right_bound_deg;
77 //int spare; // bits
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
78
79 Ais8_366_22_Sector(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
80 ~Ais8_366_22_Sector() { std::cout << "Ais8_366_22_Sector: destructor" << std::endl;};
81 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_SECTOR;}
82 void print();
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
83 };
84
85 // Or Waypoint
86 // Must have a point before on the VDL, but pulled together here.
87 class Ais8_366_22_Polyline : public Ais8_366_22_SubArea {
88 public:
89
90 // x, y, and precision sent as separate Point before the waypoint start
91 float x,y; // longitude and latitude
92 //int precision; // How many decimal places for x and y. FIX: in IMO
93
94 // Up to 4 points
95 std::vector<float> angles;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
96 std::vector<float> dists_m;
97 unsigned int spare; // 1 bit
98
99 Ais8_366_22_Polyline(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
100 ~Ais8_366_22_Polyline() { std::cout << "Ais8_366_22_Polyline: destructor" << std::endl;};
101 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYLINE;}
102 void print();
103
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
104 };
105
106 class Ais8_366_22_Polygon : public Ais8_366_22_SubArea {
107 public:
108
109 // x, y, and precision sent as separate Point before the waypoint start
110 float x,y; // longitude and latitude
111 //int precision; // How many decimal places for x and y. FIX: in IMO
112
113 // Up to 4 points in a first message, but aggregated if multiple sub areas
114 std::vector<float> angles;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
115 std::vector<float> dists_m;
116 unsigned int spare; // 1 bit
117
118 Ais8_366_22_Polygon(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
119 ~Ais8_366_22_Polygon() { std::cout << "Ais8_366_22_Polygon: destructor" << std::endl;};
120 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYGON;}
121 void print();
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
122 };
123
124 class Ais8_366_22_Text : public Ais8_366_22_SubArea {
125 public:
126 std::string text;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
127 unsigned int spare; // 3 bits
128
129 Ais8_366_22_Text(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
130 ~Ais8_366_22_Text() { std::cout << "Ais8_366_22_Text: destructor" << std::endl;};
131 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_TEXT;}
132 void print();
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
133 };
134
135 class Ais8_366_22 : public Ais8 {
136 public:
137 // Common block at the front
138 int link_id; // 10 bit id to match up text blocks
139 int notice_type; // area_type / Notice Description
140 int month; // These really are in utc
141 int day;
142 int utc_hour;
143 int utc_minute;
144 int duration_minutes; // Time from the start until the notice expires
145
146 // 1 or more sub messages
147
148 std::vector<Ais8_366_22_SubArea *> sub_areas;
149
150 Ais8_366_22(const char *nmea_payload);
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low …
Kurt Schwehr authored
151 ~Ais8_366_22();
3d5b0eb @schwehr Working on the area notice based on the RTCM doc from Greg, but witho…
authored
152 void print();
153 };
154 std::ostream& operator<< (std::ostream& o, Ais8_366_22 const& msg);
155
156 // std::vector<std::string> notice_names;
157 const size_t AIS8_366_22_NUM_NAMES=128;
791c882 @schwehr First round of tests appear to work for the IMO area notice that come…
authored
158 extern const char *ais8_366_22_notice_names[AIS8_366_22_NUM_NAMES]; //128];
383b8c0 @rolker use Roland's include guards
rolker authored
159
160 #endif
Something went wrong with that request. Please try again.