AntiMicroX
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HapticTriggerPs5 Class Reference

Represents a single haptic trigger effect on a PS5 controller. See https://gist.github.com/Nielk1/6d54cc2c00d2201ccb8c2720ad7538db and https://github.com/Electronicks/JoyShockMapper/blob/master/JoyShockMapper/src/SDL2Wrapper.cpp. More...

#include <haptictriggerps5.h>

Inheritance diagram for HapticTriggerPs5:
[legend]
Collaboration diagram for HapticTriggerPs5:
[legend]

Public Member Functions

 HapticTriggerPs5 (QObject *parent, HapticTriggerModePs5 mode=HAPTIC_TRIGGER_NONE, int strength=0, int start=0, int end=0, int frequency=0)
 
HapticTriggerModePs5 get_mode () const
 Returns the current haptic feedback effect mode. More...
 
bool set_effect_mode (HapticTriggerModePs5 mode)
 Changes the haptic feedback mode to the given type. More...
 
bool set_effect (int strength, int start, int end, int frequency=0)
 Changes the haptic feedback effect. More...
 

Static Public Member Functions

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. More...
 
static HapticTriggerModePs5 from_string (const QString &mode)
 Converts a HapticTriggerModePs5 from string representation. More...
 
static QString to_string (HapticTriggerModePs5 mode)
 Returns string representation of a HapticTriggerModePs5 object. More...
 

Private Types

enum  {
  EFFECT_LEFT_EN = 0x04, EFFECT_RIGHT_EN = 0x08, LEGACY_RUMBLE_LEFT_EN = 0x0001, LEGACY_RUMBLE_RIGHT_EN = 0x0002,
  MICROPHONE_LIGHT_EN = 0x0100, MICROPHONE_LIGHT_OFF = 0x00, MICROPHONE_LIGHT_SOLID = 0x01, MICROPHONE_LIGHT_PULSE = 0x02
}
 
enum  { EFFECT_MODE_NONE = 0x05, EFFECT_MODE_CLICK = 0x25, EFFECT_MODE_RIGID = 0x21, EFFECT_MODE_VIBRATION = 0x26 }
 Enum of the supported low level haptic trigger effect modes of the PS5 controller. See https://gist.github.com/Nielk1/6d54cc2c00d2201ccb8c2720ad7538db. More...
 

Private Member Functions

void to_message (TriggerEffectMsgPs5 &effect) const
 Low level function to write one HapticTriggerPs5 effect into a PS5 controller message. More...
 

Private Attributes

HapticTriggerModePs5 m_mode
 
int m_strength
 
int m_start
 
int m_end
 
int m_frequency
 

Detailed Description

Represents a single haptic trigger effect on a PS5 controller. See https://gist.github.com/Nielk1/6d54cc2c00d2201ccb8c2720ad7538db and https://github.com/Electronicks/JoyShockMapper/blob/master/JoyShockMapper/src/SDL2Wrapper.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
EFFECT_LEFT_EN 
EFFECT_RIGHT_EN 
LEGACY_RUMBLE_LEFT_EN 
LEGACY_RUMBLE_RIGHT_EN 
MICROPHONE_LIGHT_EN 
MICROPHONE_LIGHT_OFF 
MICROPHONE_LIGHT_SOLID 
MICROPHONE_LIGHT_PULSE 

◆ anonymous enum

anonymous enum
private

Enum of the supported low level haptic trigger effect modes of the PS5 controller. See https://gist.github.com/Nielk1/6d54cc2c00d2201ccb8c2720ad7538db.

Enumerator
EFFECT_MODE_NONE 
EFFECT_MODE_CLICK 
EFFECT_MODE_RIGID 
EFFECT_MODE_VIBRATION 

Constructor & Destructor Documentation

◆ HapticTriggerPs5()

HapticTriggerPs5::HapticTriggerPs5 ( QObject *  parent,
HapticTriggerModePs5  mode = HAPTIC_TRIGGER_NONE,
int  strength = 0,
int  start = 0,
int  end = 0,
int  frequency = 0 
)
explicit

Member Function Documentation

◆ from_string()

HapticTriggerModePs5 HapticTriggerPs5::from_string ( const QString &  mode)
static

Converts a HapticTriggerModePs5 from string representation.

Here is the caller graph for this function:

◆ get_mode()

HapticTriggerModePs5 HapticTriggerPs5::get_mode ( ) const

Returns the current haptic feedback effect mode.

Here is the caller graph for this function:

◆ send()

void HapticTriggerPs5::send ( SDL_GameController *  controller,
const HapticTriggerPs5 left,
const HapticTriggerPs5 right 
)
static

Creates an low level message from two HapticTriggerPs5 objects and send them to the controller.

Parameters
[in]controllerController to which the message is send.
[in]leftHapticTriggerPs5 effect for the left trigger.
[in]rightHapticTriggerPs5 effect for the right trigger.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_effect()

bool HapticTriggerPs5::set_effect ( int  strength,
int  start,
int  end,
int  frequency = 0 
)

Changes the haptic feedback effect.

Parameters
[in]strengthStrength of the feedback force between 0 and 255.
[in]startStart point of the effect. Value between 0 and 320.
[in]endEnd point of the effect. Value between 0 and 320.
[in]frequencyFrequency of the effect in Hz. Value between 1 and 255.
Returns
True when the effect was changed, false otherwise.
Here is the caller graph for this function:

◆ set_effect_mode()

bool HapticTriggerPs5::set_effect_mode ( HapticTriggerModePs5  mode)

Changes the haptic feedback mode to the given type.

Parameters
[in]modeNew haptic feedback mode.
Returns
True when the mode was changed, false otherwise.
Here is the caller graph for this function:

◆ to_message()

void HapticTriggerPs5::to_message ( TriggerEffectMsgPs5 effect) const
private

Low level function to write one HapticTriggerPs5 effect into a PS5 controller message.

Parameters
[in]effectPointer to the triggers effect data position in the effect message.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_string()

QString HapticTriggerPs5::to_string ( HapticTriggerModePs5  mode)
static

Returns string representation of a HapticTriggerModePs5 object.

Here is the caller graph for this function:

Field Documentation

◆ m_end

int HapticTriggerPs5::m_end
private

◆ m_frequency

int HapticTriggerPs5::m_frequency
private

◆ m_mode

HapticTriggerModePs5 HapticTriggerPs5::m_mode
private

◆ m_start

int HapticTriggerPs5::m_start
private

◆ m_strength

int HapticTriggerPs5::m_strength
private

The documentation for this class was generated from the following files: