[59] | 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: satdat.cpp $
|
---|
| 13 | ** $Revision: 4 $
|
---|
| 14 | ** $Modtime: 10/10/98 2:43p $
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | SATELLITE_DATA::SATELLITE_DATA()
|
---|
| 19 | {
|
---|
| 20 | Empty();
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | SATELLITE_DATA::~SATELLITE_DATA()
|
---|
| 24 | {
|
---|
| 25 | Empty();
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | void SATELLITE_DATA::Empty( void )
|
---|
| 29 | {
|
---|
| 30 | SatelliteNumber = 0;
|
---|
| 31 | ElevationDegrees = 0;
|
---|
| 32 | AzimuthDegreesTrue = 0;
|
---|
| 33 | SignalToNoiseRatio = (-1);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | void SATELLITE_DATA::Parse( int first_field_number, const SENTENCE& sentence )
|
---|
| 37 | {
|
---|
| 38 | SatelliteNumber = sentence.Integer( first_field_number );
|
---|
| 39 | ElevationDegrees = sentence.Integer( first_field_number + 1 );
|
---|
| 40 | AzimuthDegreesTrue = sentence.Integer( first_field_number + 2 );
|
---|
| 41 |
|
---|
| 42 | QString field_data = sentence.Field( first_field_number + 3 );
|
---|
| 43 |
|
---|
| 44 | if ( field_data == "" )
|
---|
| 45 | {
|
---|
| 46 | SignalToNoiseRatio = (-1);
|
---|
| 47 | }
|
---|
| 48 | else
|
---|
| 49 | {
|
---|
| 50 | SignalToNoiseRatio = sentence.Integer( first_field_number + 3 );
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | void SATELLITE_DATA::Write( SENTENCE& sentence )
|
---|
| 56 | {
|
---|
| 57 | sentence += SatelliteNumber;
|
---|
| 58 | sentence += ElevationDegrees;
|
---|
| 59 | sentence += AzimuthDegreesTrue;
|
---|
| 60 |
|
---|
| 61 | if ( SignalToNoiseRatio == (-1) )
|
---|
| 62 | {
|
---|
| 63 | sentence += "";
|
---|
| 64 | }
|
---|
| 65 | else
|
---|
| 66 | {
|
---|
| 67 | sentence += SignalToNoiseRatio;
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | const SATELLITE_DATA& SATELLITE_DATA::operator = ( const SATELLITE_DATA& source )
|
---|
| 72 | {
|
---|
| 73 | SatelliteNumber = source.SatelliteNumber;
|
---|
| 74 | ElevationDegrees = source.ElevationDegrees;
|
---|
| 75 | AzimuthDegreesTrue = source.AzimuthDegreesTrue;
|
---|
| 76 | SignalToNoiseRatio = source.SignalToNoiseRatio;
|
---|
| 77 |
|
---|
| 78 | return( *this );
|
---|
| 79 | }
|
---|