nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
PGN127250.h
Go to the documentation of this file.
1#pragma once
2
3#include "nmealib/nmea2000.h"
5
6namespace nmealib {
7namespace nmea2000 {
8
28class PGN127250 : public Message2000 {
29public:
30 // Public constructor from parameters, of the reserved field, only the 6 LSBits are considered
31 PGN127250(uint8_t sequenceId,
32 Angle heading,
33 SignedAngle deviation,
34 SignedAngle variation,
35 HalfByte headingReference,
36 Byte reserved = Byte::fromValue(0U)) noexcept;
37
38 // Accessory constructors
39 PGN127250(const PGN127250&) = default;
40 PGN127250& operator=(const PGN127250&) = default;
41 PGN127250(PGN127250&&) noexcept = default;
42 PGN127250& operator=(PGN127250&&) noexcept = default;
43
44 // Destructor
45 ~PGN127250() override = default;
46
47 // Polymorphic copy
48 std::unique_ptr<nmealib::Message> clone() const override;
49
50 // Getters for PGN 127250 specific fields
52 uint8_t getSequenceId() const noexcept;
54 Angle getHeading() const noexcept;
56 SignedAngle getDeviation() const noexcept;
58 SignedAngle getVariation() const noexcept;
60 HalfByte getHeadingReference() const noexcept;
61
62 float getHeadingDegrees() const noexcept;
63 float getDeviationDegrees() const noexcept;
64 float getVariationDegrees() const noexcept;
65
66 // Overridden methods
67 std::string getStringContent(bool verbose) const noexcept override;
68 using Message2000::operator==;
69 bool operator==(const PGN127250& other) const noexcept;
70
71private:
72 uint8_t sequenceId_{0};
73 Angle heading_;
74 SignedAngle deviation_;
75 SignedAngle variation_;
76 HalfByte headingReference_;
77 Byte reserved_;
78
79 PGN127250() = delete;
80
81 // Private constructor used by the factory method
82 PGN127250(Message2000 baseMessage,
83 uint8_t sequenceId,
84 Angle heading,
85 SignedAngle deviation,
86 SignedAngle variation,
87 HalfByte headingReference,
88 Byte reserved) noexcept;
89
90 // Private internal factory
91 static std::unique_ptr<PGN127250> create(std::unique_ptr<Message2000> baseMessage);
92 static std::string rawPayload(uint8_t sequenceId,
93 Angle heading,
94 SignedAngle deviation,
95 SignedAngle variation,
96 HalfByte headingReference,
97 Byte reserved);
98
99 friend class Nmea2000Factory;
100 friend class MessageRegistry;
101};
102
103} // namespace nmea2000
104} // 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 127250 - Heading.
Definition PGN127250.h:28
HalfByte getHeadingReference() const noexcept
SignedAngle getVariation() const noexcept
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message2000.
Definition PGN127250.cpp:65
float getVariationDegrees() const noexcept
float getHeadingDegrees() const noexcept
Angle getHeading() const noexcept
uint8_t getSequenceId() const noexcept
PGN127250(PGN127250 &&) noexcept=default
PGN127250(const PGN127250 &)=default
PGN127250 & operator=(const PGN127250 &)=default
float getDeviationDegrees() const noexcept
SignedAngle getDeviation() const noexcept
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message.
Definition PGN127250.cpp:69