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: lorantd.cpp $
|
---|
13 | ** $Revision: 4 $
|
---|
14 | ** $Modtime: 10/10/98 2:44p $
|
---|
15 | */
|
---|
16 |
|
---|
17 |
|
---|
18 | LORAN_TIME_DIFFERENCE::LORAN_TIME_DIFFERENCE()
|
---|
19 | {
|
---|
20 | Empty();
|
---|
21 | }
|
---|
22 |
|
---|
23 | LORAN_TIME_DIFFERENCE::~LORAN_TIME_DIFFERENCE()
|
---|
24 | {
|
---|
25 | Empty();
|
---|
26 | }
|
---|
27 |
|
---|
28 | void LORAN_TIME_DIFFERENCE::Empty( void )
|
---|
29 | {
|
---|
30 | Microseconds = 0.0;
|
---|
31 | SignalStatus = LoranUnknown;
|
---|
32 | }
|
---|
33 |
|
---|
34 | void LORAN_TIME_DIFFERENCE::Parse( int first_field_number, const SENTENCE& sentence )
|
---|
35 | {
|
---|
36 | Microseconds = sentence.Double( first_field_number );
|
---|
37 |
|
---|
38 | QString field_data = sentence.Field( first_field_number + 1 );
|
---|
39 |
|
---|
40 | if ( field_data == "B" )
|
---|
41 | {
|
---|
42 | SignalStatus = LoranBlinkWarning;
|
---|
43 | }
|
---|
44 | else if ( field_data == "C" )
|
---|
45 | {
|
---|
46 | SignalStatus = LoranCycleWarning;
|
---|
47 | }
|
---|
48 | else if ( field_data == "C" )
|
---|
49 | {
|
---|
50 | SignalStatus = LoranSignalToNoiseRatioWarning;
|
---|
51 | }
|
---|
52 | else if ( field_data == "A" )
|
---|
53 | {
|
---|
54 | SignalStatus = LoranValid;
|
---|
55 | }
|
---|
56 | else
|
---|
57 | {
|
---|
58 | SignalStatus = LoranUnknown;
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | void LORAN_TIME_DIFFERENCE::Write( SENTENCE& sentence )
|
---|
63 | {
|
---|
64 | sentence += Microseconds;
|
---|
65 |
|
---|
66 | switch( SignalStatus )
|
---|
67 | {
|
---|
68 | case LoranValid:
|
---|
69 |
|
---|
70 | sentence += "A";
|
---|
71 | break;
|
---|
72 |
|
---|
73 | case LoranBlinkWarning:
|
---|
74 |
|
---|
75 | sentence += "B";
|
---|
76 | break;
|
---|
77 |
|
---|
78 | case LoranCycleWarning:
|
---|
79 |
|
---|
80 | sentence += "C";
|
---|
81 | break;
|
---|
82 |
|
---|
83 | case LoranSignalToNoiseRatioWarning:
|
---|
84 |
|
---|
85 | sentence += "S";
|
---|
86 | break;
|
---|
87 |
|
---|
88 | default:
|
---|
89 |
|
---|
90 | sentence += "";
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 | const LORAN_TIME_DIFFERENCE& LORAN_TIME_DIFFERENCE::operator = ( const LORAN_TIME_DIFFERENCE& source )
|
---|
95 | {
|
---|
96 | Microseconds = source.Microseconds;
|
---|
97 | SignalStatus = source.SignalStatus;
|
---|
98 |
|
---|
99 | return( *this );
|
---|
100 | }
|
---|