Instrument Neutral Distributed Interface INDI  1.2.0
Public Types | Public Member Functions | List of all members
INDI::Controller Class Reference

The Controller class provides functionality to access a controller (e.g. joystick) input and send it to the requesting driver. More...

#include <indicontroller.h>

Public Types

typedef std::function< void(const char *joystick_n, double mag, double angle, void *context)> joystickFunc
 joystickFunc Joystick callback function signature.
 
typedef std::function< void(const char *axis_n, double value, void *context)> axisFunc
 axisFunc Axis callback function signature.
 
typedef std::function< void(const char *button_n, ISState state, void *context)> buttonFunc
 buttonFunc Button callback function signature.
 

Public Member Functions

 Controller (INDI::DefaultDevice *cdevice)
 Controller Default ctor. More...
 
void mapController (const char *propertyName, const char *propertyLabel, ControllerType type, const char *initialValue)
 mapController adds a new property to the joystick's settings. More...
 
void clearMap ()
 clearMap clears all properties added previously by mapController()
 
void setJoystickCallback (joystickFunc joystickCallback)
 setJoystickCallback Sets the callback function when a new joystick input is detected. More...
 
void setAxisCallback (axisFunc axisCallback)
 setAxisCallback Sets the callback function when a new axis input is detected. More...
 
void setButtonCallback (buttonFunc buttonCallback)
 setButtonCallback Sets the callback function when a new button input is detected. More...
 

Detailed Description

The Controller class provides functionality to access a controller (e.g. joystick) input and send it to the requesting driver.

The class communicates with INDI joystick driver which in turn enumerates the game pad and provides three types of constrcuts:

Note
All indexes start from 1. i.e. There is no BUTTON_0 or JOYSTICK_0.
See also
See the LX200 Generic & Celestron GPS drivers for an example implementation.
Warning
Both the indi_joystick driver and the driver using this class must be running in the same INDI server (or chained INDI servers) in order for it to work as it depends on snooping among drivers.
Author
Jasem Multaq

Definition at line 67 of file indicontroller.h.

Constructor & Destructor Documentation

INDI::Controller::Controller ( INDI::DefaultDevice cdevice)

Controller Default ctor.

Parameters
cdeviceINDI::DefaultDevice device

Definition at line 25 of file indicontroller.cpp.

Member Function Documentation

void INDI::Controller::mapController ( const char *  propertyName,
const char *  propertyLabel,
ControllerType  type,
const char *  initialValue 
)

mapController adds a new property to the joystick's settings.

Parameters
propertyNameName
propertyLabelLabel
typeThe input type of the property. This value cannot be updated.
initialValueInitial value for the property.

Definition at line 46 of file indicontroller.cpp.

void INDI::Controller::setAxisCallback ( axisFunc  axisCallback)

setAxisCallback Sets the callback function when a new axis input is detected.

Parameters
axisCallbackthe callback function.

Definition at line 287 of file indicontroller.cpp.

void INDI::Controller::setButtonCallback ( buttonFunc  buttonCallback)

setButtonCallback Sets the callback function when a new button input is detected.

Parameters
buttonCallbackthe callback function.

Definition at line 292 of file indicontroller.cpp.

void INDI::Controller::setJoystickCallback ( joystickFunc  joystickCallback)

setJoystickCallback Sets the callback function when a new joystick input is detected.

Parameters
joystickCallbackthe callback function.

Definition at line 282 of file indicontroller.cpp.


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