📄 vpw.cpp
字号:
#include "nmea0183.h"
#pragma hdrstop
/*
** Author: Samuel R. Blackburn
** CI$: 76300,326
** Internet: sammy@sed.csc.com
**
** You can use it any way you like.
*/
IMPLEMENT_DYNAMIC( VPW, RESPONSE )
VPW::VPW()
{
Mnemonic = "VPW";
Empty();
}
VPW::~VPW()
{
Mnemonic.Empty();
Empty();
}
void VPW::Empty( void )
{
ASSERT_VALID( this );
Knots = 0.0;
MetersPerSecond = 0.0;
}
BOOL VPW::Parse( const SENTENCE& sentence )
{
ASSERT_VALID( this );
/*
** VPW - Speed - Measured Parallel to Wind
**
** 1 2 3 4 5
** | | | | |
** $--VPW,x.x,N,x.x,M*hh<CR><LF>
**
** Field Number:
** 1) Speed, "-" means downwind
** 2) N = Knots
** 3) Speed, "-" means downwind
** 4) M = Meters per second
** 5) Checksum
*/
/*
** First we check the checksum...
*/
if ( sentence.IsChecksumBad( 5 ) == True )
{
SetErrorMessage( "Invalid Checksum" );
return( FALSE );
}
Knots = sentence.Double( 1 );
MetersPerSecond = sentence.Double( 3 );
return( TRUE );
}
BOOL VPW::Write( SENTENCE& sentence )
{
ASSERT_VALID( this );
/*
** Let the parent do its thing
*/
RESPONSE::Write( sentence );
sentence += Knots;
sentence += "N";
sentence += MetersPerSecond;
sentence += "M";
sentence.Finish();
return( TRUE );
}
const VPW& VPW::operator = ( const VPW& source )
{
ASSERT_VALID( this );
Knots = source.Knots;
MetersPerSecond = source.MetersPerSecond;
return( *this );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -