-
Notifications
You must be signed in to change notification settings - Fork 0
/
NMEA2000StdTypes.h
145 lines (125 loc) · 5.63 KB
/
NMEA2000StdTypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
NMEA2000StdTypes.h
Copyright (c) 2019-2020 Timo Lappalainen, Kave Oy, www.kave.fi
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
NMEA2000 standard type definitions.
This file contains (and must only contain) type definitions of data types
defined in the NMEA2000 standard. These all have names of the form "DDnnn".
The language of the definitions should follow exactly that of the standard
document from which the information is drawn. No abbreviated names. No
mangled capitalisation.
The entries here are mostly enums describing bit field types. Where an enum
member has multiple meanings, each meaning is aliased (see tN2kDD0002 for an
example).
This file is included by N2kTypes.h where the standard code names are aliased
into corresponding long names (once again, exactly as described by NMEA).
*/
#ifndef _NMEA2000StdTypes_H_
#define _NMEA2000StdTypes_H_
// DD002 - Generic Status Pair
//
enum tN2kDD002 {
N2kDD002_No=0,
N2kDD002_Yes=1,
N2kDD002_Error=2,
N2kDD002_Unavailable=3,
N2kDD002_Off=N2kDD002_No,
N2kDD002_Disabled=N2kDD002_No,
N2kDD002_Reset=N2kDD002_No,
N2kDD002_0=N2kDD002_No,
N2kDD002_On=N2kDD002_Yes,
N2kDD002_Enabled=N2kDD002_Yes,
N2kDD002_Set=N2kDD002_Yes,
N2kDD002_1=N2kDD002_Yes,
N2kDD002_Unknown=N2kDD002_Unavailable
};
// DD477 - Windlass Monitoring Events
//
union tN2kDD477 {
unsigned char Events;
struct {
unsigned char ControllerUnderVoltageCutout:1;
unsigned char ControllerOverCurrentCutout:1;
unsigned char ControllerOverTemperatureCutout:1;
} Event;
tN2kDD477(): Events(0) {};
void SetEvents(unsigned char _Events) { Events = (_Events & 0x07); }
};
// DD478 - Windlass Control Events
//
union tN2kDD478 {
unsigned char Events;
struct {
unsigned char AnotherDeviceControllingWindlass:1;
} Event;
tN2kDD478(): Events(0) {};
void SetEvents(unsigned char _Events) { Events = (_Events & 0x01); }
};
// DD480 - Windlass Motion States
//
enum tN2kDD480 {
N2kDD480_WindlassStopped=0,
N2kDD480_DeploymentOccurring=1,
N2kDD480_RetrievalOccurring=2,
N2kDD480_Unavailable=3
};
// DD481 - Rode Type States
//
enum tN2kDD481 {
N2kDD481_ChainPresentlyDetected=0,
N2kDD481_RopePresentlyDetected=1,
N2kDD481_Error=2,
N2kDD481_Unavailable=3
};
// DD482 - Anchor Docking States
//
enum tN2kDD482 {
N2kDD482_NotDocked=0,
N2kDD482_FullyDocked=1,
N2kDD482_Error=2,
N2kDD482_DataNotAvailable=3
};
// DD483 - Windlass Operating Events
//
union tN2kDD483 {
unsigned char Events;
struct {
unsigned char SystemError:1;
unsigned char SensorError:1;
unsigned char NoWindlassMotionDetected:1;
unsigned char RetrievalDockingDistanceReached:1;
unsigned char EndOfRodeReached:1;
} Event;
tN2kDD483(): Events(0) {};
void SetEvents(unsigned char _Events) { Events = (_Events & 0x1F); }
};
// DD484 - Windlass Direction Control
//
enum tN2kDD484 {
N2kDD484_Off=0, // Status only / cannot command
N2kDD484_Down=1,
N2kDD484_Up=2,
N2kDD484_Reserved=3
};
// DD488 - Speed Type
//
enum tN2kDD488 {
N2kDD488_SingleSpeed=0,
N2kDD488_DualSpeed=1,
N2kDD488_ProportionalSpeed=2,
N2kDD488_DataNotAvailable=3
};
#endif