23#include "utility/event/hand_haptic_event.hpp"
27#include "utility/math/common.hpp"
29namespace utility::event
32 HandHapticEvent::Factory::~Factory(
void) =
default;
36 return std::make_unique<HandHapticEvent>();
39 std::shared_ptr<HandHapticEvent>
42 return std::make_unique<HandHapticEvent>();
52 _amplitude = utility::math::clamp(amplitude, 0.0F, 1.0F);
64 _frequencyHz = std::max(0.0F, frequency);
76 _durationNs = std::max<std::int64_t>(0, duration);
std::shared_ptr< HandHapticEvent > createTyped(void) const
Create a strongly-typed HandHapticEvent.
std::shared_ptr< Event > create(void) const override
Create a HandHapticEvent as base Event pointer.
Shared behavior for hand haptic output events.
HandHapticEvent & setDurationNs(const std::int64_t durationNs) noexcept
Backward-compatible alias for setDuration.
HandHapticEvent & setDuration(const std::int64_t duration) noexcept
Set the number of nanoseconds the vibration should last.
float getFrequencyHz(void) const noexcept
Backward-compatible alias for getFrequency.
float getAmplitude(void) const noexcept
Get haptic amplitude.
float getFrequency(void) const noexcept
Get the frequency of the vibration in Hz.
std::int64_t getDurationNs(void) const noexcept
Backward-compatible alias for getDuration.
HandHapticEvent & setFrequencyHz(const float frequencyHz) noexcept
Backward-compatible alias for setFrequency.
HandHapticEvent(void)
Default constructor.
std::int64_t getDuration(void) const noexcept
Get the number of nanoseconds the vibration should last.
~HandHapticEvent(void) override
Default destructor.
HandHapticEvent & setAmplitude(const float amplitude) noexcept
Set haptic amplitude.
HandHapticEvent & setFrequency(const float frequency) noexcept
Set the frequency of the vibration in Hz.