nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
PGN127251.h
Go to the documentation of this file.
1#pragma once
2
3#include "nmealib/nmea2000.h"
5
6namespace nmealib {
7namespace nmea2000 {
8
22class PGN127251 : public Message2000 {
23public:
24 // Public constructor from parameters, of the reserved field, only the 6 LSBits are considered
25 PGN127251(uint8_t sequenceId,
26 AngularRate rate,
27 Byte reserved1 = Byte::fromValue(0U),
28 Byte reserved2 = Byte::fromValue(0U),
29 Byte reserved3 = Byte::fromValue(0U)) noexcept;
30
31 // Accessory constructors
32 PGN127251(const PGN127251&) = default;
33 PGN127251& operator=(const PGN127251&) = default;
34 PGN127251(PGN127251&&) noexcept = default;
35 PGN127251& operator=(PGN127251&&) noexcept = default;
36
37 // Destructor
38 ~PGN127251() override = default;
39
40 // Polymorphic copy
41 std::unique_ptr<nmealib::Message> clone() const override;
42
43 // Getters for PGN 127251 specific fields
45 uint8_t getSequenceId() const noexcept;
47 AngularRate getRate() const noexcept;
49 Byte getReserved1() const noexcept;
51 Byte getReserved2() const noexcept;
53 Byte getReserved3() const noexcept;
54
55 // Overridden methods
56 std::string getStringContent(bool verbose) const noexcept override;
57 using Message2000::operator==;
58 bool operator==(const PGN127251& other) const noexcept;
59
60private:
61 uint8_t sequenceId_{0};
62 AngularRate rate_;
63 Byte reserved1_;
64 Byte reserved2_;
65 Byte reserved3_;
66
67 PGN127251() = delete;
68
69 // Private constructor used by the factory method
70 PGN127251(Message2000 baseMessage,
71 uint8_t sequenceId,
72 AngularRate rate,
73 Byte reserved1,
74 Byte reserved2,
75 Byte reserved3) noexcept;
76
77 // Private internal factory
78 static std::unique_ptr<PGN127251> create(std::unique_ptr<Message2000> baseMessage);
79 static std::string rawPayload(uint8_t sequenceId,
80 AngularRate rate,
81 Byte reserved1,
82 Byte reserved2,
83 Byte reserved3) noexcept;
84
85 friend class Nmea2000Factory;
86 friend class MessageRegistry;
87};
88
89} // namespace nmea2000
90} // 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 127251 - Rate of Turn.
Definition PGN127251.h:22
Byte getReserved1() const noexcept
Byte getReserved2() const noexcept
PGN127251 & operator=(const PGN127251 &)=default
AngularRate getRate() const noexcept
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message2000.
Definition PGN127251.cpp:61
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message.
Definition PGN127251.cpp:65
PGN127251(PGN127251 &&) noexcept=default
uint8_t getSequenceId() const noexcept
PGN127251(const PGN127251 &)=default
Byte getReserved3() const noexcept