@@ -320,8 +320,8 @@ namespace AIS
320320 unsigned message_id = msg.getUint (90 , 6 );
321321 if (message_id == 1 ) {
322322 // Weather Station Message - decode first weather report
323- // Each report is 144 bits, starting at bit 96
324- if (msg.getLength () >= 240 ) { // Ensure we have at least one complete report (96 + 144 = 240 bits)
323+ // Each report is 192 bits, starting at bit 96
324+ if (msg.getLength () >= 288 ) { // Ensure we have at least one complete report (96 + 192 = 288 bits)
325325 int start_bit = 96 ;
326326
327327 // Timetag (20 bits): Month(4), Day(5), Hours(5), Minutes(6)
@@ -337,14 +337,15 @@ namespace AIS
337337 SL (msg, AIS::KEY_LON, start_bit + 62 , 25 , 1 / 60000 .0f , 0 , 10800000 ); // Longitude in 1/1000 min, 181°=not available
338338 SL (msg, AIS::KEY_LAT, start_bit + 87 , 24 , 1 / 60000 .0f , 0 , 5400000 ); // Latitude in 1/1000 min, 91°=not available
339339
340- // Weather Station Data (33 bits total)
341- SL (msg, AIS::KEY_AIR_TEMPERATURE, start_bit + 111 , 11 , 0 .1f , -60 .0f , 2047 ); // Air temperature in °C*10, 2047=not available
342- U (msg, AIS::KEY_RELATIVE_HUMIDITY, start_bit + 122 , 7 , 127 ); // Relative humidity %, 127=not available
343- U (msg, AIS::KEY_BAROMETRIC_PRESSURE, start_bit + 129 , 9 , 511 ); // Barometric pressure in hPa-800, 511=not available
344- U (msg, AIS::KEY_PRESSURE_TENDENCY, start_bit + 138 , 2 ); // Pressure tendency: 0=steady, 1=decreasing, 2=increasing, 3=not available
345-
346- // Reserved (4 bits) - skip
347- X (msg, AIS::KEY_SPARE, start_bit + 140 , 4 );
340+ // Weather Station Data (81 bits total)
341+ UL (msg, AIS::KEY_WSPEED, start_bit + 111 , 10 , 0 .1f , 0 ); // Wind speed in knots*10, 1023=not available
342+ UL (msg, AIS::KEY_WGUST, start_bit + 121 , 10 , 0 .1f , 0 ); // Wind gust in knots*10, 1023=not available
343+ U (msg, AIS::KEY_WDIR, start_bit + 131 , 9 , 511 ); // Wind direction in degrees, 511=not available
344+ U (msg, AIS::KEY_BAROMETRIC_PRESSURE, start_bit + 140 , 14 , 16383 ); // Atmospheric pressure in 0.1 millibars, 16383=not available
345+ SL (msg, AIS::KEY_AIR_TEMPERATURE, start_bit + 154 , 10 , 0 .1f , 0 , -512 ); // Air temperature in °C*10, -512=not available
346+ SL (msg, AIS::KEY_DEW_POINT, start_bit + 164 , 10 , 0 .1f , 0 , -512 ); // Dew point in °C*10, -512=not available
347+ UL (msg, AIS::KEY_VISIBILITY, start_bit + 174 , 8 , 0 .1f , 0 ); // Visibility in km*10, 255=not available
348+ SL (msg, AIS::KEY_WATERTEMP, start_bit + 182 , 10 , 0 .1f , 0 , -512 ); // Water temperature in °C*10, -512=not available
348349 }
349350 }
350351 else if (message_id == 3 ) {
@@ -395,14 +396,13 @@ namespace AIS
395396 SL (msg, AIS::KEY_LON, start_bit + 62 , 25 , 1 / 60000 .0f , 0 , 10800000 ); // Longitude in 1/1000 min, 181°=not available
396397 SL (msg, AIS::KEY_LAT, start_bit + 87 , 24 , 1 / 60000 .0f , 0 , 5400000 ); // Latitude in 1/1000 min, 91°=not available
397398
398- // Wind Information Data (34 bits total)
399- SL (msg, AIS::KEY_WIND_SPEED_AVG, start_bit + 111 , 8 , 0 .1f , 0 , 255 ); // Average wind speed in knots*10, 255=not available
400- U (msg, AIS::KEY_WIND_DIRECTION_AVG, start_bit + 119 , 9 , 511 ); // Average wind direction in degrees, 511=not available
401- SL (msg, AIS::KEY_WIND_GUST_SPEED, start_bit + 128 , 8 , 0 .1f , 0 , 255 ); // Wind gust speed in knots*10, 255=not available
402- U (msg, AIS::KEY_WIND_GUST_DIRECTION, start_bit + 136 , 9 , 511 ); // Wind gust direction in degrees, 511=not available
399+ // Wind Information Data (33 bits total)
400+ UL (msg, AIS::KEY_WIND_SPEED_AVG, start_bit + 111 , 10 , 0 .1f , 0 ); // Average wind speed in knots*10, 1023=not available
401+ UL (msg, AIS::KEY_WIND_GUST_SPEED, start_bit + 121 , 10 , 0 .1f , 0 ); // Wind gust speed in knots*10, 1023=not available
402+ U (msg, AIS::KEY_WIND_DIRECTION_AVG, start_bit + 131 , 9 , 511 ); // Wind direction in degrees, 511=not available
403403
404- // Reserved (9 bits) - skip
405- X (msg, AIS::KEY_SPARE, start_bit + 145 , 9 );
404+ // Reserved (4 bits) - skip
405+ X (msg, AIS::KEY_SPARE, start_bit + 140 , 4 );
406406 }
407407 }
408408 else if (message_id == 6 ) {
@@ -424,18 +424,11 @@ namespace AIS
424424 SL (msg, AIS::KEY_LON, start_bit + 62 , 25 , 1 / 60000 .0f , 0 , 10800000 ); // Longitude in 1/1000 min, 181°=not available
425425 SL (msg, AIS::KEY_LAT, start_bit + 87 , 24 , 1 / 60000 .0f , 0 , 5400000 ); // Latitude in 1/1000 min, 91°=not available
426426
427- // Water Flow Data (70 bits total)
428- SL (msg, AIS::KEY_SET_DRIFT_SPEED, start_bit + 111 , 8 , 0 .1f , 0 , 255 ); // Set and drift speed in knots*10, 255=not available
429- U (msg, AIS::KEY_SET_DRIFT_DIRECTION, start_bit + 119 , 9 , 511 ); // Set and drift direction in degrees, 511=not available
430- SL (msg, AIS::KEY_CURRENT_SPEED_1, start_bit + 128 , 8 , 0 .1f , 0 , 255 ); // Current speed level 1 in knots*10, 255=not available
431- U (msg, AIS::KEY_CURRENT_DIRECTION_1, start_bit + 136 , 9 , 511 ); // Current direction level 1 in degrees, 511=not available
432- SL (msg, AIS::KEY_CURRENT_SPEED_2, start_bit + 145 , 8 , 0 .1f , 0 , 255 ); // Current speed level 2 in knots*10, 255=not available
433- U (msg, AIS::KEY_CURRENT_DIRECTION_2, start_bit + 153 , 9 , 511 ); // Current direction level 2 in degrees, 511=not available
434- SL (msg, AIS::KEY_CURRENT_SPEED_3, start_bit + 162 , 8 , 0 .1f , 0 , 255 ); // Current speed level 3 in knots*10, 255=not available
435- U (msg, AIS::KEY_CURRENT_DIRECTION_3, start_bit + 170 , 9 , 511 ); // Current direction level 3 in degrees, 511=not available
427+ // Water Flow Data (33 bits total)
428+ U (msg, AIS::KEY_WATER_FLOW, start_bit + 111 , 14 , 16383 ); // Water flow in m³/s, 16383=not available
436429
437- // Reserved (22 bits) - skip
438- X (msg, AIS::KEY_SPARE, start_bit + 179 , 22 );
430+ // Reserved (19 bits) - skip
431+ X (msg, AIS::KEY_SPARE, start_bit + 125 , 19 );
439432 }
440433 }
441434 // Further decoding for other message IDs can be added here
@@ -609,8 +602,8 @@ namespace AIS
609602 unsigned message_id = msg.getUint (58 , 6 );
610603 if (message_id == 1 ) {
611604 // Weather Station Message - decode first weather report
612- // Each report is 144 bits, starting at bit 64
613- if (msg.getLength () >= 208 ) { // Ensure we have at least one complete report (64 + 144 = 208 bits)
605+ // Each report is 192 bits, starting at bit 64
606+ if (msg.getLength () >= 256 ) { // Ensure we have at least one complete report (64 + 192 = 256 bits)
614607 int start_bit = 64 ;
615608
616609 // Timetag (20 bits): Month(4), Day(5), Hours(5), Minutes(6)
@@ -626,14 +619,15 @@ namespace AIS
626619 SL (msg, AIS::KEY_LON, start_bit + 62 , 25 , 1 / 60000 .0f , 0 , 10800000 ); // Longitude in 1/1000 min, 181°=not available
627620 SL (msg, AIS::KEY_LAT, start_bit + 87 , 24 , 1 / 60000 .0f , 0 , 5400000 ); // Latitude in 1/1000 min, 91°=not available
628621
629- // Weather Station Data (33 bits total)
630- SL (msg, AIS::KEY_AIR_TEMPERATURE, start_bit + 111 , 11 , 0 .1f , -60 .0f , 2047 ); // Air temperature in °C*10, 2047=not available
631- U (msg, AIS::KEY_RELATIVE_HUMIDITY, start_bit + 122 , 7 , 127 ); // Relative humidity %, 127=not available
632- U (msg, AIS::KEY_BAROMETRIC_PRESSURE, start_bit + 129 , 9 , 511 ); // Barometric pressure in hPa-800, 511=not available
633- U (msg, AIS::KEY_PRESSURE_TENDENCY, start_bit + 138 , 2 ); // Pressure tendency: 0=steady, 1=decreasing, 2=increasing, 3=not available
634-
635- // Reserved (4 bits) - skip
636- X (msg, AIS::KEY_SPARE, start_bit + 140 , 4 );
622+ // Weather Station Data (81 bits total)
623+ UL (msg, AIS::KEY_WSPEED, start_bit + 111 , 10 , 0 .1f , 0 ); // Wind speed in knots*10, 1023=not available
624+ UL (msg, AIS::KEY_WGUST, start_bit + 121 , 10 , 0 .1f , 0 ); // Wind gust in knots*10, 1023=not available
625+ U (msg, AIS::KEY_WDIR, start_bit + 131 , 9 , 511 ); // Wind direction in degrees, 511=not available
626+ U (msg, AIS::KEY_BAROMETRIC_PRESSURE, start_bit + 140 , 14 , 16383 ); // Atmospheric pressure in 0.1 millibars, 16383=not available
627+ SL (msg, AIS::KEY_AIR_TEMPERATURE, start_bit + 154 , 10 , 0 .1f , 0 , -512 ); // Air temperature in °C*10, -512=not available
628+ SL (msg, AIS::KEY_DEW_POINT, start_bit + 164 , 10 , 0 .1f , 0 , -512 ); // Dew point in °C*10, -512=not available
629+ UL (msg, AIS::KEY_VISIBILITY, start_bit + 174 , 8 , 0 .1f , 0 ); // Visibility in km*10, 255=not available
630+ SL (msg, AIS::KEY_WATERTEMP, start_bit + 182 , 10 , 0 .1f , 0 , -512 ); // Water temperature in °C*10, -512=not available
637631 }
638632 }
639633 else if (message_id == 3 ) {
@@ -684,14 +678,13 @@ namespace AIS
684678 SL (msg, AIS::KEY_LON, start_bit + 62 , 25 , 1 / 60000 .0f , 0 , 10800000 ); // Longitude in 1/1000 min, 181°=not available
685679 SL (msg, AIS::KEY_LAT, start_bit + 87 , 24 , 1 / 60000 .0f , 0 , 5400000 ); // Latitude in 1/1000 min, 91°=not available
686680
687- // Wind Information Data (34 bits total)
688- SL (msg, AIS::KEY_WIND_SPEED_AVG, start_bit + 111 , 8 , 0 .1f , 0 , 255 ); // Average wind speed in knots*10, 255=not available
689- U (msg, AIS::KEY_WIND_DIRECTION_AVG, start_bit + 119 , 9 , 511 ); // Average wind direction in degrees, 511=not available
690- SL (msg, AIS::KEY_WIND_GUST_SPEED, start_bit + 128 , 8 , 0 .1f , 0 , 255 ); // Wind gust speed in knots*10, 255=not available
691- U (msg, AIS::KEY_WIND_GUST_DIRECTION, start_bit + 136 , 9 , 511 ); // Wind gust direction in degrees, 511=not available
681+ // Wind Information Data (33 bits total)
682+ UL (msg, AIS::KEY_WIND_SPEED_AVG, start_bit + 111 , 10 , 0 .1f , 0 ); // Average wind speed in knots*10, 1023=not available
683+ UL (msg, AIS::KEY_WIND_GUST_SPEED, start_bit + 121 , 10 , 0 .1f , 0 ); // Wind gust speed in knots*10, 1023=not available
684+ U (msg, AIS::KEY_WIND_DIRECTION_AVG, start_bit + 131 , 9 , 511 ); // Wind direction in degrees, 511=not available
692685
693- // Reserved (9 bits) - skip
694- X (msg, AIS::KEY_SPARE, start_bit + 145 , 9 );
686+ // Reserved (4 bits) - skip
687+ X (msg, AIS::KEY_SPARE, start_bit + 140 , 4 );
695688 }
696689 }
697690 else if (message_id == 6 ) {
@@ -713,18 +706,11 @@ namespace AIS
713706 SL (msg, AIS::KEY_LON, start_bit + 62 , 25 , 1 / 60000 .0f , 0 , 10800000 ); // Longitude in 1/1000 min, 181°=not available
714707 SL (msg, AIS::KEY_LAT, start_bit + 87 , 24 , 1 / 60000 .0f , 0 , 5400000 ); // Latitude in 1/1000 min, 91°=not available
715708
716- // Water Flow Data (70 bits total)
717- SL (msg, AIS::KEY_SET_DRIFT_SPEED, start_bit + 111 , 8 , 0 .1f , 0 , 255 ); // Set and drift speed in knots*10, 255=not available
718- U (msg, AIS::KEY_SET_DRIFT_DIRECTION, start_bit + 119 , 9 , 511 ); // Set and drift direction in degrees, 511=not available
719- SL (msg, AIS::KEY_CURRENT_SPEED_1, start_bit + 128 , 8 , 0 .1f , 0 , 255 ); // Current speed level 1 in knots*10, 255=not available
720- U (msg, AIS::KEY_CURRENT_DIRECTION_1, start_bit + 136 , 9 , 511 ); // Current direction level 1 in degrees, 511=not available
721- SL (msg, AIS::KEY_CURRENT_SPEED_2, start_bit + 145 , 8 , 0 .1f , 0 , 255 ); // Current speed level 2 in knots*10, 255=not available
722- U (msg, AIS::KEY_CURRENT_DIRECTION_2, start_bit + 153 , 9 , 511 ); // Current direction level 2 in degrees, 511=not available
723- SL (msg, AIS::KEY_CURRENT_SPEED_3, start_bit + 162 , 8 , 0 .1f , 0 , 255 ); // Current speed level 3 in knots*10, 255=not available
724- U (msg, AIS::KEY_CURRENT_DIRECTION_3, start_bit + 170 , 9 , 511 ); // Current direction level 3 in degrees, 511=not available
709+ // Water Flow Data (33 bits total)
710+ U (msg, AIS::KEY_WATER_FLOW, start_bit + 111 , 14 , 16383 ); // Water flow in m³/s, 16383=not available
725711
726- // Reserved (22 bits) - skip
727- X (msg, AIS::KEY_SPARE, start_bit + 179 , 22 );
712+ // Reserved (19 bits) - skip
713+ X (msg, AIS::KEY_SPARE, start_bit + 125 , 19 );
728714 }
729715 }
730716 // Further decoding for other message IDs can be added here
0 commit comments