Auterion App SDK
Auterion SDK is a library that can be used by AuterionOS apps to communicate with the system.
|
A template class for managing subscriptions to data coming from the vehicle. More...
#include <auterion_sdk/system_state/system_state.hpp>
Public Member Functions | |
Subscription (const std::shared_ptr< SubscriptionImpl< S, DataType >> &impl) | |
void | onUpdate (std::function< void(DataType)> callback) |
Regsiters a callback function to be called when the data is updated. More... | |
void | subscribe (std::function< void(DataType)> callback) |
Activates the subscription process and registers a callback function if provided. More... | |
DataType | last () const |
Retrieves the last received data. More... | |
bool | isLastValid () const |
Checks if the last received data is valid. More... | |
A template class for managing subscriptions to data coming from the vehicle.
S | The type of subscription as the enum value of SubscriptionType. |
DataType | The type of data being subscribed to. |
bool auterion::Subscription< S, DataType >::isLastValid | ( | ) | const |
Checks if the last received data is valid.
DataType auterion::Subscription< S, DataType >::last | ( | ) | const |
Retrieves the last received data.
void auterion::Subscription< S, DataType >::onUpdate | ( | std::function< void(DataType)> | callback | ) |
Regsiters a callback function to be called when the data is updated.
This method does not start the subscription process itself.
callback | Callback function to handle data updates. |
auterion::InvalidArgumentException | if the callback function is nullptr. |
void auterion::Subscription< S, DataType >::subscribe | ( | std::function< void(DataType)> | callback | ) |
Activates the subscription process and registers a callback function if provided.
If a callback function is provided, it registers it for data updates. If the callback is nullptr, only activates the subscription process.
callback | Callback function to handle data updates. |