libOpenWinControls
Multiplatform open-source library to interact with the dual-mode controller in GPD devices
Loading...
Searching...
No Matches
OWC::ControllerV2 Class Referencefinal

interact with controller V2 devices More...

#include <ControllerV2.h>

Public Member Functions

 ControllerV2 (int controllerFeatures=0)
 create a new ControllerV2 controller
int getControllerType () const override
 int value of the controller class version
std::pair< int, int > getVersion () const
 get the firmware version
EmulationMode getEmulationMode () const
void setBackButtonActiveSlots (int num, uint8_t count) const
 set the number of active key slots for back button num
int getBackButtonActiveSlots (int num) const
 get the number of active key slots for back button num
void setBackButtonHoldTime (int num, int slot, int timeMs) const
 set hold time for key in slot slot of back button num
int getBackButtonHoldTime (int num, int slot) const
 get hold time for key in slot slot of back button num
bool readConfig () override
 read the whole configuration
bool writeConfig () const override
 write the configuration
bool setButton (Button btn, const std::string &key) const override
 set a new key for the button btn
std::string getButton (Button btn) const override
 get the current key of button btn
bool setBackButton (int num, int slot, const std::string &key) const override
 set a new key in slot slot for back button num
std::string getBackButton (int num, int slot) const override
 get the current key in slot slot of back button num
void setBackButtonStartTime (int num, int slot, int timeMs) const override
 set start time for key in slot slot of back button num
int getBackButtonStartTime (int num, int slot) const override
 get start time for key in slot slot of back button num
void setRumble (RumbleMode mode) const override
 set vibration intensity
RumbleMode getRumbleMode () const override
 get current vibration intesity
void setLedMode (LedMode mode) const override
 set led mode
LedMode getLedMode () const override
 get current led mode
void setLedColor (int r, int g, int b) const override
 set a custom color for the leds
std::tuple< int, int, int > getLedColor () const override
 get current led custom color
void setAnalogCenter (int center, bool left) const override
 set the analog stick offset from center (deadzone)
int getAnalogCenter (bool left) const override
 get the current analog stick offset from center (deadzone)
void setAnalogBoundary (int boundary, bool left) const override
 set the analog stick boundary offset (circularity)
int getAnalogBoundary (bool left) const override
 get the current analog stick boundary offset (circularity)
Public Member Functions inherited from OWC::Controller
void enableLogging (const std::function< void(const std::wstring &)> &logCB)
 Enable log messages.
bool init ()
 Initialize the controller.
bool hasFeature (int feature) const
 Check if feature is enabled for this controller.

Detailed Description

interact with controller V2 devices

Constructor & Destructor Documentation

◆ ControllerV2()

OWC::ControllerV2::ControllerV2 ( int controllerFeatures = 0)
explicit

create a new ControllerV2 controller

Parameters
controllerFeaturesControllerFeature flag

Member Function Documentation

◆ getAnalogBoundary()

int OWC::ControllerV2::getAnalogBoundary ( bool left) const
nodiscardoverridevirtual

get the current analog stick boundary offset (circularity)

Parameters
leftflag indicating to which analog this setting applies to (left or right)
Returns
boundary offset

Implements OWC::Controller.

◆ getAnalogCenter()

int OWC::ControllerV2::getAnalogCenter ( bool left) const
nodiscardoverridevirtual

get the current analog stick offset from center (deadzone)

Parameters
leftflag indicating to which analog this setting applies to (left or right)
Returns
center offset

Implements OWC::Controller.

◆ getBackButton()

std::string OWC::ControllerV2::getBackButton ( int num,
int slot ) const
nodiscardoverridevirtual

get the current key in slot slot of back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button number (1,2 ..)
slotback button key slot
Returns
one of HIDUsageIDMap or XinputUsageIDMap values

Implements OWC::Controller.

◆ getBackButtonActiveSlots()

int OWC::ControllerV2::getBackButtonActiveSlots ( int num) const
nodiscard

get the number of active key slots for back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button number (1,2, ..)
Returns
number of active key slots

◆ getBackButtonHoldTime()

int OWC::ControllerV2::getBackButtonHoldTime ( int num,
int slot ) const
nodiscard

get hold time for key in slot slot of back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button number (1,2 ..)
slotback button key slot
Returns
hold time in milliseconds

◆ getBackButtonStartTime()

int OWC::ControllerV2::getBackButtonStartTime ( int num,
int slot ) const
nodiscardoverridevirtual

get start time for key in slot slot of back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button number (1,2 ..)
slotback button key slot
Returns
start time in milliseconds

Implements OWC::Controller.

◆ getButton()

std::string OWC::ControllerV2::getButton ( Button btn) const
nodiscardoverridevirtual

get the current key of button btn

