private Message ReadWeatherMessage(LiveMessageHeader header)
{
ReadAndDecryptBytes(header.DataLength);
var s = DecodeLatin1(header.DataLength);
switch(header.Colour)
{
case 1:
return new SetTrackTemperatureMessage(LiveData.ParseDouble(s));
case 2:
return new SetAirTemperatureMessage(LiveData.ParseDouble(s));
case 3:
return new SetIsWetMessage(s[0] == '1');
case 4:
return new SetWindSpeedMessage(LiveData.ParseDouble(s));
case 5:
return new SetHumidityMessage(LiveData.ParseDouble(s));
case 6:
return new SetAtmosphericPressureMessage(LiveData.ParseDouble(s));
case 7:
return ReadSetWindAngleMessage(s);
default:
Log.ErrorFormat("unsupported weather message: {0}", header);
throw Guard.LiveMessageReader_UnsupportedWeatherMessage(header);
}
}