nmealib 0.0.4
NMEA 0183/NMEA 2000 parsing library
Loading...
Searching...
No Matches
PGN130306.h
Go to the documentation of this file.
1#pragma once
2
3#include "nmealib/nmea2000.h"
5
6namespace nmealib {
7namespace nmea2000 {
8
26class PGN130306 : public Message2000 {
27public:
28 // Public constructor from parameters
29 PGN130306(uint8_t sequenceId,
30 Speed windSpeed,
31 Angle windDirection,
32 HalfByte windReference,
33 HalfByte reserved1 = HalfByte::fromValue(0U),
34 Byte reserved2 = Byte::fromValue(0U),
35 Byte reserved3 = Byte::fromValue(0U)
36 ) noexcept;
37
38 // Accessory constructors
39 PGN130306(const PGN130306&) = default;
40 PGN130306& operator=(const PGN130306&) = default;
41 PGN130306(PGN130306&&) noexcept = default;
42 PGN130306& operator=(PGN130306&&) noexcept = default;
43
44 // Destructor
45 ~PGN130306() override = default;
46
47 // Polymorphic copy
48 std::unique_ptr<nmealib::Message> clone() const override;
49
50 // Getters for PGN 130306 specific fields
52 uint8_t getSequenceId() const noexcept;
54 Speed getWindSpeed() const noexcept;
56 Angle getWindDirection() const noexcept;
58 HalfByte getWindReference() const noexcept;
59 HalfByte getReserved1() const noexcept;
60 Byte getReserved2() const noexcept;
61 Byte getReserved3() const noexcept;
62
63 // Custom getters for convenience
64 float getWindDirectionDegrees() const noexcept;
65 float getWindSpeedKnots() const noexcept;
66
67 // Overridden methods
68 std::string getStringContent(bool verbose) const noexcept override;
69 using Message2000::operator==;
70 bool operator==(const PGN130306& other) const noexcept;
71
72private:
73 uint8_t sequenceId_{0};
74 Speed windSpeed_;
75 Angle windDirection_;
76 HalfByte windReference_;
77 HalfByte reserved1_ = HalfByte::fromValue(0U);
78 Byte reserved2_ = Byte::fromValue(0U);
79 Byte reserved3_ = Byte::fromValue(0U);
80
81 PGN130306() = delete;
82
83 // Private constructor used by the factory method
84 PGN130306(Message2000 baseMessage,
85 uint8_t sequenceId,
86 Speed windSpeed,
87 Angle windDirection,
88 HalfByte windReference,
89 HalfByte reserved1,
90 Byte reserved2,
91 Byte reserved3) noexcept;
92
93 // Private internal factory
94 static std::unique_ptr<PGN130306> create(std::unique_ptr<Message2000> baseMessage);
95 static std::string rawPayload(uint8_t sequenceId,
96 Speed windSpeed,
97 Angle windDirection,
98 HalfByte windReference,
99 HalfByte reserved1,
100 Byte reserved2,
101 Byte reserved3);
102
103 friend class Nmea2000Factory;
104 friend class MessageRegistry;
105};
106
107} // namespace nmea2000
108} // 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 - Wind Data.
Definition PGN130306.h:26
Speed getWindSpeed() const noexcept
HalfByte getReserved1() const noexcept
float getWindDirectionDegrees() const noexcept
Byte getReserved2() const noexcept
PGN130306(PGN130306 &&) noexcept=default
PGN130306 & operator=(const PGN130306 &)=default
Angle getWindDirection() const noexcept
HalfByte getWindReference() const noexcept
Byte getReserved3() const noexcept
std::unique_ptr< nmealib::Message > clone() const override
Creates a polymorphic deep copy of this Message2000.
Definition PGN130306.cpp:71
float getWindSpeedKnots() const noexcept
PGN130306(const PGN130306 &)=default
uint8_t getSequenceId() const noexcept
std::string getStringContent(bool verbose) const noexcept override
Returns a human-readable string representation of the message.
Definition PGN130306.cpp:75