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

Controller abstract base class. More...

#include <Controller.h>

Public Member Functions

virtual int getControllerType () const =0
 int value of the controller class version
virtual bool readConfig ()=0
 read the whole configuration
virtual bool writeConfig () const =0
 write the configuration
virtual bool setButton (Button btn, const std::string &key) const =0
 set a new key for the button btn
virtual std::string getButton (Button btn) const =0
 get the current key of button btn
virtual bool setBackButton (int num, int slot, const std::string &key) const =0
 set a new key in slot slot for back button num
virtual std::string getBackButton (int num, int slot) const =0
 get the current key in slot slot of back button num
virtual void setBackButtonStartTime (int num, int slot, int timeMs) const =0
 set start time for key in slot slot of back button num
virtual int getBackButtonStartTime (int num, int slot) const =0
 get start time for key in slot slot of back button num
virtual void setRumble (RumbleMode mode) const =0
 set vibration intensity
virtual RumbleMode getRumbleMode () const =0
 get current vibration intesity
virtual void setLedMode (LedMode mode) const =0
 set led mode
virtual LedMode getLedMode () const =0
 get current led mode
virtual void setLedColor (int r, int g, int b) const =0
 set a custom color for the leds
virtual std::tuple< int, int, int > getLedColor () const =0
 get current led custom color
virtual void setAnalogCenter (int center, bool left) const =0
 set the analog stick offset from center (deadzone)
virtual int getAnalogCenter (bool left) const =0
 get the current analog stick offset from center (deadzone)
virtual void setAnalogBoundary (int boundary, bool left) const =0
 set the analog stick boundary offset (circularity)
virtual int getAnalogBoundary (bool left) const =0
 get the current analog stick boundary offset (circularity)
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

Controller abstract base class.

Member Function Documentation

◆ enableLogging()

void OWC::Controller::enableLogging ( const std::function< void(const std::wstring &)> & logCB)
inline

Enable log messages.

Parameters
logCBlog callback

◆ getAnalogBoundary()

virtual int OWC::Controller::getAnalogBoundary ( bool left) const
nodiscardpure virtual

get the current analog stick boundary offset (circularity)

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getAnalogCenter()

virtual int OWC::Controller::getAnalogCenter ( bool left) const
nodiscardpure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getBackButton()

virtual std::string OWC::Controller::getBackButton ( int num,
int slot ) const
nodiscardpure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getBackButtonStartTime()

virtual int OWC::Controller::getBackButtonStartTime ( int num,
int slot ) const
nodiscardpure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getButton()

virtual std::string OWC::Controller::getButton ( Button btn) const
nodiscardpure virtual

get the current key of button btn

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getControllerType()

virtual int OWC::Controller::getControllerType ( ) const
nodiscardpure virtual

int value of the controller class version

Returns
controller type (1,2, ..)

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getLedColor()

virtual std::tuple< int, int, int > OWC::Controller::getLedColor ( ) const
nodiscardpure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getLedMode()

virtual LedMode OWC::Controller::getLedMode ( ) const
nodiscardpure virtual

get current led mode

Returns
LedMode

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ getRumbleMode()

virtual RumbleMode OWC::Controller::getRumbleMode ( ) const
nodiscardpure virtual

get current vibration intesity

Returns
RumbleMode

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ hasFeature()

bool OWC::Controller::hasFeature ( int feature) const
nodiscard

Check if feature is enabled for this controller.

Parameters
featureone of ControllerFeature
Returns
true if the feature is enabled

◆ init()

bool OWC::Controller::init ( )
nodiscard

Initialize the controller.

Try to find a supported GPD controller and connect to it

Returns
true on success

◆ readConfig()

virtual bool OWC::Controller::readConfig ( )
nodiscardpure virtual

read the whole configuration

Returns
true on success

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setAnalogBoundary()

virtual void OWC::Controller::setAnalogBoundary ( int boundary,
bool left ) const
pure virtual

set the analog stick boundary offset (circularity)

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setAnalogCenter()

virtual void OWC::Controller::setAnalogCenter ( int center,
bool left ) const
pure virtual

set the analog stick offset from center (deadzone)

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setBackButton()

virtual bool OWC::Controller::setBackButton ( int num,
int slot,
const std::string & key ) const
nodiscardpure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setBackButtonStartTime()

virtual void OWC::Controller::setBackButtonStartTime ( int num,
int slot,
int timeMs ) const
pure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setButton()

virtual bool OWC::Controller::setButton ( Button btn,
const std::string & key ) const
nodiscardpure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setLedColor()

virtual void OWC::Controller::setLedColor ( int r,
int g,
int b ) const
pure virtual

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

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setLedMode()

virtual void OWC::Controller::setLedMode ( LedMode mode) const
pure virtual

set led mode

Parameters
modeone of LedMode

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ setRumble()

virtual void OWC::Controller::setRumble ( RumbleMode mode) const
pure virtual

set vibration intensity

Parameters
modeone of RumbleMode

Implemented in OWC::ControllerV1, and OWC::ControllerV2.

◆ writeConfig()

virtual bool OWC::Controller::writeConfig ( ) const
nodiscardpure virtual

write the configuration

Returns
true on success

Implemented in OWC::ControllerV1, and OWC::ControllerV2.


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