⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expid.cpp

📁 提取各种NEMA0183格式数据的类编程。
💻 CPP
字号:
/*
** Author: Samuel R. Blackburn
** Internet: wfc@pobox.com
**
** Copyright, 1996-2005, Samuel R. Blackburn
**
** "You can get credit for something or get it done, but not both."
** Dr. Richard Garwin
**
** BSD License follows.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer. Redistributions
** in binary form must reproduce the above copyright notice, this list
** of conditions and the following disclaimer in the documentation and/or
** other materials provided with the distribution. Neither the name of
** the WFC nor the names of its contributors may be used to endorse or
** promote products derived from this software without specific prior
** written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** $Workfile: expid.cpp $
** $Revision: 4 $
** $Modtime: 10/10/98 2:59p $
*/

#include "nmea0183.h"
#pragma hdrstop

#if defined( _DEBUG ) && defined( _INC_CRTDBG )
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif // _DEBUG

CString expand_talker_id( const CString &identifier )
{
   CString expanded_identifier;

   TCHAR first_character  = 0x00;
   TCHAR second_character = 0x00;

   first_character  = identifier[ 0 ];
   second_character = identifier[ 1 ];

   /*
   ** Set up our default return value
   */

   expanded_identifier = TEXT( "Unknown - " );
   expanded_identifier += identifier;

   switch( first_character )
   {
      case 'A': // AG, AP

         switch( second_character )
         {
            case 'G': // AG

               expanded_identifier = TEXT( "Autopilot - General" );
               break;

            case 'P': // AP

               expanded_identifier = TEXT( "Autopilot - Magnetic" );
               break;
         }

         break;

      case 'C': // CD, CS, CT, CV, CX and CC,CM

         switch( second_character )
         {
            case 'C': // CC

               expanded_identifier = TEXT( "Commputer - Programmed Calculator (outdated)" );
               break;

            case 'D': // CD

               expanded_identifier = TEXT( "Communications - Digital Selective Calling (DSC)" );
               break;

            case 'M': // CM

               expanded_identifier = TEXT( "Computer - Memory Data (outdated)" );
               break;

            case 'S': // CS

               expanded_identifier = TEXT( "Communications - Satellite" );
               break;

            case 'T': // CT

               expanded_identifier = TEXT( "Communications - Radio-Telephone (MF/HF)" );
               break;

            case 'V': // CV

               expanded_identifier = TEXT( "Communications - Radio-Telephone (VHF)" );
               break;

            case 'X': // CX

               expanded_identifier = TEXT( "Communications - Scanning Receiver" );
               break;
         }

         break;

      case 'D': // DE, DF

         switch( second_character )
         {
            case 'E': // DE

               expanded_identifier = TEXT( "DECCA Navigation" );
               break;

            case 'F': // DF

               expanded_identifier = TEXT( "Direction Finder" );
               break;
         }

         break;

      case 'E': // EC, EP, ER

         switch( second_character )
         {
            case 'C': // EC

               expanded_identifier = TEXT( "Electronic Chart Display & Information System (ECDIS)" );
               break;

            case 'P': // EP

               expanded_identifier = TEXT( "Emergency Position Indicating Beacon (EPIRB)" );
               break;

            case 'R': // ER

               expanded_identifier = TEXT( "Engine Room Monitoring Systems" );
               break;
         }

         break;

      case 'G': // GP
 
         switch( second_character )
         {
            case 'P': // GP

               expanded_identifier = TEXT( "Global Positioning System (GPS)" );
               break;
         }

         break;

      case 'H': // HC, HE, HN
 
         switch( second_character )
         {
            case 'C': // HC

               expanded_identifier = TEXT( "Heading - Magnetic Compass" );
               break;

            case 'E': // HE

               expanded_identifier = TEXT( "Heading - North Seeking Gyro" );
               break;

            case 'N': // HN

               expanded_identifier = TEXT( "Heading - Non North Seeking Gyro" );
               break;
         }

         break;

      case 'I': // II, IN
 
         switch( second_character )
         {
            case 'I': // II

               expanded_identifier = TEXT( "Integrated Instrumentation" );
               break;

            case 'N': // IN

               expanded_identifier = TEXT( "Integrated Navigation" );
               break;
         }

         break;

      case 'L': // LA, LC
 
         switch( second_character )
         {
            case 'A': // LA

               expanded_identifier = TEXT( "Loran A" );
               break;

            case 'C': // LC

               expanded_identifier = TEXT( "Loran C" );
               break;
         }

         break;

      case 'M': // MP
 
         switch( second_character )
         {
            case 'P': // MP

               expanded_identifier = TEXT( "Microwave Positioning System (outdated)" );
               break;
         }

         break;

      case 'O': // OM, OS
 
         switch( second_character )
         {
            case 'M': // OM

               expanded_identifier = TEXT( "OMEGA Navigation System" );
               break;

            case 'S': // OS

               expanded_identifier = TEXT( "Distress Alarm System (outdated)" );
               break;
         }

         break;

      case 'P': // P
 
         break;

      case 'R': // RA
 
         switch( second_character )
         {
            case 'A': // RA

               expanded_identifier = TEXT( "RADAR and/or ARPA" );
               break;
         }

         break;

      case 'S': // SD, SN, SS
 
         switch( second_character )
         {
            case 'D': // SD

               expanded_identifier = TEXT( "Sounder, Depth" );
               break;

            case 'N': // SN

               expanded_identifier = TEXT( "Electronic Positioning System, other/general" );
               break;

            case 'S': // SS
            
               expanded_identifier = TEXT( "Sounder, Scanning" );
               break;
         }

         break;

      case 'T': // TI, TR
       
         switch( second_character )
         {
            case 'I': // TI

               expanded_identifier = TEXT( "Turn Rate Indicator" );
               break;

            case 'R': // TR

               expanded_identifier = TEXT( "TRANSIT Navigation System" );
               break;
         }

         break;

      case 'V': // VD, VM, VW
 
         switch( second_character )
         {
            case 'D': // VD

               expanded_identifier = TEXT( "Velocity Sensor, Doppler, other/general" );
               break;

            case 'M': // VM

               expanded_identifier = TEXT( "Velocity Sensor, Speed Log, Water, Magnetic" );
               break;

            case 'W': // VW

               expanded_identifier = TEXT( "Velocity Sensor, Speed Log, Water, Mechanical" );
               break;
         }

         break;


      case 'W': // WI
 
         switch( second_character )
         {
            case 'I': // WI

               expanded_identifier = TEXT( "Weather Instruments" );
               break;
         }

         break;

      case 'Y': // YC, YD, YF, YL, YP, YR, YT, YV, YX
 
         switch( second_character )
         {
            case 'C': // YC

               expanded_identifier = TEXT( "Transducer - Temperature (outdated)" );
               break;

            case 'D': // YD

               expanded_identifier = TEXT( "Transducer - Displacement, Angular or Linear (outdated)" );
               break;

            case 'F': // YF

               expanded_identifier = TEXT( "Transducer - Frequency (outdated)" );
               break;

            case 'L': // YL

               expanded_identifier = TEXT( "Transducer - Level (outdated)" );
               break;

            case 'P': // YP

               expanded_identifier = TEXT( "Transducer - Pressure (outdated)" );
               break;

            case 'R': // YR

               expanded_identifier = TEXT( "Transducer - Flow Rate (outdated)" );
               break;

            case 'T': // YT

               expanded_identifier = TEXT( "Transducer - Tachometer (outdated)" );
               break;

            case 'V': // YV

               expanded_identifier = TEXT( "Transducer - Volume (outdated)" );
               break;

            case 'X': // YX

               expanded_identifier = TEXT( "Transducer" );
               break;

         }

         break;

      case 'Z': // ZA, ZC, ZQ, ZV
 
         switch( second_character )
         {
            case 'A': // ZA

               expanded_identifier = TEXT( "Timekeeper - Atomic Clock" );
               break;

            case 'C': // ZC

               expanded_identifier = TEXT( "Timekeeper - Chronometer" );
               break;

            case 'Q': // ZQ
            
               expanded_identifier = TEXT( "Timekeeper - Quartz" );
               break;

            case 'V': // ZV
            
               expanded_identifier = TEXT( "Timekeeper - Radio Update, WWV or WWVH" );
               break;
         }

         break;
   }

   return( expanded_identifier );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -