Skip to content

Commit

Permalink
Added parsing of PGN 130311
Browse files Browse the repository at this point in the history
  • Loading branch information
adwuk committed Oct 17, 2016
1 parent 9672b37 commit f66c408
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions N2kMessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,20 @@ void SetN2kPGN130311(tN2kMsg &N2kMsg, unsigned char SID, tN2kTempSource TempInst
N2kMsg.Add2ByteUDouble(AtmosphericPressure,100);
}

bool ParseN2kPGN130311(const tN2kMsg &N2kMsg, unsigned char &SID, tN2kTempSource &TempInstance, double &Temperature,
tN2kHumiditySource &HumidityInstance, double &Humidity, double &AtmosphericPressure) {
if (N2kMsg.PGN!=130311L) return false;
unsigned char vb;
int Index=0;
SID=N2kMsg.GetByte(Index);
vb=N2kMsg.GetByte(Index); TempInstance=(tN2kTempSource)(vb & 0x3f); HumidityInstance=(tN2kHumiditySource)(vb>>6 & 0x03);
Temperature=N2kMsg.Get2ByteUDouble(0.01,Index);
Humidity=N2kMsg.Get2ByteDouble(0.004,Index);
AtmosphericPressure=N2kMsg.Get2ByteUDouble(100,Index);

return true;
}

//*****************************************************************************
// Temperature
// Temperatures should be in Kelvins
Expand Down
7 changes: 7 additions & 0 deletions N2kMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,13 @@ inline void SetN2kEnvironmentalParameters(tN2kMsg &N2kMsg, unsigned char SID, tN
SetN2kPGN130311(N2kMsg,SID,TempInstance,Temperature,HumidityInstance,Humidity,AtmosphericPressure);
}

bool ParseN2kPGN130311(const tN2kMsg &N2kMsg, unsigned char &SID, tN2kTempSource &TempInstance, double &Temperature,
tN2kHumiditySource &HumidityInstance, double &Humidity, double &AtmosphericPressure);
inline bool ParseN2kEnvironmentalParameters(const tN2kMsg &N2kMsg, unsigned char &SID, tN2kTempSource &TempInstance, double &Temperature,
tN2kHumiditySource &HumidityInstance, double &Humidity, double &AtmosphericPressure) {
return ParseN2kPGN130311(N2kMsg,SID,TempInstance,Temperature,HumidityInstance,Humidity,AtmosphericPressure);
}

//*****************************************************************************
// Temperature
// Temperatures should be in Kelvins
Expand Down

0 comments on commit f66c408

Please sign in to comment.