utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
hand_haptic_event.hpp
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <cstdint>
26#include <memory>
27
28#include "utility/event/hand_event.hpp"
29
30namespace utility::event
31{
32
37 {
38 private:
40 float _amplitude { 1.0F };
41
43 float _frequencyHz { 0.0F };
44
46 std::int64_t _durationNs { 0 };
47
48 public:
53 {
54 public:
55 ~Factory(void) override;
56
61 std::shared_ptr<Event> create(void) const override;
62
67 std::shared_ptr<HandHapticEvent> createTyped(void) const;
68 };
69
73 explicit HandHapticEvent(void);
74
78 ~HandHapticEvent(void) override;
79
85 HandHapticEvent &setAmplitude(const float amplitude) noexcept;
86
91 float getAmplitude(void) const noexcept;
92
98 HandHapticEvent &setFrequency(const float frequency) noexcept;
99
104 float getFrequency(void) const noexcept;
105
111 HandHapticEvent &setDuration(const std::int64_t duration) noexcept;
112
117 std::int64_t getDuration(void) const noexcept;
118
124 HandHapticEvent &setFrequencyHz(const float frequencyHz) noexcept;
125
130 float getFrequencyHz(void) const noexcept;
131
137 HandHapticEvent &setDurationNs(const std::int64_t durationNs) noexcept;
138
143 std::int64_t getDurationNs(void) const noexcept;
144 };
145
146} // namespace utility::event
Abstract factory interface for creating events.
Definition event.hpp:44
Abstract base class for hand events.
Factory for creating HandHapticEvent instances.
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.