nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
PGN127257.h
Go to the documentation of this file.
1#pragma once
2
3#include "nmealib/nmea2000.h"
5
6namespace nmealib {
7namespace nmea2000 {
8
26class PGN127257 : public Message2000 {
27public:
28 // Public constructor from parameters.
29 PGN127257(uint8_t sequenceId,
30 SignedAngle yaw,
31 SignedAngle pitch,
32 SignedAngle roll,
33 Byte reserved = Byte::fromValue(0U)) noexcept;
34
35 // Accessory constructors
36 PGN127257(const PGN127257&) = default;
37 PGN127257& operator=(const PGN127257&) = default;
38 PGN127257(PGN127257&&) noexcept = default;
39 PGN127257& operator=(PGN127257&&) noexcept = default;
40
41 // Destructor
42 ~PGN127257() override = default;
43
44 // Polymorphic copy
45 std::unique_ptr<nmealib::Message> clone() const override;
46
47 // Getters for PGN 127257 specific fields
49 uint8_t getSequenceId() const noexcept;
51 SignedAngle getYaw() const noexcept;
53 SignedAngle getPitch() const noexcept;
55 SignedAngle getRoll() const noexcept;
57 Byte getReserved() const noexcept;
58
59 float getYawDegrees() const noexcept;
60 float getPitchDegrees() const noexcept;
61 float getRollDegrees() const noexcept;
62
63 // Overridden methods
64 std::string getStringContent(bool verbose) const noexcept override;
65 using Message2000::operator==;
66 bool operator==(const PGN127257& other) const noexcept;
67
68private:
69 uint8_t sequenceId_{0};
70 SignedAngle yaw_;
71 SignedAngle pitch_;
72 SignedAngle roll_;
73 Byte reserved_;
74
75 PGN127257() = delete;
76
77 // Private constructor used by the factory method
78 PGN127257(Message2000 baseMessage,
79 uint8_t sequenceId,
80 SignedAngle yaw,
81 SignedAngle pitch,
82 SignedAngle roll,
83 Byte reserved) noexcept;
84
85 // Private internal factory
86 static std::unique_ptr<PGN127257> create(std::unique_ptr<Message2000> baseMessage);
87 static std::string rawPayload(uint8_t sequenceId,
88 SignedAngle yaw,
89 SignedAngle pitch,
90 SignedAngle roll,
91 Byte reserved);
92
93 friend class Nmea2000Factory;
94 friend class MessageRegistry;
95};
96
97} // namespace nmea2000
98} // 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 127257 - Attitude.
Definition PGN127257.h:26
Byte getReserved() const noexcept
float getPitchDegrees() const noexcept
PGN127257(const PGN127257 &)=default
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message2000.
Definition PGN127257.cpp:60
PGN127257 & operator=(const PGN127257 &)=default
float getRollDegrees() const noexcept
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message.
Definition PGN127257.cpp:64
SignedAngle getRoll() const noexcept
PGN127257(PGN127257 &&) noexcept=default
float getYawDegrees() const noexcept
SignedAngle getPitch() const noexcept
uint8_t getSequenceId() const noexcept
SignedAngle getYaw() const noexcept