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 #include <wx/math.h>
54 
55 /*
56 ** Turn off the warning about precompiled headers, it is rather annoying
57 */
58 
59 #ifdef __MSVC__
60 #pragma warning( disable : 4699 )
61 #endif
62 
63 #define CARRIAGE_RETURN 0x0D
64 #define LINE_FEED       0x0A
65 
66 
67 typedef enum _NMEA0183_BOOLEAN
68 {
69    Unknown0183 = 0,
70    NTrue,
71    NFalse
72 } NMEA0183_BOOLEAN;
73 
74 typedef enum _leftright
75 {
76    LR_Unknown = 0,
77    Left,
78    Right
79 } LEFTRIGHT;
80 
81 typedef enum _eastwest
82 {
83    EW_Unknown = 0,
84    East,
85    West
86 } EASTWEST;
87 
88 typedef enum _northsouth
89 {
90    NS_Unknown = 0,
91    North,
92    South
93 } NORTHSOUTH;
94 
95 typedef enum _reference
96 {
97    ReferenceUnknown = 0,
98    BottomTrackingLog,
99    ManuallyEntered,
100    WaterReferenced,
101    RadarTrackingOfFixedTarget,
102    PositioningSystemGroundReference
103 } REFERENCE;
104 
105 typedef enum _communicationsmode
106 {
107    CommunicationsModeUnknown         = 0,
108    F3E_G3E_SimplexTelephone          = 'd',
109    F3E_G3E_DuplexTelephone           = 'e',
110    J3E_Telephone                     = 'm',
111    H3E_Telephone                     = 'o',
112    F1B_J2B_FEC_NBDP_TelexTeleprinter = 'q',
113    F1B_J2B_ARQ_NBDP_TelexTeleprinter = 's',
114    F1B_J2B_ReceiveOnlyTeleprinterDSC = 'w',
115    A1A_MorseTapeRecorder             = 'x',
116    A1A_MorseKeyHeadset               = '{',
117    F1C_F2C_F3C_FaxMachine            = '|'
118 } COMMUNICATIONS_MODE;
119 
120 typedef enum _transducertype
121 {
122    TransducerUnknown   = 0,
123    AngularDisplacementTransducer = 'A',
124    TemperatureTransducer         = 'C',
125    LinearDisplacementTransducer  = 'D',
126    FrequencyTransducer           = 'F',
127    HumidityTransducer            = 'H',
128    ForceTransducer               = 'N',
129    PressureTransducer            = 'P',
130    FlowRateTransducer            = 'R',
131    TachometerTransducer          = 'T',
132    VolumeTransducer              = 'V'
133 } TRANSDUCER_TYPE;
134 
135 typedef enum
136 {
137       RouteUnknown = 0,
138       CompleteRoute,
139       WorkingRoute
140 } ROUTE_TYPE;
141 
142 /*
143 ** Misc Function Prototypes
144 */
145 
146 int HexValue( const wxString& hex_string );
147 
148 wxString& expand_talker_id( const wxString & );
149 wxString& Hex( int value );
150 wxString& talker_id( const wxString& sentence );
151 
152 #include "nmea0183.hpp"
153 
154 #endif // NMEA0183_HEADER
155