Class RatatoskPosInfoSubscriber¶
Defined in File RatatoskPosInfo.hpp
Class Documentation¶
-
class RatatoskPosInfoSubscriber : public QObject¶
Subscriber for DDS type ratatosk::types::PosInfo as a QML element.
This class is a QML element and enables QML applications to gain access to a DDS signal type as a read-only QML property.
Public Functions
-
explicit RatatoskPosInfoSubscriber(QObject *parent = nullptr)¶
Constructor.
The initialization is deferred to an init() function.
- Parameters
parent – [in] QObject pointer.
-
virtual ~RatatoskPosInfoSubscriber()¶
Destructor.
-
double lat() const
Property accessor for lat in QML.
- Returns
Latitude
-
double lon() const
Property accessor for lon in QML.
- Returns
Longitude
-
double sog() const
Property accessor for sog in QML.
- Returns
Speed over ground [m/s]
-
double cog() const
Property accessor for cog in QML.
- Returns
Course over ground [rad]
-
QDateTime timestamp() const
Property accessor for timestamp in QML.
- Returns
Timestamp as QML compatible type.
-
void init(QtToDds *dds, const QString &topic, bool with_listener = true)¶
Initializes DDS reader and connects Qt signals and slots.
- Parameters
dds – [in] Pointer to QtToDds instance.
topic – [in] Name of DDS topic for which to subscribe.
with_listener – [in] Use DdsReaderListener callback to trigger eventHeard() signal.
Public Slots
-
void updateValue()¶
Takes all new samples from the subscribed topic and uses the last sample.
This slot calls take() from the DDS reader and stores the last new sample as the current value. If there were a new sample it emits <…>Changed().
Signals
-
void latChanged(double lat)¶
DDS value has changed.
This signal is connected to the QML RatatoskPosInfoSubscriber::lat property.
- Parameters
lat – [out] New value.
-
void lonChanged(double lon)¶
DDS value has changed.
This signal is connected to the QML RatatoskPosInfoSubscriber::lon property.
- Parameters
lon – [out] New value.
-
void sogChanged(double sog)¶
DDS value has changed.
This signal is connected to the QML RatatoskPosInfoSubscriber::sog property.
- Parameters
sog – [out] New value.
-
void cogChanged(double cog)¶
DDS value has changed.
This signal is connected to the QML RatatoskPosInfoSubscriber::cog property.
- Parameters
cog – [out] New value.
-
void timestampChanged(QDateTime timestamp)¶
Timestamp of DDS value has changed.
This signal is connected to the QML RatatoskPosInfoSubscriber::timestamp property.
- Parameters
timestamp – [out] New timestamp value.
-
void eventHeard()¶
DdsReaderListener calls this signal when there is data available on the subscribed topic.
If RatatoskPosInfoSubscriber is initialized with_listener=true, eventHeard() will be connected to the slot updateValue().
-
explicit RatatoskPosInfoSubscriber(QObject *parent = nullptr)¶