1 /***************************************************************************
2  *
3  * Project:  OpenCPN
4  * Purpose:  NMEA0183 Support Classes
5  * Author:   Samuel R. Blackburn, David S. Register
6  *
7  ***************************************************************************
8  *   Copyright (C) 2010 by Samuel R. Blackburn, David S Register           *
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  *   This program is distributed in the hope that it will be useful,       *
16  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
17  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
18  *   GNU General Public License for more details.                          *
19  *                                                                         *
20  *   You should have received a copy of the GNU General Public License     *
21  *   along with this program; if not, write to the                         *
22  *   Free Software Foundation, Inc.,                                       *
23  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,  USA.             *
24  ***************************************************************************
25  *
26  *   S Blackburn's original source license:                                *
27  *         "You can use it any way you like."                              *
28  *   More recent (2010) license statement:                                 *
29  *         "It is BSD license, do with it what you will"                   *
30  */
31 
32 #if ! defined( NMEA_0183_HEADER )
33 
34 #define NMEA_0183_HEADER
35 
36 /*
37 ** Author: Samuel R. Blackburn
38 ** CI$: 76300,326
39 ** Internet: sammy@sed.csc.com
40 **
41 ** You can use it any way you like.
42 */
43 
44 //    Include wxWindows stuff
45 //#include "wx/wxprec.h"
46 
47 //#ifndef  WX_PRECOMP
48 //  #include "wx/wx.h"
49 //#endif //precompiled headers
50 #include "wx/string.h"
51 #include "wx/list.h"
52 #include "wx/arrstr.h"
53 
54 /*
55 ** Turn off the warning about precompiled headers, it is rather annoying
56 */
57 
58 #ifdef __MSVC__
59 #pragma warning( disable : 4699 )
60 #endif
61 
62 #define CARRIAGE_RETURN 0x0D
63 #define LINE_FEED       0x0A
64 
65 
66 typedef enum _NMEA0183_BOOLEAN
67 {
68    Unknown0183 = 0,
69    NTrue,
70    NFalse
71 } NMEA0183_BOOLEAN;
72 
73 typedef enum _leftright
74 {
75    LR_Unknown = 0,
76    Left,
77    Right
78 } LEFTRIGHT;
79 
80 typedef enum _eastwest
81 {
82    EW_Unknown = 0,
83    East,
84    West
85 } EASTWEST;
86 
87 typedef enum _northsouth
88 {
89    NS_Unknown = 0,
90    North,
91    South
92 } NORTHSOUTH;
93 
94 typedef enum _reference
95 {
96    ReferenceUnknown = 0,
97    BottomTrackingLog,
98    ManuallyEntered,
99    WaterReferenced,
100    RadarTrackingOfFixedTarget,
101    PositioningSystemGroundReference
102 } REFERENCE;
103 
104 typedef enum _communicationsmode
105 {
106    CommunicationsModeUnknown         = 0,
107    F3E_G3E_SimplexTelephone          = 'd',
108    F3E_G3E_DuplexTelephone           = 'e',
109    J3E_Telephone                     = 'm',
110    H3E_Telephone                     = 'o',
111    F1B_J2B_FEC_NBDP_TelexTeleprinter = 'q',
112    F1B_J2B_ARQ_NBDP_TelexTeleprinter = 's',
113    F1B_J2B_ReceiveOnlyTeleprinterDSC = 'w',
114    A1A_MorseTapeRecorder             = 'x',
115    A1A_MorseKeyHeadset               = '{',
116    F1C_F2C_F3C_FaxMachine            = '|'
117 } COMMUNICATIONS_MODE;
118 
119 typedef enum _transducertype
120 {
121    TransducerUnknown   = 0,
122    AngularDisplacementTransducer = 'A',
123    TemperatureTransducer         = 'C',
124    LinearDisplacementTransducer  = 'D',
125    FrequencyTransducer           = 'F',
126    HumidityTransducer            = 'H',
127    ForceTransducer               = 'N',
128    PressureTransducer            = 'P',
129    FlowRateTransducer            = 'R',
130    TachometerTransducer          = 'T',
131    VolumeTransducer              = 'V'
132 } TRANSDUCER_TYPE;
133 
134 typedef enum
135 {
136       RouteUnknown = 0,
137       CompleteRoute,
138       WorkingRoute
139 } ROUTE_TYPE;
140 
141 /*
142 ** Misc Function Prototypes
143 */
144 
145 int HexValue( const wxString& hex_string );
146 
147 wxString& expand_talker_id( const wxString & );
148 wxString& Hex( int value );
149 wxString& talker_id( const wxString& sentence );
150 
151 #include "nmea0183.hpp"
152 
153 #endif // NMEA0183_HEADER
154