nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
PGN129026.h
Go to the documentation of this file.
1#pragma once
2
3#include "nmealib/nmea2000.h"
5
6namespace nmealib {
7namespace nmea2000 {
8
28class PGN129026 : public Message2000 {
29public:
30 // Public constructor from parameters
31 PGN129026(uint8_t sequenceId,
32 HalfByte cogReference,
33 Angle cog,
34 Speed sog,
35 Byte reserved = Byte::fromValue(0U),
36 Byte reserved2 = Byte::fromValue(0U),
37 Byte reserved3 = Byte::fromValue(0U)
38 ) noexcept;
39
40 // Accessory constructors
41 PGN129026(const PGN129026&) = default;
42 PGN129026& operator=(const PGN129026&) = default;
43 PGN129026(PGN129026&&) noexcept = default;
44 PGN129026& operator=(PGN129026&&) noexcept = default;
45
46 // Destructor
47 ~PGN129026() override = default;
48
49 // Polymorphic copy
50 std::unique_ptr<nmealib::Message> clone() const override;
51
52 // Getters for PGN 129026 specific fields
54 uint8_t getSequenceId() const noexcept;
56 HalfByte getCogReference() const noexcept;
58 Angle getCog() const noexcept;
60 Speed getSog() const noexcept;
62 Byte getReserved1() const noexcept;
64 Byte getReserved2() const noexcept;
66 Byte getReserved3() const noexcept;
67
68 // Custom getters for convenience
70 float getCogDegrees() const noexcept;
72 float getSogKnots() const noexcept;
73
74 // Overridden methods
75 std::string getStringContent(bool verbose) const noexcept override;
76 using Message2000::operator==;
77 bool operator==(const PGN129026& other) const noexcept;
78
79private:
80 uint8_t sequenceId_{0};
81 HalfByte cogReference_;
82 Angle cog_;
83 Speed sog_;
84 Byte reserved_ = Byte::fromValue(0U);
85 Byte reserved2_ = Byte::fromValue(0U);
86 Byte reserved3_ = Byte::fromValue(0U);
87
88 PGN129026() = delete;
89
90 // Private constructor used by the factory method
91 PGN129026(Message2000 baseMessage,
92 uint8_t sequenceId,
93 HalfByte cogReference,
94 Byte reserved,
95 Angle cog,
96 Speed sog,
97 Byte reserved2,
98 Byte reserved3) noexcept;
99
100 // Private internal factory
101 static std::unique_ptr<PGN129026> create(std::unique_ptr<Message2000> baseMessage);
102 static std::string rawPayload(uint8_t sequenceId,
103 HalfByte cogReference,
104 Byte reserved,
105 Angle cog,
106 Speed sog,
107 Byte reserved2,
108 Byte reserved3);
109
110 friend class Nmea2000Factory;
111 friend class MessageRegistry;
112};
113
114} // namespace nmea2000
115} // namespace nmealib
Defines a base class for NMEA messages, encapsulating common properties and behaviors.
Definition message.h:14
static DataType fromValue(TargetType value)
Constructs from a physical value.
Definition dataTypes.h:77
Represents a generic NMEA 2000 message encapsulating a CAN frame.
Definition nmea2000.h:62
Strongly-typed class representing PGN 129026 - COG, SOG, Rapid Update.
Definition PGN129026.h:28
Byte getReserved3() const noexcept
Speed getSog() const noexcept
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message.
Definition PGN129026.cpp:77
HalfByte getCogReference() const noexcept
float getCogDegrees() const noexcept
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message2000.
Definition PGN129026.cpp:73
Byte getReserved2() const noexcept
PGN129026(const PGN129026 &)=default
Angle getCog() const noexcept
PGN129026 & operator=(const PGN129026 &)=default
PGN129026(PGN129026 &&) noexcept=default
Byte getReserved1() const noexcept
float getSogKnots() const noexcept
uint8_t getSequenceId() const noexcept