source: pacpussensors/trunk/NMEA0183/src/DCN.cpp@ 67

Last change on this file since 67 was 59, checked in by DHERBOMEZ Gérald, 10 years ago

Integration of new modules:

  • GPS NMEA0183 decoder
  • Span CPT Decoder

Update of:

File size: 4.3 KB
Line 
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: dcn.cpp $
13** $Revision: 5 $
14** $Modtime: 10/10/98 2:46p $
15*/
16
17
18DCN::DCN()
19{
20 Mnemonic = "DCN";
21 Empty();
22}
23
24DCN::~DCN()
25{
26 //Mnemonic.Empty();
27 Empty();
28}
29
30void DCN::Empty( void )
31{
32 DeccaChainID = 0;
33 Red.Empty();
34 Green.Empty();
35 Purple.Empty();
36 RedLineNavigationUse = NMEA_Unknown;
37 GreenLineNavigationUse = NMEA_Unknown;
38 PurpleLineNavigationUse = NMEA_Unknown;
39 PositionUncertaintyNauticalMiles = 0.0;
40 Basis = BasisUnknown;
41}
42
43BOOL DCN::Parse( const SENTENCE& sentence )
44{
45 /*
46 ** DCN - Decca Position
47 ** 11 13 16
48 ** 1 2 3 4 5 6 7 8 9 10| 12| 14 15| 17
49 ** | | | | | | | | | | | | | | | | |
50 ** $--DCN,xx,cc,x.x,A,cc,x.x,A,cc,x.x,A,A,A,A,x.x,N,x*hh<CR><LF>
51 **
52 ** 1) Decca chain identifier
53 ** 2) Red Zone Identifier
54 ** 3) Red Line Of Position
55 ** 4) Red Master Line Status
56 ** 5) Green Zone Identifier
57 ** 6) Green Line Of Position
58 ** 7) Green Master Line Status
59 ** 8) Purple Zone Identifier
60 ** 9) Purple Line Of Position
61 ** 10) Purple Master Line Status
62 ** 11) Red Line Navigation Use
63 ** 12) Green Line Navigation Use
64 ** 13) Purple Line Navigation Use
65 ** 14) Position Uncertainity
66 ** 15) N = Nautical Miles
67 ** 16) Fix Data Basis
68 ** 1 = Normal Pattern
69 ** 2 = Lane Identification Pattern
70 ** 3 = Lane Identification Transmissions
71 ** 17) Checksum
72 */
73
74 /*
75 ** First we check the checksum...
76 */
77
78 if ( sentence.IsChecksumBad( 17 ) == True )
79 {
80 SetErrorMessage( "Invalid Checksum" );
81 return( FALSE );
82 }
83
84 DeccaChainID = sentence.Integer( 1 );
85 Red.Parse( 2, sentence );
86 Green.Parse( 5, sentence );
87 Purple.Parse( 8, sentence );
88 RedLineNavigationUse = sentence.Boolean( 11 );
89 GreenLineNavigationUse = sentence.Boolean( 12 );
90 PurpleLineNavigationUse = sentence.Boolean( 13 );
91 PositionUncertaintyNauticalMiles = sentence.Double( 14 );
92
93 int temp_integer = sentence.Integer( 16 );
94
95 switch( temp_integer )
96 {
97 case 1:
98
99 Basis = NormalPatternBasis;
100 break;
101
102 case 2:
103
104 Basis = LaneIdentificationPatternBasis;
105 break;
106
107 case 3:
108
109 Basis = LaneIdentificationTransmissionsBasis;
110 break;
111
112 default:
113
114 Basis = BasisUnknown;
115 break;
116 }
117
118 return( TRUE );
119}
120
121BOOL DCN::Write( SENTENCE& sentence )
122{
123 /*
124 ** Let the parent do its thing
125 */
126
127 RESPONSE::Write( sentence );
128
129 sentence += DeccaChainID;
130 Red.Write( sentence );
131 Green.Write( sentence );
132 Purple.Write( sentence );
133 sentence += RedLineNavigationUse;
134 sentence += GreenLineNavigationUse;
135 sentence += PurpleLineNavigationUse;
136 sentence += PositionUncertaintyNauticalMiles;
137 sentence += "N";
138
139 switch( Basis )
140 {
141 case NormalPatternBasis:
142
143 sentence += 1;
144 break;
145
146 case LaneIdentificationPatternBasis:
147
148 sentence += 2;
149 break;
150
151 case LaneIdentificationTransmissionsBasis:
152
153 sentence += 3;
154 break;
155
156 default:
157
158 sentence += "";
159 break;
160 }
161
162 sentence.Finish();
163
164 return( TRUE );
165}
166
167const DCN& DCN::operator = ( const DCN& source )
168{
169 DeccaChainID = source.DeccaChainID;
170 Red = source.Red;
171 Green = source.Green;
172 Purple = source.Purple;
173 RedLineNavigationUse = source.RedLineNavigationUse;
174 GreenLineNavigationUse = source.GreenLineNavigationUse;
175 PurpleLineNavigationUse = source.PurpleLineNavigationUse;
176 PositionUncertaintyNauticalMiles = source.PositionUncertaintyNauticalMiles;
177 Basis = source.Basis;
178
179 return( *this );
180}
Note: See TracBrowser for help on using the repository browser.