NDEVR
API Documentation
DualSenseController

ControllerInterface implementation for Sony DualSense (PS5) and DualSense Edge controllers. More...

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

Public Member Functions

 DualSenseController (const DS5W::DeviceContext &context)
 Constructs the controller from a DualSense device context.
virtual Buffer< Battery * > batteries () const override
 Returns the batteries associated with this controller.
virtual Buffer< ControlButtoncenterButtons () const override
 Returns the center buttons on the controller (e.g., start, select).
virtual RGBColor color () const override
 Returns the current LED color of the controller, if supported.
Buffer< HapticFeedbackhapticFeedback () const override
 Returns the haptic feedback outputs available on this controller.
virtual UUID id () const override
 Returns the unique identifier of this controller.
virtual Buffer< ControlButtonleftButtons () const override
 Returns the left-side buttons on the controller (e.g., D-pad).
virtual Buffer< ControlStickleftSticks () const override
 Returns the left-side analog sticks on the controller.
virtual Buffer< ControlTriggerleftTriggers () const override
 Returns the left-side triggers on the controller.
virtual bool requestColor (const RGBColor &color) override
 Requests the controller LED to display the given color.
virtual bool requestVibrating (fltp08 left, fltp08 right) override
 Requests the controller to vibrate with the given intensities.
virtual Buffer< ControlButtonrightButtons () const override
 Returns the right-side buttons on the controller.
virtual Buffer< ControlStickrightSticks () const override
 Returns the right-side analog sticks on the controller.
virtual Buffer< ControlTriggerrightTriggers () const override
 Returns the right-side triggers on the controller.
virtual void setWindowInstance (WindowInstance *instance) override
 Associates a window instance with this controller for input routing.
void updateState () override
 Polls the controller hardware and updates the internal input state.
virtual Vector< 2, fltp08vibration () const override
 Returns the current vibration intensity for both motors.
Public Member Functions inherited from ControllerInterface
void onUpdated ()
 Emitted after the controller state has been updated.

Protected Member Functions

void processTouchEvent ()
 Processes touchpad events from the controller and generates input events.

Protected Attributes

uint04 failure_count = 0
 Number of consecutive communication failures.
Batterym_battery
 Battery sensor for the controller.
DS5W::DeviceContext m_context
 Low-level device context handle.
uint04 m_drag_points = 0
 Number of active touch-drag points.
UUID m_id
 Unique identifier for this controller.
DS5W::DS5InputState m_input_state
 Current input state from the controller.
bool m_needs_to_write_params
 Whether output parameters need to be sent.
DS5W::DS5OutputState m_output_state
 Desired output state to send to the controller.
WindowInstancem_window_instance = nullptr
 Associated window instance for input events.

Detailed Description

ControllerInterface implementation for Sony DualSense (PS5) and DualSense Edge controllers.


Definition at line 11 of file DualSenseController.h.

Constructor & Destructor Documentation

◆ DualSenseController()

DualSenseController::DualSenseController ( const DS5W::DeviceContext & context)

Constructs the controller from a DualSense device context.

Parameters
[in]contextThe device context obtained from device enumeration.

Member Function Documentation

◆ batteries()

virtual Buffer< Battery * > DualSenseController::batteries ( ) const
overridevirtual

Returns the batteries associated with this controller.

Returns
A buffer of Battery pointers.

Implements ControllerInterface.

◆ centerButtons()

virtual Buffer< ControlButton > DualSenseController::centerButtons ( ) const
overridevirtual

Returns the center buttons on the controller (e.g., start, select).

Returns
A buffer of ControlButton objects.

Implements ControllerInterface.

◆ color()

virtual RGBColor DualSenseController::color ( ) const
overridevirtual

Returns the current LED color of the controller, if supported.

Returns
The current RGBColor.

Implements ControllerInterface.

Referenced by requestColor().

◆ hapticFeedback()

Buffer< HapticFeedback > DualSenseController::hapticFeedback ( ) const
overridevirtual

Returns the haptic feedback outputs available on this controller.

Returns
A buffer of HapticFeedback objects.

Implements ControllerInterface.

◆ id()

virtual UUID DualSenseController::id ( ) const
overridevirtual

Returns the unique identifier of this controller.

Returns
The UUID of the controller.

Implements ControllerInterface.

◆ leftButtons()

virtual Buffer< ControlButton > DualSenseController::leftButtons ( ) const
overridevirtual

Returns the left-side buttons on the controller (e.g., D-pad).

Returns
A buffer of ControlButton objects.

Implements ControllerInterface.

◆ leftSticks()

virtual Buffer< ControlStick > DualSenseController::leftSticks ( ) const
overridevirtual

Returns the left-side analog sticks on the controller.

Returns
A buffer of ControlStick objects.

Implements ControllerInterface.

◆ leftTriggers()

virtual Buffer< ControlTrigger > DualSenseController::leftTriggers ( ) const
overridevirtual

Returns the left-side triggers on the controller.

Returns
A buffer of ControlTrigger objects.

Implements ControllerInterface.

◆ requestColor()

virtual bool DualSenseController::requestColor ( const RGBColor & color)
overridevirtual

Requests the controller LED to display the given color.

Parameters
[in]colorThe desired LED color.
Returns
True if the color request was accepted.

Implements ControllerInterface.

References color().

◆ requestVibrating()

virtual bool DualSenseController::requestVibrating ( fltp08 left,
fltp08 right )
overridevirtual

Requests the controller to vibrate with the given intensities.

Parameters
[in]leftLeft motor intensity from 0 (off) to 1 (full vibration).
[in]rightRight motor intensity from 0 (off) to 1 (full vibration).
Returns
True if the vibration request was accepted.

Implements ControllerInterface.

◆ rightButtons()

virtual Buffer< ControlButton > DualSenseController::rightButtons ( ) const
overridevirtual

Returns the right-side buttons on the controller.

Returns
A buffer of ControlButton objects.

Implements ControllerInterface.

◆ rightSticks()

virtual Buffer< ControlStick > DualSenseController::rightSticks ( ) const
overridevirtual

Returns the right-side analog sticks on the controller.

Returns
A buffer of ControlStick objects.

Implements ControllerInterface.

◆ rightTriggers()

virtual Buffer< ControlTrigger > DualSenseController::rightTriggers ( ) const
overridevirtual

Returns the right-side triggers on the controller.

Returns
A buffer of ControlTrigger objects.

Implements ControllerInterface.

◆ setWindowInstance()

virtual void DualSenseController::setWindowInstance ( WindowInstance * )
overridevirtual

Associates a window instance with this controller for input routing.

Parameters
[in]WindowInstancepointer to associate. Can be nullptr.

Reimplemented from ControllerInterface.

◆ vibration()

virtual Vector< 2, fltp08 > DualSenseController::vibration ( ) const
overridevirtual

Returns the current vibration intensity for both motors.

Returns
A 2D vector with left and right motor intensities (0 to 1).

Implements ControllerInterface.


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