nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
PGN128259.h
Go to the documentation of this file.
1#pragma once
2
3#include "nmealib/nmea2000.h"
5
6namespace nmealib {
7namespace nmea2000 {
8
32class PGN128259 : public Message2000 {
33public:
34 // Public constructor from parameters
35 PGN128259(uint8_t sequenceId,
36 Speed speedWaterReferenced,
37 Speed speedGroundReferenced,
38 Byte speedWaterReferencedType,
39 HalfByte speedDirection,
40 Byte reserved1 = Byte::fromValue(0U),
41 HalfByte reserved2 = HalfByte::fromValue(0U));
42
43 // Accessory constructors
44 PGN128259(const PGN128259&) = default;
45 PGN128259& operator=(const PGN128259&) = default;
46 PGN128259(PGN128259&&) noexcept = default;
47 PGN128259& operator=(PGN128259&&) noexcept = default;
48
49 // Destructor
50 ~PGN128259() override = default;
51
52 // Polymorphic copy
53 std::unique_ptr<nmealib::Message> clone() const override;
54
55 // Getters for PGN 128259 specific fields
57 uint8_t getSequenceId() const noexcept;
59 Speed getSpeedWaterReferenced() const noexcept;
61 Speed getSpeedGroundReferenced() const noexcept;
63 Byte getSpeedWaterReferencedType() const noexcept;
65 HalfByte getSpeedDirection() const noexcept;
66 Byte getReserved1() const noexcept;
67 HalfByte getReserved2() const noexcept;
68
69 // Overridden methods
70 std::string getStringContent(bool verbose) const noexcept override;
71 using Message2000::operator==;
72 bool operator==(const PGN128259& other) const noexcept;
73
74private:
75 uint8_t sequenceId_{0};
76 Speed speedWaterReferenced_;
77 Speed speedGroundReferenced_;
78 Byte speedWaterReferencedType_;
79 HalfByte speedDirection_;
80 Byte reserved1_;
81 HalfByte reserved2_;
82
83 PGN128259() = delete;
84
85 // Private constructor used by the factory method
86 PGN128259(Message2000 baseMessage,
87 uint8_t sequenceId,
88 Speed speedWaterReferenced,
89 Speed speedGroundReferenced,
90 Byte speedWaterReferencedType,
91 HalfByte speedDirection,
92 Byte reserved1,
93 HalfByte reserved2) noexcept;
94
95 // Private internal factory
96 static std::unique_ptr<PGN128259> create(std::unique_ptr<Message2000> baseMessage);
97 static std::string rawPayload(uint8_t sequenceId,
98 Speed speedWaterReferenced,
99 Speed speedGroundReferenced,
100 Byte speedWaterReferencedType,
101 HalfByte speedDirection,
102 Byte reserved1,
103 HalfByte reserved2);
104
105 friend class Nmea2000Factory;
106 friend class MessageRegistry;
107};
108
109} // namespace nmea2000
110} // 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 128259 - Speed, Water Referenced.
Definition PGN128259.h:32
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message.
Definition PGN128259.cpp:76
Speed getSpeedGroundReferenced() const noexcept
HalfByte getReserved2() const noexcept
uint8_t getSequenceId() const noexcept
Speed getSpeedWaterReferenced() const noexcept
PGN128259 & operator=(const PGN128259 &)=default
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message2000.
Definition PGN128259.cpp:72
Byte getSpeedWaterReferencedType() const noexcept
PGN128259(const PGN128259 &)=default
Byte getReserved1() const noexcept
HalfByte getSpeedDirection() const noexcept
PGN128259(PGN128259 &&) noexcept=default