nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
PGN127245.h
Go to the documentation of this file.
1#pragma once
2
3#include "nmealib/nmea2000.h"
5
6namespace nmealib {
7namespace nmea2000 {
8
28class PGN127245 : public Message2000 {
29public:
30 // Public constructor from parameters.
31 PGN127245(uint8_t rudderId,
32 HalfByte direction,
33 SignedAngle angleOrder,
34 SignedAngle position,
35 Byte reserved = Byte::fromValue(0U),
36 Byte reserved2 = Byte::fromRaw(255U),
37 Byte reserved3 = Byte::fromRaw(255U)) noexcept;
38
39 // Accessory constructors
40 PGN127245(const PGN127245&) = default;
41 PGN127245& operator=(const PGN127245&) = default;
42 PGN127245(PGN127245&&) noexcept = default;
43 PGN127245& operator=(PGN127245&&) noexcept = default;
44
45 // Destructor
46 ~PGN127245() override = default;
47
48 // Polymorphic copy
49 std::unique_ptr<nmealib::Message> clone() const override;
50
51 // Getters for PGN 127245 specific fields
53 uint8_t getRudderId() const noexcept;
55 HalfByte getDirection() const noexcept;
57 SignedAngle getAngleOrder() const noexcept;
59 SignedAngle getPosition() const noexcept;
60
61 float getAngleOrderDegrees() const noexcept;
62 float getPositionDegrees() const noexcept;
63 std::string getDirectionString() const noexcept;
64
65 // Overridden methods
66 std::string getStringContent(bool verbose) const noexcept override;
67 using Message2000::operator==;
68 bool operator==(const PGN127245& other) const noexcept;
69
70private:
71 uint8_t rudderId_{0};
72 HalfByte direction_;
73 Byte reserved_; // Only 5 bits considered
74 SignedAngle angleOrder_;
75 SignedAngle position_;
76 Byte reserved2;
77 Byte reserved3;
78
79 PGN127245() = delete;
80
81 // Private constructor used by the factory method
82 PGN127245(Message2000 baseMessage,
83 uint8_t rudderId,
84 HalfByte direction,
85 Byte reserved,
86 SignedAngle angleOrder,
87 SignedAngle position,
88 Byte reserved2,
89 Byte reserved3) noexcept;
90
91 // Private internal factory
92 static std::unique_ptr<PGN127245> create(std::unique_ptr<Message2000> baseMessage);
93 static std::string rawPayload(uint8_t rudderId,
94 HalfByte direction,
95 Byte reserved,
96 SignedAngle angleOrder,
97 SignedAngle position,
98 Byte reserved2,
99 Byte reserved3);
100
101 friend class Nmea2000Factory;
102 friend class MessageRegistry;
103};
104
105} // namespace nmea2000
106} // namespace nmealib
Defines a base class for NMEA messages, encapsulating common properties and behaviors.
Definition message.h:14
static constexpr DataType fromRaw(RawType raw) noexcept
Constructs from a raw value.
Definition dataTypes.h:97
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 127245 - Rudder.
Definition PGN127245.h:28
SignedAngle getPosition() const noexcept
PGN127245(const PGN127245 &)=default
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message.
Definition PGN127245.cpp:77
float getAngleOrderDegrees() const noexcept
float getPositionDegrees() const noexcept
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message2000.
Definition PGN127245.cpp:73
PGN127245 & operator=(const PGN127245 &)=default
std::string getDirectionString() const noexcept
HalfByte getDirection() const noexcept
uint8_t getRudderId() const noexcept
SignedAngle getAngleOrder() const noexcept
PGN127245(PGN127245 &&) noexcept=default