Skip to content

Commit

Permalink
AIS Fix
Browse files Browse the repository at this point in the history
- Fix for ParseN2kPGN129810 parameter list.
- Fixed SetN2kPGN129810 - AIS spare must be 0
- Forced transceiver information on SetN2kPGN129810 to "channel B VDL transmission"
- Fixed SetAISStr on N2kMsg.cpp
  • Loading branch information
ttlappalainen committed Mar 25, 2024
1 parent 29338ce commit ae21146
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
1 change: 1 addition & 0 deletions Documents/src/7_glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ The SAE J1939 protocol requires a specific format for the CAN message’s identi
| 1095 | Wetsounds |
| 1140 | Across Ocean Systems Ltd. |
| 1305 | Dragonfly Energy |
| 1439 | PredictWind |
| 1850 | Teleflex |
| 1851 | Raymarine |
| 1852 | Navionics |
Expand Down
7 changes: 7 additions & 0 deletions Documents/src/changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changes to the Library {#changes}
\tableofcontents

## 25.03.2024

- Fix for ParseN2kPGN129810 parameter list.
- Fixed SetN2kPGN129810 - AIS spare must be 0
- Forced transceiver information on SetN2kPGN129810 to "channel B VDL transmission"
- Fixed SetAISStr on N2kMsg.cpp

## 06.03.2024

-- reduced memory footprint for N2kMsg::AddAISStr
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "http://www.kave.fi",
"maintainer": true
},
"version": "4.21.2",
"version": "4.21.3",
"license": "MIT",
"frameworks": "*",
"platforms": "*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=NMEA2000
version=4.21.2
version=4.21.3
author=Timo Lappalainen
maintainer=Kave Oy <www.kave.fi>
sentence=NMEA 2000 library for building compatible devices for NMEA 2000 bus.
Expand Down
10 changes: 7 additions & 3 deletions src/N2kMessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,8 @@ bool ParseN2kPGN129809(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat
//*****************************************************************************
// AIS static data class B part B
void SetN2kPGN129810(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, uint32_t UserID,
uint8_t VesselType, const char *Vendor, const char *Callsign, double Length, double Beam,
uint8_t VesselType, const char *Vendor, const char *Callsign,
double Length, double Beam,
double PosRefStbd, double PosRefBow, uint32_t MothershipID)
{
N2kMsg.SetPGN(129810L);
Expand All @@ -1711,11 +1712,14 @@ void SetN2kPGN129810(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, u
N2kMsg.Add2ByteUDouble(PosRefStbd, 0.1);
N2kMsg.Add2ByteUDouble(PosRefBow, 0.1);
N2kMsg.Add4ByteUInt(MothershipID);
N2kMsg.AddByte(0xff); // Reserved
N2kMsg.AddByte(0x03); // Reserved + AIS spare
N2kMsg.AddByte(0xe3); // Channel B VDL transmission + reserved
N2kMsg.AddByte(0xff); // SID
}

bool ParseN2kPGN129810(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat &Repeat, uint32_t &UserID,
uint8_t &VesselType, char *Vendor, size_t VendorBufSize, char *Callsign, size_t CallsignBufSize, double &Length, double &Beam,
uint8_t &VesselType, char *Vendor, size_t VendorBufSize, char *Callsign, size_t CallsignBufSize,
double &Length, double &Beam,
double &PosRefStbd, double &PosRefBow, uint32_t &MothershipID)
{
if (N2kMsg.PGN!=129810L) return false;
Expand Down
12 changes: 8 additions & 4 deletions src/N2kMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -4596,7 +4596,8 @@ inline void SetN2kAISClassBStaticPartB(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kA
*
*/
bool ParseN2kPGN129810(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat &Repeat, uint32_t &UserID,
uint8_t &VesselType, const char *Vendor, size_t VendorBufSize, const char *Callsign, size_t CallsignBufSize,double &Length, double &Beam,
uint8_t &VesselType, char *Vendor, size_t VendorBufSize, char *Callsign, size_t CallsignBufSize,
double &Length, double &Beam,
double &PosRefStbd, double &PosRefBow, uint32_t &MothershipID);

/************************************************************************//**
Expand All @@ -4608,10 +4609,13 @@ bool ParseN2kPGN129810(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat
* of the source code. See parameter details on \ref ParseN2kPGN129810
*/
inline bool ParseN2kAISClassBStaticPartB(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat &Repeat, uint32_t &UserID,
uint8_t &VesselType, char *Vendor, size_t VendorBufSize, char *Callsign, size_t CallsignBufSize, double &Length, double &Beam,
uint8_t &VesselType, char *Vendor, size_t VendorBufSize, char *Callsign, size_t CallsignBufSize,
double &Length, double &Beam,
double &PosRefStbd, double &PosRefBow, uint32_t &MothershipID) {
return ParseN2kPGN129810(N2kMsg, MessageID, Repeat, UserID, VesselType, Vendor, VendorBufSize, Callsign, CallsignBufSize,
Length, Beam, PosRefStbd, PosRefBow, MothershipID);
return ParseN2kPGN129810(N2kMsg, MessageID, Repeat, UserID,
VesselType, Vendor, VendorBufSize, Callsign, CallsignBufSize,
Length, Beam,
PosRefStbd, PosRefBow, MothershipID);
}

/************************************************************************//**
Expand Down
1 change: 1 addition & 0 deletions src/N2kMsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ void tN2kMsg::AddAISStr(const char *str, int len) {
}

if ( len > MaxDataLen-DataLen ) len=MaxDataLen-DataLen;
DataLen+=len;
if ( len>0 ) memset(buf,'@',len);
}

Expand Down

0 comments on commit ae21146

Please sign in to comment.