AntiMicroX
Loading...
Searching...
No Matches
haptictriggerps5.h
Go to the documentation of this file.
1/* antimicrox Gamepad to KB+M event mapper
2 * Copyright (C) 2022 Max Maisel <max.maisel@posteo.de>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <QObject>
20#include <QString>
21#include <SDL2/SDL_gamecontroller.h>
22#include <stdint.h>
23
25
27
33class HapticTriggerPs5 : QObject
34{
35 public:
37 int start = 0, int end = 0, int frequency = 0);
38
41 bool set_effect(int strength, int start, int end, int frequency = 0);
42
43 static void send(SDL_GameController *controller, const HapticTriggerPs5 &left, const HapticTriggerPs5 &right);
44 static HapticTriggerModePs5 from_string(const QString &mode);
46
47 private:
48 enum
49 {
55
59 };
60
66 enum
67 {
72 };
73
77 int m_end;
79
81};
Represents a single haptic trigger effect on a PS5 controller. See https://gist.github....
Definition haptictriggerps5.h:34
static QString to_string(HapticTriggerModePs5 mode)
Returns string representation of a HapticTriggerModePs5 object.
Definition haptictriggerps5.cpp:361
HapticTriggerModePs5 m_mode
Definition haptictriggerps5.h:74
HapticTriggerModePs5 get_mode() const
Returns the current haptic feedback effect mode.
Definition haptictriggerps5.cpp:243
int m_strength
Definition haptictriggerps5.h:75
static void send(SDL_GameController *controller, const HapticTriggerPs5 &left, const HapticTriggerPs5 &right)
Creates an low level message from two HapticTriggerPs5 objects and send them to the controller.
Definition haptictriggerps5.cpp:287
bool set_effect(int strength, int start, int end, int frequency=0)
Changes the haptic feedback effect.
Definition haptictriggerps5.cpp:265
int m_end
Definition haptictriggerps5.h:77
int m_start
Definition haptictriggerps5.h:76
@ EFFECT_MODE_RIGID
Definition haptictriggerps5.h:70
@ EFFECT_MODE_NONE
Definition haptictriggerps5.h:68
@ EFFECT_MODE_CLICK
Definition haptictriggerps5.h:69
@ EFFECT_MODE_VIBRATION
Definition haptictriggerps5.h:71
static HapticTriggerModePs5 from_string(const QString &mode)
Converts a HapticTriggerModePs5 from string representation.
Definition haptictriggerps5.cpp:336
bool set_effect_mode(HapticTriggerModePs5 mode)
Changes the haptic feedback mode to the given type.
Definition haptictriggerps5.cpp:250
int m_frequency
Definition haptictriggerps5.h:78
@ EFFECT_LEFT_EN
Definition haptictriggerps5.h:50
@ MICROPHONE_LIGHT_EN
Definition haptictriggerps5.h:54
@ LEGACY_RUMBLE_LEFT_EN
Definition haptictriggerps5.h:52
@ MICROPHONE_LIGHT_PULSE
Definition haptictriggerps5.h:58
@ MICROPHONE_LIGHT_SOLID
Definition haptictriggerps5.h:57
@ LEGACY_RUMBLE_RIGHT_EN
Definition haptictriggerps5.h:53
@ EFFECT_RIGHT_EN
Definition haptictriggerps5.h:51
@ MICROPHONE_LIGHT_OFF
Definition haptictriggerps5.h:56
void to_message(TriggerEffectMsgPs5 &effect) const
Low level function to write one HapticTriggerPs5 effect into a PS5 controller message.
Definition haptictriggerps5.cpp:306
Definition joydpadxml.h:27
HapticTriggerModePs5
Enum of the supported haptic trigger effect for a PS5 controller.
Definition haptictriggermodeps5.h:23
@ HAPTIC_TRIGGER_NONE
Definition haptictriggermodeps5.h:24
Effect message for a single trigger.
Definition haptictriggerps5.cpp:190