NMEA2000 Library  0.1
Library to handle NMEA 2000 Communication written in C++
N2kMessagesEnumToStr.h
Go to the documentation of this file.
1/*
2 * N2kMessagesEnumToStr.h
3
4 * Copyright (c) 2015-2024 Timo Lappalainen, Kave Oy, www.kave.fi
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22*/
23
24/************************************************************************/
47#ifndef _N2kMessagesEnumToStr_H_
48#define _N2kMessagesEnumToStr_H_
49
50#include "N2kMessages.h"
51
52/************************************************************************/
55const char *N2kEnumTypeEmpty="";
56
57/************************************************************************/
69template<typename T> void PrintN2kEnumType(T a, Stream *OutputStream, bool addLF=true) {
70 const char *str=N2kEnumTypeToStr(a);
71 if (str[0] != '\0') {
72 if (addLF) { OutputStream->println(str); } else { OutputStream->print(str); }
73 } else {
74 OutputStream->print(F("unknown (")); OutputStream->print(a); OutputStream->println(F(")"));
75 }
76}
77/************************************************************************/
102#define MakeN2kEnumTypeToStrFunc(enumType,strs) \
103const char * N2kEnumTypeToStr(enumType enumVal) { \
104 if ( enumVal<(sizeof(strs)/sizeof(const char *)) ) { \
105 return strs[enumVal]; \
106 } else { return N2kEnumTypeEmpty; }\
107}
108
109/************************************************************************/
112const char* tN2kHeadingReferenceStrs[] = { "true", "magnetic" };
113
114/************************************************************************/
118
119/************************************************************************/
122const char* tN2kTimeSourceStrs[] = { "GPS", "GLONASS", "radio station", "local cesium clock", "local rubidium clock", "local crystal clock" };
123
124/************************************************************************/
128
129/************************************************************************/
132const char* tN2kGNSStypeStrs[] = { "GPS", "GLONASS", "GPS+GLONASS", "GPS+SBAS/WAAS", "GPS+SBAS/WAAS+GLONASS", "Chayka", "integrated", "surveyed", "Galileo" };
133/************************************************************************/
137
138/************************************************************************/
141const char* tN2kGNSSmethodStrs[] = { "no GNSS", "GNSS fix", "DGNSS", "precise GNSS" };
142/************************************************************************/
146
147/************************************************************************/
150const char* tN2kFluidTypeStrs[] = { "Fuel", "Water", "Gray water", "Live well", "Oil", "Black water", "Gasoline Fuel",
151 "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved",
152 "Error", "Unavailable",};
153/************************************************************************/
157
158/************************************************************************/
161const char* tN2kTempSourceStrs[] = { "sea", "outside", "inside", "engine room", "main cabin", "live well", "bait well", "refridgeration",
162 "heating system", "dew point", "apparent wind chill", "theoretical wind chill", "heat index", "freezer", "exhaust gas"};
163/************************************************************************/
167
168/************************************************************************/
171const char* tN2kBatTypeStrs[] = { "flooded", "gel", "AGM"};
172/************************************************************************/
176
177/************************************************************************/
180const char* tN2kBatEqSupportStrs[] = { "no", "yes", "error"};
181/************************************************************************/
185
186/************************************************************************/
189const char* tN2kBatNomVoltStrs[] = { "6V", "12V", "24V", "32V", "62V", "42V", "48V"};
190/************************************************************************/
194
195/************************************************************************/
198const char* tN2kBatChemStrs[] = { "lead acid", "LiIon", "NiCad", "NiMh"};
199/************************************************************************/
203
204/************************************************************************/
207const char* tN2kDCTypeStrs[] = { "battery", "altenator", "converter", "solar cell", "wind generator"};
208/************************************************************************/
212
213/************************************************************************/
216const char* tN2kTransmissionGearStrs[] = { "forward", "neutral", "reverse", "unknown"};
217/************************************************************************/
221
222/************************************************************************/
225const char* tN2kOnOffStrs[] = { "0", "1", "err", "NA" };
226/************************************************************************/
230
231/************************************************************************/
234const char* tN2kPressureStrs[] = { "atmospheric", "water", "steam", "compressed air", "hydraulic", "filter", "altimete setting", "oil", "fuel" };
235/************************************************************************/
239
240/************************************************************************/
243const char* tN2kHumidityStrs[] = { "inside", "outside" };
244/************************************************************************/
248
249/************************************************************************/
252const char* tN2kRudderDirectionOrderStrs[] = { "no direction order", "move to starboard", "move to port" };
253/************************************************************************/
257
258/************************************************************************/
261const char* tN2kSpeedWaterReferenceTypeStrs[] = {"Paddle wheel","Pitot tube","Doppler","Correlation (ultra sound)","Electro Magnetic"};
262/************************************************************************/
267
268/************************************************************************/
271const char* tN2kMagneticVariationStrs[] = { "Manual","Automatic Chart","Automatic Table","Automatic Calculation","WMM 2000","WMM 2005","WMM 2010","WMM 2015","WMM 2020" };
272/************************************************************************/
276
277/************************************************************************/
280const char* const tN2kXTEModeStrs[] = { "Autonomous", "Differential", "Estimated", "Simulator" };
281
282/************************************************************************/
286
287#endif
Stream * OutputStream
#define F(str)
Definition: N2kDef.h:64
This File contains all SetXXX functions which will be needed to transfer data with a specific PGN.
const char * tN2kSpeedWaterReferenceTypeStrs[]
string representation of the N2k enum tN2kSpeedWaterReferenceType
const char * tN2kBatChemStrs[]
string representation of the N2k enum tN2kBatChem
const char * tN2kPressureStrs[]
string representation of the N2k enum tN2kPressureSource
const char * N2kEnumTypeEmpty
Default value if no string representation is found.
const char * tN2kGNSSmethodStrs[]
string representation of the N2k enum tN2kGNSSmethod
const char * tN2kHeadingReferenceStrs[]
string representation of the N2k enum tN2kHeadingReference
const char * tN2kBatTypeStrs[]
string representation of the N2k enum tN2kBatType
const char * tN2kGNSStypeStrs[]
string representation of the N2k enum tN2kGNSStype
const char * tN2kHumidityStrs[]
string representation of the N2k enum tN2kHumiditySource
const char * tN2kFluidTypeStrs[]
string representation of the N2k enum tN2kFluidType
const char * tN2kRudderDirectionOrderStrs[]
string representation of the N2k enum tN2kRudderDirectionOrder
const char * tN2kOnOffStrs[]
string representation of the N2k enum tN2kOnOff
const char * tN2kBatEqSupportStrs[]
string representation of the N2k enum tN2kBatEqSupport
const char * tN2kTransmissionGearStrs[]
string representation of the N2k enum tN2kTransmissionGear
const char * tN2kDCTypeStrs[]
string representation of the N2k enum tN2kDCType
const char * tN2kBatNomVoltStrs[]
string representation of the N2k enum tN2kBatNomVolt
const char * tN2kMagneticVariationStrs[]
string representation of the N2k enum tN2kMagneticVariation
void PrintN2kEnumType(T a, Stream *OutputStream, bool addLF=true)
Print function for the enum values.
const char * tN2kTimeSourceStrs[]
string representation of the N2k enum tN2kTimeSource
#define MakeN2kEnumTypeToStrFunc(enumType, strs)
Macro function for converting various N2k Enums to a const char.
const char * tN2kTempSourceStrs[]
string representation of the N2k enum tN2kTempSource
const char *const tN2kXTEModeStrs[]
string representation of the N2k enum tN2kXTEModeStrs
tN2kHeadingReference
Enumeration of the heading type according to PGN129233, PGN129237 , PGN129250, PGN129026 and PGN12928...
Definition: N2kTypes.h:62
tN2kBatNomVolt
Enumeration of nominal battery voltage according to PGN 127513.
Definition: N2kTypes.h:345
tN2kTimeSource
Enumeration of sources for the system time according to PGN126992.
Definition: N2kTypes.h:222
tN2kMagneticVariation
Enumeration of magnetic variation according to PGN 127258.
Definition: N2kTypes.h:473
tN2kRudderDirectionOrder
Enumeration of Rudder Direction Order according to PGN127237, 127245.
Definition: N2kTypes.h:279
tN2kGNSSmethod
Enumeration of GNSS working methods according to PGN129029.
Definition: N2kTypes.h:126
tN2kTransmissionGear
Enumeration of transmission state according to PGN 127493.
Definition: N2kTypes.h:358
tN2kDCType
Enumeration of DC power sources according to PGN 127506.
Definition: N2kTypes.h:292
tN2kOnOff
Enumeration of On/Off status at a NMEA 2000 network.
Definition: N2kTypes.h:488
tN2kTempSource
Enumeration of sources for a temperature value according to PGN130311, PGN130312 and PGN130316.
Definition: N2kTypes.h:171
tN2kBatChem
Enumeration of battery chemistries according to PGN 127513.
Definition: N2kTypes.h:332
tN2kBatType
Enumeration of Battery types according to PGN 127513.
Definition: N2kTypes.h:306
tN2kGNSStype
Enumeration of the GPS system which is in use according to PGN129029, PGN129041 and PGN129794.
Definition: N2kTypes.h:108
tN2kSpeedWaterReferenceType
Enumeration of speed thru water sensors types according to PGN128259.
Definition: N2kTypes.h:266
tN2kBatEqSupport
Enumeration of Supports Equalization according to PGN 127513.
Definition: N2kTypes.h:318
tN2kHumiditySource
Enumeration of sources for a humidity value according to PGN130311 and PGN130313.
Definition: N2kTypes.h:194
tN2kPressureSource
Enumeration of sources for a pressure value according to PGN130314 and PGN130315.
Definition: N2kTypes.h:204
tN2kFluidType
Enumeration of fluid types according to PGN127505.
Definition: N2kTypes.h:234
tN2kXTEMode
Enumeration of Cross Track Error modes according to PGN129283.
Definition: N2kTypes.h:95