Parameters
btnthe controller button to read
Returns
one of HIDUsageIDMap or XinputUsageIDMap values

Implements OWC::Controller.

◆ getControllerType()

int OWC::ControllerV2::getControllerType ( ) const
inlinenodiscardoverridevirtual

int value of the controller class version

Returns
controller type (1,2, ..)

Implements OWC::Controller.

◆ getEmulationMode()

EmulationMode OWC::ControllerV2::getEmulationMode ( ) const
nodiscard

get the current emulation mode the controller is set to

Returns
EmulationMode

◆ getLedColor()

std::tuple< int, int, int > OWC::ControllerV2::getLedColor ( ) const
nodiscardoverridevirtual

get current led custom color

returned color is valid only when mode is one of LedMode::Solid or LedMode::Breathe

Returns
red,green,blue values of the color as tuple

Implements OWC::Controller.

◆ getLedMode()

LedMode OWC::ControllerV2::getLedMode ( ) const
nodiscardoverridevirtual

get current led mode

Returns
LedMode

Implements OWC::Controller.

◆ getRumbleMode()

RumbleMode OWC::ControllerV2::getRumbleMode ( ) const
nodiscardoverridevirtual

get current vibration intesity

Returns
RumbleMode

Implements OWC::Controller.

◆ getVersion()

std::pair< int, int > OWC::ControllerV2::getVersion ( ) const
inlinenodiscard

get the firmware version

Returns
major and minor version as a pair

◆ readConfig()

bool OWC::ControllerV2::readConfig ( )
nodiscardoverridevirtual

read the whole configuration

Returns
true on success

Implements OWC::Controller.

◆ setAnalogBoundary()

void OWC::ControllerV2::setAnalogBoundary ( int boundary,
bool left ) const
overridevirtual

set the analog stick boundary offset (circularity)

Parameters
boundaryoffset
leftflag indicating to which analog this setting applies to (left or right)

Implements OWC::Controller.

◆ setAnalogCenter()

void OWC::ControllerV2::setAnalogCenter ( int center,
bool left ) const
overridevirtual

set the analog stick offset from center (deadzone)

Parameters
centeroffset
leftflag indicating to which analog this setting applies to (left or right)

Implements OWC::Controller.

◆ setBackButton()

bool OWC::ControllerV2::setBackButton ( int num,
int slot,
const std::string & key ) const
nodiscardoverridevirtual

set a new key in slot slot for back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button number (1,2, ..)
slotback button key slot
keyone of HIDUsageIDMap or XinputUsageIDMap values (case insensitive)
Returns
true on success

Implements OWC::Controller.

◆ setBackButtonActiveSlots()

void OWC::ControllerV2::setBackButtonActiveSlots ( int num,
uint8_t count ) const

set the number of active key slots for back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button numer (1,2, ..)
countnumber of active key slots

◆ setBackButtonHoldTime()

void OWC::ControllerV2::setBackButtonHoldTime ( int num,
int slot,
int timeMs ) const

set hold time for key in slot slot of back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button number (1,2, ..)
slotback button key slot
timeMshold time in milliseconds

◆ setBackButtonStartTime()

void OWC::ControllerV2::setBackButtonStartTime ( int num,
int slot,
int timeMs ) const
overridevirtual

set start time for key in slot slot of back button num

num is the order of appearance in firmware config

See also
https://github.com/OpenWinControls/libOpenWinControls/tree/main/docs
Parameters
numback button number (1,2 ..)
slotback button key slot
timeMsstart time in milliseconds

Implements OWC::Controller.

◆ setButton()

bool OWC::ControllerV2::setButton ( Button btn,
const std::string & key ) const
nodiscardoverridevirtual

set a new key for the button btn

Parameters
btnthe controller button to remap
keyone of HIDUsageIDMap or XinputUsageIDMap values (case insensitive)
Returns
true on success

Implements OWC::Controller.

◆ setLedColor()

void OWC::ControllerV2::setLedColor ( int r,
int g,
int b ) const
overridevirtual

set a custom color for the leds

has no effect for modes other than LedMode::Solid and LedMode::Breathe

Parameters
rred value of the color
ggreen value of the color
bblue value of the color

Implements OWC::Controller.

◆ setLedMode()

void OWC::ControllerV2::setLedMode ( LedMode mode) const
overridevirtual

set led mode

Parameters
modeone of LedMode

Implements OWC::Controller.

◆ setRumble()

void OWC::ControllerV2::setRumble ( RumbleMode mode) const
overridevirtual

set vibration intensity

Parameters
modeone of RumbleMode

Implements OWC::Controller.

◆ writeConfig()

bool OWC::ControllerV2::writeConfig ( ) const
nodiscardoverridevirtual

write the configuration

Returns
true on success

Implements OWC::Controller.


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