-
Notifications
You must be signed in to change notification settings - Fork 226
/
N2kMessages.h
5836 lines (5532 loc) · 291 KB
/
N2kMessages.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* N2kMessages.h
*
* Copyright (c) 2015-2024 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.
*/
/************************************************************************//**
* \file N2kMessages.h
* \brief This File contains all SetXXX functions which will be needed to
* transfer data with a specific PGN.
*
* This is a collection of functions for handling NMEA2000 bus messages.
* Library contains functions to e.g. create message named with PGN like
* \ref SetN2kPGN129025 and alias easy for humans to read like \ref
* SetN2kLatLonRapid.
*
* Each SetN2kPNGxxx function sets related message PGN and its default
* priority. The default priority can be different for each PGN. So if you
* want to change priority on function, you have to do it after Setxxx call.
*
* Each SetN2kPNGxxx function has a corresponding ParsN2kPGNxxx function which
* can extract the data out of an incoming N2k Message. These functions have as
* well an inline alias easy for humans to read like \ref ParseN2kPositionRapid.
*
* The content of the PGNs is specified by the NMEA2000 Standard under
*
* - https://web.archive.org/web/20220515054117/https://www.nmea.org/Assets/july%202010%20nmea2000_v1-301_app_b_pgn_field_list.pdf
* - https://web.archive.org/web/20200918140201/https://www.nmea.org/Assets/20151026%20nmea%202000%20pgn_website_description_list.pdf
*
* If you do not send anything to NMEA2000 bus, you do not need this library.
* Funtions for BUS handling PGN:s like 60928 "ISO Address Claim" has been
* defined in bus device library
*
* NMEA2000.h
*
* ********************************************************************/
#ifndef _N2kMessages_H_
#define _N2kMessages_H_
#include "N2kMsg.h"
#include "N2kTypes.h"
#include <string.h>
#include <stdint.h>
/************************************************************************//**
* \brief Converting a value from Rad to Deg
* \param v Input value in [rad]
* \return Corresponding value in [deg]
*/
inline double RadToDeg(double v) { return N2kIsNA(v)?v:v*180.0/3.1415926535897932384626433832795L; }
/************************************************************************//**
* \brief Converting a value from Deg to Rad
* \param v Input value in [deg]
* \return Corresponding value in [rad]
*/
inline double DegToRad(double v) { return N2kIsNA(v)?v:v/180.0*3.1415926535897932384626433832795L; }
/************************************************************************//**
* \brief Converting a value from Celsius to Kelvin
* \param v Input value in [degC]
* \return Corresponding value in [K]
*/
inline double CToKelvin(double v) { return N2kIsNA(v)?v:v+273.15L; }
/************************************************************************//**
* \brief Converting a value from Kelvin to Celsius
* \param v Input value in [K]
* \return Corresponding value in [degC]
*/
inline double KelvinToC(double v) { return N2kIsNA(v)?v:v-273.15L; }
/************************************************************************//**
* \brief Converting a value from Fahrenheit to Kelvin
* \param v Input value in [degF]
* \return Corresponding value in [K]
*/
inline double FToKelvin(double v) { return N2kIsNA(v)?v:(v-32)*5.0/9.0+273.15; }
/************************************************************************//**
* \brief Converting a value from Kelvin to Fahrenheit
* \param v Input value in [F]
* \return Corresponding value in [degF]
*/
inline double KelvinToF(double v) { return N2kIsNA(v)?v:(v-273.15)*9.0/5.0+32; }
/************************************************************************//**
* \brief Converting a value from Millibar to Pascal
* \param v Input value in [mBar]
* \return Corresponding value in [Pa]
*/
inline double mBarToPascal(double v) { return N2kIsNA(v)?v:v*100L; }
/************************************************************************//**
* \brief Converting a value from Pascal to Millibar
* \param v Input value in [Pa]
* \return Corresponding value in [mBar]
*/
inline double PascalTomBar(double v) { return N2kIsNA(v)?v:v/100L; }
/************************************************************************//**
* \brief Converting a value from HectoPascal to Pascal
* \param v Input value in [hPa]
* \return Corresponding value in [Pa]
*/
inline double hPAToPascal(double v) { return N2kIsNA(v)?v:v*100L; }
/************************************************************************//**
* \brief Converting a value from Pascal to HectoPascal
* \param v Input value in [Pa]
* \return Corresponding value in [hPa]
*/
inline double PascalTohPA(double v) { return N2kIsNA(v)?v:v/100L; }
/************************************************************************//**
* \brief Converting a value from AmpereHours to Coulomb
* \param v Input value in [Ah]
* \return Corresponding value in [C]
*/
inline double AhToCoulomb(double v) { return N2kIsNA(v)?v:v*3600L; }
/************************************************************************//**
* \brief Converting a value from Coulomb to AmpereHours
* \param v Input value in [C]
* \return Corresponding value in [Ah]
*/
inline double CoulombToAh(double v) { return N2kIsNA(v)?v:v/3600L; }
/************************************************************************//**
* \brief Converting a value from Hours to Seconds
* \param v Input value in [h]
* \return Corresponding value in [s]
*/
inline double hToSeconds(double v) { return N2kIsNA(v)?v:v*3600L; }
/************************************************************************//**
* \brief Converting a value from Seconds to Hours
* \param v Input value in [s]
* \return Corresponding value in [h]
*/
inline double SecondsToh(double v) { return N2kIsNA(v)?v:v/3600L; }
/************************************************************************//**
* \brief Converting a value from MeterPerSecond to Knots
* \param v Input value in [mps]
* \return Corresponding value in [kn]
*/
inline double msToKnots(double v) { return N2kIsNA(v)?v:v*1.9438444924406047516198704103672L; } // 3600L/1852.0L
/************************************************************************//**
* \brief Converting a value from Knots to MeterPerSecond
* \param v Input value in [kn]
* \return Corresponding value in [mps]
*/
inline double KnotsToms(double v) { return N2kIsNA(v)?v:v*0.51444444444444444444444444444444L; } // 1852L/3600.0L
/************************************************************************//**
* \brief Setting up PGN126992 Message "System date/time"
* \ingroup group_msgSetUp
*
* The purpose of this PGN is to provide a regular transmission of UTC time
* and date; optionally synchronized to other parameter groups from the same
* source.
*
* The default Priority is set to 3.
*
* \param N2kMsg Reference to a N2kMsg Object
* \param SID Sequence ID. In most cases you can use just 0xff for SID. See \ref secRefTermSID. \n
* \n
* SID has been designed to make difference between sensor sampling or calculation.
* Same SID in different PGNs sent by same device defines that values on PGN:s has been sampled or
* calculated at same time.
* \param SystemDate Days since 1970-01-01 (UTC)
* \param SystemTime seconds since midnight (UTC)
* \param TimeSource Source of the Systemtime
*
*
* \sa SetN2kSystemTime, tN2kTimeSource
*/
void SetN2kPGN126992(tN2kMsg &N2kMsg, unsigned char SID, uint16_t SystemDate,
double SystemTime, tN2kTimeSource TimeSource=N2ktimes_GPS);
/************************************************************************//**
* \brief Setting up Message "System date/time" - PGN 126992
* \ingroup group_msgSetUp
*
* Alias of PGN 126992. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN126992
*
*/
inline void SetN2kSystemTime(tN2kMsg &N2kMsg, unsigned char SID, uint16_t SystemDate,
double SystemTime, tN2kTimeSource TimeSource=N2ktimes_GPS) {
SetN2kPGN126992(N2kMsg,SID,SystemDate,SystemTime,TimeSource);
}
/************************************************************************//**
* \brief Parsing the Content of a PGN126992 Message - "System date/time"
* \ingroup group_msgParsers
*
* The PGN126992 purpose is twofold: To provide a regular transmission of UTC
* time and date. To provide synchronism for measurement data.
*
* \param N2kMsg N2kMsg Object, Output: NMEA2000 message ready to be send.
* \param SID Sequence ID. Normally you can just forget its value. See \ref secRefTermSID.
* \param SystemDate Systemdate in days since 1970-01-01 (UTC)
* \param SystemTime System time seconds since midnight (UTC)
* \param TimeSource Source of the Systemtime
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*/
bool ParseN2kPGN126992(const tN2kMsg &N2kMsg, unsigned char &SID, uint16_t &SystemDate,
double &SystemTime, tN2kTimeSource &TimeSource);
/************************************************************************//**
* \brief Parsing the content of a "System date/time" message - PGN 126992
* \ingroup group_msgParsers
*
* Alias of PGN 126992. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN126992
*/
inline bool ParseN2kSystemTime(const tN2kMsg &N2kMsg, unsigned char &SID, uint16_t &SystemDate,
double &SystemTime, tN2kTimeSource &TimeSource) {
return ParseN2kPGN126992(N2kMsg,SID,SystemDate,SystemTime,TimeSource);
}
/************************************************************************//**
* \brief Setting up PGN129802 Message "AIS Safety Related Broadcast Message"
* \ingroup group_msgSetUp
*
* This parameter group provides data associated with the ITU-R M.1371
* Message 14 Safety Related Broadcast Message supporting broadcast
* communication of safety related data. An AIS device may generate this
* parameter group either upon receiving a VHF data link message 14,
* or upon receipt of an ISO or NMEA request PGN.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param MessageID Message type
* \param Repeat Repeat indicator
* \param SourceID MMSI
* \param AISTransceiverInformation Transceiver Information
* \param SafetyRelatedText Safety related Text of the Broadcast
* communication
*
* \sa tN2kAISTransceiverInformation
*/
void SetN2kPGN129802(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, uint32_t SourceID,
tN2kAISTransceiverInformation AISTransceiverInformation, char * SafetyRelatedText);
/************************************************************************//**
* \brief Setting up Message "AIS Safety Related Broadcast Message" -
* PGN 129802
* \ingroup group_msgSetUp
*
* Alias of PGN 129802. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN129802
*
*/
inline void SetN2kAISSafetyRelatedBroadcastMsg(tN2kMsg &N2kMsg, uint8_t MessageID, tN2kAISRepeat Repeat, uint32_t SourceID,
tN2kAISTransceiverInformation AISTransceiverInformation, char * SafetyRelatedText) {
SetN2kPGN129802(N2kMsg, MessageID, Repeat, SourceID, AISTransceiverInformation, SafetyRelatedText);
}
/************************************************************************//**
* \brief Parsing the Content of a PGN129802 Message - "AIS Safety Related
* Broadcast Message"
* \ingroup group_msgParsers
*
* This parameter group provides data associated with the ITU-R M.1371
* Message 14 Safety Related Broadcast Message supporting broadcast
* communication of safety related data. An AIS device may generate this
* parameter group either upon receiving a VHF data link message 14,
* or upon receipt of an ISO or NMEA request PGN.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param MessageID Message type
* \param Repeat Repeat indicator
* \param SourceID MMSI
* \param AISTransceiverInformation Transceiver Information
* \param SafetyRelatedText Safety related Text of the Broadcast
* communication
* \param SafetyRelatedTextMaxSize size of SafetyRelatedText
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*
* \sa tN2kAISTransceiverInformation
*/
bool ParseN2kPGN129802(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat &Repeat, uint32_t &SourceID,
tN2kAISTransceiverInformation &AISTransceiverInformation, char * SafetyRelatedText, size_t &SafetyRelatedTextMaxSize);
/************************************************************************//**
* \brief Parsing the content of a "AIS Safety Related Broadcast Message"
* message - PGN 129802
* \ingroup group_msgParsers
*
* Alias of PGN 129802. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN129802
*/
inline bool ParseN2kAISSafetyRelatedBroadcastMsg(const tN2kMsg &N2kMsg, uint8_t &MessageID, tN2kAISRepeat &Repeat, uint32_t &SourceID,
tN2kAISTransceiverInformation &AISTransceiverInformation, char * SafetyRelatedText, size_t &SafetyRelatedTextMaxSize) {
return ParseN2kPGN129802(N2kMsg, MessageID, Repeat, SourceID, AISTransceiverInformation, SafetyRelatedText, SafetyRelatedTextMaxSize);
}
/************************************************************************//**
* \brief Setting up PGN127233 Message "Man Overboard Notification"
* \ingroup group_msgSetUp
*
* The MOB PGN is intended to provide notification from a MOB monitoring
* system. The included position information may be that of the vessel or the
* MOB device itself as identified in field “X”, position source. Additional
* information may include the current state of the MOB device, time of
* activation, and MOB device battery status.
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param SID Sequence identifier. In most cases you can use just 0xff for SID. See \ref secRefTermSID. \n
* \n
* The sequence identifier field is used to tie different PGNs data together to same
* sampling or calculation time.
* \param MobEmitterId Identifier for each MOB emitter, unique to
* the vessel
* \param MOBStatus MOB Status
* \param ActivationTime Time of day (UTC) when MOB was activated
* \param PositionSource Position Source
* \param PositionDate Date of MOB position
* \param PositionTime Time of day of MOB position (UTC)
* \param Latitude Latitude in degrees
* \param Longitude Longitude in degrees
* \param COGReference True or Magnetic
* \param COG Course Over Ground in radians
* \param SOG Speed Over Ground in m/s
* \param MMSI MMSI
* \param MOBEmitterBatteryStatus Battery status
*
*/
void SetN2kPGN127233(tN2kMsg &N2kMsg,
unsigned char SID,
uint32_t MobEmitterId,
tN2kMOBStatus MOBStatus,
double ActivationTime,
tN2kMOBPositionSource PositionSource,
uint16_t PositionDate,
double PositionTime,
double Latitude,
double Longitude,
tN2kHeadingReference COGReference,
double COG,
double SOG,
uint32_t MMSI,
tN2kMOBEmitterBatteryStatus MOBEmitterBatteryStatus);
/************************************************************************//**
* \brief Setting up Message "Man Overboard Notification" - PGN 127233
* \ingroup group_msgSetUp
*
* Alias of PGN 127233. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127233
*
*/
inline void SetN2kMOBNotification(tN2kMsg &N2kMsg,
unsigned char SID,
uint32_t MobEmitterId,
tN2kMOBStatus MOBStatus,
double ActivationTime,
tN2kMOBPositionSource PositionSource,
uint16_t PositionDate,
double PositionTime,
double Latitude,
double Longitude,
tN2kHeadingReference COGReference,
double COG,
double SOG,
uint32_t MMSI,
tN2kMOBEmitterBatteryStatus MOBEmitterBatteryStatus) {
SetN2kPGN127233(N2kMsg,SID,MobEmitterId,MOBStatus,ActivationTime,PositionSource,PositionDate,PositionTime,Latitude,Longitude,COGReference,COG,SOG,MMSI,MOBEmitterBatteryStatus);
}
/************************************************************************//**
* \brief Parsing the Content of Message PGN127233 "Man Overboard Notification"
* \ingroup group_msgParsers
*
* The MOB PGN is intended to provide notification from a MOB monitoring
* system. The included position information may be that of the vessel or the
* MOB device itself as identified in field “X”, position source. Additional
* information may include the current state of the MOB device, time of
* activation, and MOB device battery status.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param SID Sequence ID. Normally you can just forget its value. See \ref secRefTermSID.
* \param MobEmitterId Identifier for each MOB emitter, unique to
* the vessel
* \param MOBStatus MOB Status
* \param ActivationTime Time of day (UTC) when MOB was activated
* \param PositionSource Position Source
* \param PositionDate Date of MOB position
* \param PositionTime Time of day of MOB position (UTC)
* \param Latitude Latitude in degrees
* \param Longitude Longitude in degrees
* \param COGReference True or Magnetic
* \param COG Course Over Ground in radians
* \param SOG Speed Over Ground in m/s
* \param MMSI MMSI
* \param MOBEmitterBatteryStatus Battery status
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*
*/
bool ParseN2kPGN127233(const tN2kMsg &N2kMsg,
unsigned char &SID,
uint32_t &MobEmitterId,
tN2kMOBStatus &MOBStatus,
double &ActivationTime,
tN2kMOBPositionSource &PositionSource,
uint16_t &PositionDate,
double &PositionTime,
double &Latitude,
double &Longitude,
tN2kHeadingReference &COGReference,
double &COG,
double &SOG,
uint32_t &MMSI,
tN2kMOBEmitterBatteryStatus &MOBEmitterBatteryStatus);
/************************************************************************//**
* \brief Parsing the content of a "Man Overboard Notification"
* message - PGN 127233
* \ingroup group_msgParsers
*
* Alias of PGN 127233. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127233
*/
inline bool ParseN2kMOBNotification(const tN2kMsg &N2kMsg,
unsigned char &SID,
uint32_t &MobEmitterId,
tN2kMOBStatus &MOBStatus,
double &ActivationTime,
tN2kMOBPositionSource &PositionSource,
uint16_t &PositionDate,
double &PositionTime,
double &Latitude,
double &Longitude,
tN2kHeadingReference &COGReference,
double &COG,
double &SOG,
uint32_t &MMSI,
tN2kMOBEmitterBatteryStatus &MOBEmitterBatteryStatus) {
return ParseN2kPGN127233(N2kMsg,SID,MobEmitterId,MOBStatus,ActivationTime,PositionSource,PositionDate,PositionTime,Latitude,Longitude,COGReference,COG,SOG,MMSI,MOBEmitterBatteryStatus);
}
/************************************************************************//**
* \brief Setting up PGN127237 Message "Heading/Track control"
* \ingroup group_msgSetUp
*
* Sends commands to, and receives data from, heading control systems. Allows
* for navigational (remote) control of a heading control system and direct
* rudder control.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param RudderLimitExceeded Yes/No
* \param OffHeadingLimitExceeded Yes/No
* \param OffTrackLimitExceeded Yes/No
* \param Override Yes/No
* \param SteeringMode Steering mode
* \param TurnMode Turn mode
* \param HeadingReference True or Magnetic
* \param CommandedRudderDirection Port or Starboard
* \param CommandedRudderAngle In radians
* \param HeadingToSteerCourse In radians
* \param Track In radians
* \param RudderLimit In radians
* \param OffHeadingLimit In radians
* \param RadiusOfTurnOrder In meter
* \param RateOfTurnOrder In radians/s
* \param OffTrackLimit In meters
* \param VesselHeading in radians
*
*/
void SetN2kPGN127237(tN2kMsg &N2kMsg,
tN2kOnOff RudderLimitExceeded,
tN2kOnOff OffHeadingLimitExceeded,
tN2kOnOff OffTrackLimitExceeded,
tN2kOnOff Override,
tN2kSteeringMode SteeringMode,
tN2kTurnMode TurnMode,
tN2kHeadingReference HeadingReference,
tN2kRudderDirectionOrder CommandedRudderDirection,
double CommandedRudderAngle,
double HeadingToSteerCourse,
double Track,
double RudderLimit,
double OffHeadingLimit,
double RadiusOfTurnOrder,
double RateOfTurnOrder,
double OffTrackLimit,
double VesselHeading);
/************************************************************************//**
* \brief Setting up Message "Heading/Track control" - PGN 127237
* \ingroup group_msgSetUp
*
* Alias of PGN 127237. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127237
*
*/
inline void SetN2kHeadingTrackControl(tN2kMsg &N2kMsg,
tN2kOnOff RudderLimitExceeded,
tN2kOnOff OffHeadingLimitExceeded,
tN2kOnOff OffTrackLimitExceeded,
tN2kOnOff Override,
tN2kSteeringMode SteeringMode,
tN2kTurnMode TurnMode,
tN2kHeadingReference HeadingReference,
tN2kRudderDirectionOrder CommandedRudderDirection,
double CommandedRudderAngle,
double HeadingToSteerCourse,
double Track,
double RudderLimit,
double OffHeadingLimit,
double RadiusOfTurnOrder,
double RateOfTurnOrder,
double OffTrackLimit,
double VesselHeading) {
SetN2kPGN127237(N2kMsg, RudderLimitExceeded,OffHeadingLimitExceeded,OffTrackLimitExceeded,Override,SteeringMode,TurnMode,
HeadingReference,CommandedRudderDirection,CommandedRudderAngle,HeadingToSteerCourse,Track,RudderLimit,OffHeadingLimit,
RadiusOfTurnOrder,RateOfTurnOrder,OffTrackLimit,VesselHeading);
}
/************************************************************************//**
* \brief Parsing the Content of Message PGN127237 "Heading/Track control"
* \ingroup group_msgParsers
*
* Sends commands to, and receives data from, heading control systems. Allows
* for navigational (remote) control of a heading control system and direct
* rudder control.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param RudderLimitExceeded Yes/No
* \param OffHeadingLimitExceeded Yes/No
* \param OffTrackLimitExceeded Yes/No
* \param Override Yes/No
* \param SteeringMode Steering mode
* \param TurnMode Turn mode
* \param HeadingReference True or Magnetic
* \param CommandedRudderDirection Port or Starboard
* \param CommandedRudderAngle In radians
* \param HeadingToSteerCourse In radians
* \param Track In radians
* \param RudderLimit In radians
* \param OffHeadingLimit In radians
* \param RadiusOfTurnOrder In meter
* \param RateOfTurnOrder In radians/s
* \param OffTrackLimit In meters
* \param VesselHeading in radians
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*/
bool ParseN2kPGN127237(const tN2kMsg &N2kMsg,
tN2kOnOff &RudderLimitExceeded,
tN2kOnOff &OffHeadingLimitExceeded,
tN2kOnOff &OffTrackLimitExceeded,
tN2kOnOff &Override,
tN2kSteeringMode &SteeringMode,
tN2kTurnMode &TurnMode,
tN2kHeadingReference &HeadingReference,
tN2kRudderDirectionOrder &CommandedRudderDirection,
double &CommandedRudderAngle,
double &HeadingToSteerCourse,
double &Track,
double &RudderLimit,
double &OffHeadingLimit,
double &RadiusOfTurnOrder,
double &RateOfTurnOrder,
double &OffTrackLimit,
double &VesselHeading);
/************************************************************************//**
* \brief Parsing the content of a "Heading/Track control"
* message - PGN 127237
* \ingroup group_msgParsers
*
* Alias of PGN 127237. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127237
*/
inline bool ParseN2kHeadingTrackControl(const tN2kMsg &N2kMsg,
tN2kOnOff &RudderLimitExceeded,
tN2kOnOff &OffHeadingLimitExceeded,
tN2kOnOff &OffTrackLimitExceeded,
tN2kOnOff &Override,
tN2kSteeringMode &SteeringMode,
tN2kTurnMode &TurnMode,
tN2kHeadingReference &HeadingReference,
tN2kRudderDirectionOrder &CommandedRudderDirection,
double &CommandedRudderAngle,
double &HeadingToSteerCourse,
double &Track,
double &RudderLimit,
double &OffHeadingLimit,
double &RadiusOfTurnOrder,
double &RateOfTurnOrder,
double &OffTrackLimit,
double &VesselHeading)
{
return ParseN2kPGN127237(N2kMsg,RudderLimitExceeded,OffHeadingLimitExceeded,OffTrackLimitExceeded,Override,SteeringMode,
TurnMode,HeadingReference,CommandedRudderDirection, CommandedRudderAngle,HeadingToSteerCourse,Track,RudderLimit,
OffHeadingLimit,RadiusOfTurnOrder,RateOfTurnOrder,OffTrackLimit,VesselHeading);
}
/************************************************************************//**
* \brief Setting up PGN127245 Message "Rudder"
* \ingroup group_msgSetUp
*
* Rudder order command in direction or angle with current rudder angle reading.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param RudderPosition Current rudder postion in radians.
* \param Instance Rudder instance.
* \param RudderDirectionOrder Direction, where rudder should be turned.
* \param AngleOrder In radians angle where rudder should be turned.
*
* \sa tN2kRudderDirectionOrder
*/
void SetN2kPGN127245(tN2kMsg &N2kMsg, double RudderPosition, unsigned char Instance=0,
tN2kRudderDirectionOrder RudderDirectionOrder=N2kRDO_NoDirectionOrder, double AngleOrder=N2kDoubleNA);
/************************************************************************//**
* \brief Setting up Message "Rudder" - PGN 127245
* \ingroup group_msgSetUp
*
* Alias of PGN 127245. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127245
*
*/
inline void SetN2kRudder(tN2kMsg &N2kMsg, double RudderPosition, unsigned char Instance=0,
tN2kRudderDirectionOrder RudderDirectionOrder=N2kRDO_NoDirectionOrder, double AngleOrder=N2kDoubleNA) {
SetN2kPGN127245(N2kMsg,RudderPosition,Instance,RudderDirectionOrder,AngleOrder);
}
/************************************************************************//**
* \brief Parsing the content of Message PGN127245 "Rudder"
* \ingroup group_msgParsers
*
* Rudder order command in direction or angle with current rudder angle reading.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param RudderPosition Current rudder postion in radians.
* \param Instance Rudder instance.
* \param RudderDirectionOrder Direction, where rudder should be turned.
* \param AngleOrder In radians angle where rudder should be turned.
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*
* \sa tN2kRudderDirectionOrder
*/
bool ParseN2kPGN127245(const tN2kMsg &N2kMsg, double &RudderPosition, unsigned char &Instance,
tN2kRudderDirectionOrder &RudderDirectionOrder, double &AngleOrder);
/************************************************************************//**
* \brief Parsing the content of a "Rudder"
* message - PGN 127245
* \ingroup group_msgParsers
*
* Alias of PGN 127245. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127245
*/
inline bool ParseN2kRudder(const tN2kMsg &N2kMsg, double &RudderPosition, unsigned char &Instance,
tN2kRudderDirectionOrder &RudderDirectionOrder, double &AngleOrder) {
return ParseN2kPGN127245(N2kMsg,RudderPosition,Instance,RudderDirectionOrder,AngleOrder);
}
/************************************************************************//**
* \brief Parsing the content of a "Rudder"
* message - PGN 127245
* \ingroup group_msgParsers
*
* Alias of PGN 127245. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127245
*/
inline bool ParseN2kRudder(const tN2kMsg &N2kMsg, double &RudderPosition) {
tN2kRudderDirectionOrder RudderDirectionOrder;
double AngleOrder;
unsigned char Instance;
return ParseN2kPGN127245(N2kMsg,RudderPosition,Instance,RudderDirectionOrder,AngleOrder);
}
/************************************************************************//**
* \brief Setting up PGN127250 Message "Vessel Heading"
* \ingroup group_msgSetUp
*
* Heading sensor value with a flag for True or Magnetic. If the sensor value
* is Magnetic, the deviation field can be used to produce a Magnetic heading,
* and the variation field can be used to correct the Magnetic heading to
* produce a True heading.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param SID Sequence identifier. In most cases you can use just 0xff for SID. See \ref secRefTermSID. \n
* \n
* The sequence identifier field is used to tie different PGNs data together to same
* sampling or calculation time.
* \param Heading Heading in radians
* \param Deviation Magnetic deviation in radians. Use N2kDoubleNA
* for undefined value.
* \param Variation Heading reference. See definition
* of \ref tN2kHeadingReference.
* \param ref Heading reference. See definition
* of \ref tN2kHeadingReference.
*/
void SetN2kPGN127250(tN2kMsg &N2kMsg, unsigned char SID, double Heading, double Deviation, double Variation, tN2kHeadingReference ref);
/************************************************************************//**
* \brief Setting up Message "Vessel Heading" - PGN 127250
* \ingroup group_msgSetUp
*
* Alias of PGN 127250. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127250
*/
inline void SetN2kTrueHeading(tN2kMsg &N2kMsg, unsigned char SID, double Heading) {
SetN2kPGN127250(N2kMsg,SID,Heading,N2kDoubleNA,N2kDoubleNA,N2khr_true);
}
/************************************************************************//**
* \brief Setting up Message "Vessel Heading" - PGN 127250
* \ingroup group_msgSetUp
*
* Alias of PGN 127250. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127250
*/
inline void SetN2kMagneticHeading(tN2kMsg &N2kMsg, unsigned char SID, double Heading, double Deviation=N2kDoubleNA, double Variation=N2kDoubleNA) {
SetN2kPGN127250(N2kMsg,SID,Heading,Deviation,Variation,N2khr_magnetic);
}
/************************************************************************//**
* \brief Parsing Content of Message PGN 127250 "Vessel Heading"
* \ingroup group_msgParsers
*
* Heading sensor value with a flag for True or Magnetic. If the sensor value
* is Magnetic, the deviation field can be used to produce a Magnetic heading,
* and the variation field can be used to correct the Magnetic heading to
* produce a True heading.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param SID Sequence ID. Normally you can just forget its value. See \ref secRefTermSID.
* \param Heading Heading in radians
* \param Deviation Magnetic deviation in radians. Use N2kDoubleNA
* for undefined value.
* \param Variation Heading reference. See definition
* of \ref tN2kHeadingReference.
* \param ref Heading reference. See definition
* of \ref tN2kHeadingReference.
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*
*/
bool ParseN2kPGN127250(const tN2kMsg &N2kMsg, unsigned char &SID, double &Heading, double &Deviation, double &Variation, tN2kHeadingReference &ref);
/************************************************************************//**
* \brief Parsing the content of a "Vessel Heading"
* message - PGN 127250
* \ingroup group_msgParsers
*
* Alias of PGN 127250. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127250
*/
inline bool ParseN2kHeading(const tN2kMsg &N2kMsg, unsigned char &SID, double &Heading, double &Deviation, double &Variation, tN2kHeadingReference &ref) {
return ParseN2kPGN127250(N2kMsg,SID,Heading,Deviation,Variation,ref);
}
/************************************************************************//**
* \brief Setting up PGN 127251 Message "Rate of Turn"
*\ingroup group_msgSetUp
*
* Rate of Turn is the rate of change of the Heading.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param SID Sequence identifier. In most cases you can use just 0xff for SID. See \ref secRefTermSID. \n
* \n
* The sequence identifier field is used to tie different PGNs data together to same
* sampling or calculation time.
* \param RateOfTurn Change in heading in radians per second
*
*/
void SetN2kPGN127251(tN2kMsg &N2kMsg, unsigned char SID, double RateOfTurn);
/************************************************************************//**
* \brief Setting up Message "Rate of Turn" - PGN 127251
* \ingroup group_msgSetUp
*
* Alias of PGN 127251. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127251
*/
inline void SetN2kRateOfTurn(tN2kMsg &N2kMsg, unsigned char SID, double RateOfTurn) {
SetN2kPGN127251(N2kMsg,SID,RateOfTurn);
}
/************************************************************************//**
* \brief Parsing the content of Message PGN127251 "Rate of Turn"
* \ingroup group_msgParsers
*
* Rate of Turn is the rate of change of the Heading.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param SID Sequence ID. Normally you can just forget its value. See \ref secRefTermSID.
* \param RateOfTurn Change in heading in radians per second
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*
*/
bool ParseN2kPGN127251(const tN2kMsg &N2kMsg, unsigned char &SID, double &RateOfTurn);
/************************************************************************//**
* \brief Parsing the content of a "Rate of Turn"
* message - PGN 127251
* \ingroup group_msgParsers
*
* Alias of PGN 127251. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127251
*/
inline bool ParseN2kRateOfTurn(const tN2kMsg &N2kMsg, unsigned char &SID, double &RateOfTurn) {
return ParseN2kPGN127251(N2kMsg,SID,RateOfTurn);
}
/************************************************************************//**
* \brief Setting up PGN 127252 Message "Heave"
* \ingroup group_msgSetUp
*
* Vertical displacement perpendicular to (smooth, wave-free water on)
* the earth’s surface.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param SID Sequence identifier. In most cases you can use just 0xff for SID. See \ref secRefTermSID. \n
* \n
* The sequence identifier field is used to tie different PGNs data together to same
* sampling or calculation time.
* \param Heave Vertical displacement perpendicular to the earth’s
* surface in meters
* \param Delay Delay added by calculations in seconds
* \param DelaySource Delay Source, see \ref tN2kDelaySource
*/
void SetN2kPGN127252(tN2kMsg &N2kMsg, unsigned char SID, double Heave,
double Delay=N2kDoubleNA, tN2kDelaySource DelaySource=N2kDD374_DataNotAvailable);
/************************************************************************//**
* \brief Setting up Message "Rate of Turn" - PGN 127252
* \ingroup group_msgSetUp
*
* Alias of PGN 127252. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127252
*/
inline void SetN2kHeave(tN2kMsg &N2kMsg, unsigned char SID, double Heave,
double Delay=N2kDoubleNA, tN2kDelaySource DelaySource=N2kDD374_DataNotAvailable) {
SetN2kPGN127252(N2kMsg, SID, Heave, Delay, DelaySource);
}
/************************************************************************//**
* \brief Parsing the content of Message PGN127252 "Heave"
* \ingroup group_msgParsers
*
* Vertical displacement perpendicular to (smooth, wave-free water on)
* the earth’s surface.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param SID Sequence ID. Normally you can just forget its value. See \ref secRefTermSID.
* \param Heave Vertical displacement perpendicular to the earth’s
* surface in meters
* \param Delay Delay added by calculations in seconds
* \param DelaySource Delay Source, see \ref tN2kDelaySource
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*
*/
bool ParseN2kPGN127252(const tN2kMsg &N2kMsg, unsigned char &SID, double &Heave, double &Delay, tN2kDelaySource &DelaySource);
/************************************************************************//**
* \brief Parsing the content of a "Heave"
* message - PGN 127252
* \ingroup group_msgParsers
*
* Alias of PGN 127252. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127252
*/
inline bool ParseN2kHeave(const tN2kMsg &N2kMsg, unsigned char &SID, double &Heave) {
double Delay;
tN2kDelaySource DelaySource;
return ParseN2kPGN127252(N2kMsg, SID, Heave, Delay, DelaySource);
}
/************************************************************************//**
* \brief Parsing the content of a "Heave"
* message - PGN 127252
* \ingroup group_msgParsers
*
* Alias of PGN 127252. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127252
*/
inline bool ParseN2kHeave(const tN2kMsg &N2kMsg, unsigned char &SID, double &Heave, double &Delay, tN2kDelaySource &DelaySource) {
return ParseN2kPGN127252(N2kMsg, SID, Heave, Delay, DelaySource);
}
/************************************************************************//**
* \brief Setting up PGN 127257 Message "Attitude"
* \ingroup group_msgSetUp
*
* This parameter group provides a single transmission that describes the
* position of a vessel relative to both horizontal and vertical
* planes. This would typically be used for vessel stabilization, vessel
* control and onboard platform stabilization.
*
* \param N2kMsg Reference to a N2kMsg Object,
* Output: NMEA2000 message ready to be send.
* \param SID Sequence identifier. In most cases you can use just 0xff for SID. See \ref secRefTermSID. \n
* \n
* The sequence identifier field is used to tie different PGNs data together to same
* sampling or calculation time.
* \param Yaw Heading in radians.
* \param Pitch Pitch in radians. Positive, when your bow rises.
* \param Roll Roll in radians. Positive, when tilted right.
*
*/
void SetN2kPGN127257(tN2kMsg &N2kMsg, unsigned char SID, double Yaw, double Pitch, double Roll);
/************************************************************************//**
* \brief Setting up Message "Attitude" - PGN 127257
* \ingroup group_msgSetUp
*
* Alias of PGN 127257. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref SetN2kPGN127257
*/
inline void SetN2kAttitude(tN2kMsg &N2kMsg, unsigned char SID, double Yaw, double Pitch, double Roll) {
SetN2kPGN127257(N2kMsg,SID, Yaw, Pitch, Roll);
}
/************************************************************************//**
* \brief Parsing the content of Message PGN 127257 "Attitude"
* \ingroup group_msgParsers
*
* This parameter group provides a single transmission that describes the
* position of a vessel relative to both horizontal and vertical
* planes. This would typically be used for vessel stabilization, vessel
* control and onboard platform stabilization.
*
* \param N2kMsg Reference to a N2kMsg Object,
* \param SID Sequence ID. Normally you can just forget its value. See \ref secRefTermSID.
* \param Yaw Heading in radians.
* \param Pitch Pitch in radians. Positive, when your bow rises.
* \param Roll Roll in radians. Positive, when tilted right.
*
* \return true Parsing of PGN Message successful
* \return false Parsing of PGN Message aborted
*
*/
bool ParseN2kPGN127257(const tN2kMsg &N2kMsg, unsigned char &SID, double &Yaw, double &Pitch, double &Roll);
/************************************************************************//**
* \brief Parsing the content of a "Attitude"
* message - PGN 127257
* \ingroup group_msgParsers
*
* Alias of PGN 127257. This alias was introduced to improve the readability
* of the source code. See parameter details on \ref ParseN2kPGN127257
*/
inline bool ParseN2kAttitude(const tN2kMsg &N2kMsg, unsigned char &SID, double &Yaw, double &Pitch, double &Roll) {
return ParseN2kPGN127257(N2kMsg,SID, Yaw, Pitch, Roll);
}
/************************************************************************//**
* \brief Setting up PGN 127258 Message "Magnetic Variation"
* \ingroup group_msgSetUp
*
* Message for transmitting variation. The message contains a sequence number
* to allow synchronization of other messages such as Heading or Course over
* Ground. The quality of service and age of service are provided to enable