1 | #include "nmea0183.h"
|
---|
2 | #pragma hdrstop
|
---|
3 |
|
---|
4 | /*
|
---|
5 | ** Author: Samuel R. Blackburn
|
---|
6 | ** Internet: sam_blackburn@pobox.com
|
---|
7 | **
|
---|
8 | ** You can use it any way you like as long as you don't try to sell it.
|
---|
9 | **
|
---|
10 | ** Copyright, 1996, Samuel R. Blackburn
|
---|
11 | **
|
---|
12 | ** $Workfile: fsi.cpp $
|
---|
13 | ** $Revision: 5 $
|
---|
14 | ** $Modtime: 10/10/98 2:46p $
|
---|
15 | */
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 | FSI::FSI()
|
---|
20 | {
|
---|
21 | Mnemonic = "FSI";
|
---|
22 | Empty();
|
---|
23 | }
|
---|
24 |
|
---|
25 | FSI::~FSI()
|
---|
26 | {
|
---|
27 | //Mnemonic.Empty();
|
---|
28 | Empty();
|
---|
29 | }
|
---|
30 |
|
---|
31 | void FSI::Empty( void )
|
---|
32 | {
|
---|
33 | TransmittingFrequency = 0.0;
|
---|
34 | ReceivingFrequency = 0.0;
|
---|
35 | Mode = CommunicationsModeUnknown;
|
---|
36 | PowerLevel = 0;
|
---|
37 | }
|
---|
38 |
|
---|
39 | BOOL FSI::Parse( const SENTENCE& sentence )
|
---|
40 | {
|
---|
41 | /*
|
---|
42 | ** FSI - Frequency Set Information
|
---|
43 | **
|
---|
44 | ** 1 2 3 4 5
|
---|
45 | ** | | | | |
|
---|
46 | ** $--FSI,xxxxxx,xxxxxx,c,x*hh<CR><LF>
|
---|
47 | **
|
---|
48 | ** Field Number:
|
---|
49 | ** 1) Transmitting Frequency
|
---|
50 | ** 2) Receiving Frequency
|
---|
51 | ** 3) Communications Mode
|
---|
52 | ** 4) Power Level
|
---|
53 | ** 5) Checksum
|
---|
54 | */
|
---|
55 |
|
---|
56 | /*
|
---|
57 | ** First we check the checksum...
|
---|
58 | */
|
---|
59 |
|
---|
60 | if ( sentence.IsChecksumBad( 5 ) == True )
|
---|
61 | {
|
---|
62 | SetErrorMessage( "Invalid Checksum" );
|
---|
63 | return( FALSE );
|
---|
64 | }
|
---|
65 |
|
---|
66 | TransmittingFrequency = sentence.Double( 1 );
|
---|
67 | ReceivingFrequency = sentence.Double( 2 );
|
---|
68 | Mode = sentence.CommunicationsMode( 3 );
|
---|
69 | PowerLevel = (short) sentence.Integer( 4 );
|
---|
70 |
|
---|
71 | return( TRUE );
|
---|
72 | }
|
---|
73 |
|
---|
74 | BOOL FSI::Write( SENTENCE& sentence )
|
---|
75 | {
|
---|
76 | /*
|
---|
77 | ** Let the parent do its thing
|
---|
78 | */
|
---|
79 |
|
---|
80 | RESPONSE::Write( sentence );
|
---|
81 |
|
---|
82 | sentence += TransmittingFrequency;
|
---|
83 | sentence += ReceivingFrequency;
|
---|
84 | sentence += Mode;
|
---|
85 | sentence += PowerLevel;
|
---|
86 |
|
---|
87 | sentence.Finish();
|
---|
88 |
|
---|
89 | return( TRUE );
|
---|
90 | }
|
---|
91 |
|
---|
92 | const FSI& FSI::operator = ( const FSI& source )
|
---|
93 | {
|
---|
94 | TransmittingFrequency = source.TransmittingFrequency;
|
---|
95 | ReceivingFrequency = source.ReceivingFrequency;
|
---|
96 | Mode = source.Mode;
|
---|
97 | PowerLevel = source.PowerLevel;
|
---|
98 |
|
---|
99 | return( *this );
|
---|
100 | }
|
---|