Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | List of all members
phidgets::Encoder Class Reference

#include <encoder.h>

Inheritance diagram for phidgets::Encoder:
Inheritance graph
[legend]

Public Member Functions

 Encoder ()
 
bool getEnabled (int index)
 Checks if an encoder is powered on and receiving events. More...
 
int getEncoderCount ()
 Gets the number of encoder input channels supported by this board. More...
 
int getIndexPosition (int index)
 Gets the position of an encoder the last time an index pulse occured. An index pulse in this context refers to an input from the encoder the pulses high once every revolution. More...
 
int getInputCount ()
 Gets the number of digital input channels supported by this board. More...
 
bool getInputState (int index)
 Reads the current state of a digital input. More...
 
int getPosition (int index)
 Reads the current position of an encoder. More...
 
void setEnabled (int index, bool enabled)
 Set the powered state of an encoder. If an encoder is not enabled, it will not be given power, and events and changes in position will not be captured. More...
 
void setPosition (int index, int position)
 Sets the offset of an encoder such that current position is the specified value. More...
 
virtual ~Encoder ()
 
- Public Member Functions inherited from phidgets::Phidget
int close ()
 Close the connection to the phidget. More...
 
std::string getDeviceLabel ()
 Get the device label string. More...
 
std::string getDeviceName ()
 Get the device name string. More...
 
int getDeviceSerialNumber ()
 Get the Phidget's serial number. More...
 
std::string getDeviceType ()
 Get the device type string. More...
 
int getDeviceVersion ()
 Get the Phidget's version. More...
 
std::string getLibraryVersion ()
 Get the library version string. More...
 
int openAndWaitForAttachment (int serial_number, int timeout)
 Open a connection to a Phidget. More...
 
 Phidget ()
 
virtual ~Phidget ()
 

Protected Member Functions

virtual void inputChangeHandler (int index, int inputState)
 
virtual void positionChangeHandler (int index, int time, int positionChange)
 
- Protected Member Functions inherited from phidgets::Phidget
virtual void attachHandler ()
 
virtual void detachHandler ()
 
virtual void errorHandler (int error)
 
void init (CPhidgetHandle handle)
 
void registerHandlers ()
 

Static Private Member Functions

static int InputChangeHandler (CPhidgetEncoderHandle phid, void *userPtr, int index, int inputState)
 
static int PositionChangeHandler (CPhidgetEncoderHandle phid, void *userPtr, int index, int time, int positionChange)
 

Private Attributes

CPhidgetEncoderHandle encoder_handle_
 

Additional Inherited Members

- Static Public Member Functions inherited from phidgets::Phidget
static std::string getErrorDescription (int errorCode)
 Lookup the string for a CPhidget Error Code. More...
 

Detailed Description

Definition at line 8 of file encoder.h.

Constructor & Destructor Documentation

phidgets::Encoder::Encoder ( )

Definition at line 7 of file encoder.cpp.

phidgets::Encoder::~Encoder ( )
virtual

Definition at line 25 of file encoder.cpp.

Member Function Documentation

bool phidgets::Encoder::getEnabled ( int  index)

Checks if an encoder is powered on and receiving events.

Parameters
indexThe index of the encoder to check

Definition at line 90 of file encoder.cpp.

int phidgets::Encoder::getEncoderCount ( )

Gets the number of encoder input channels supported by this board.

Definition at line 49 of file encoder.cpp.

int phidgets::Encoder::getIndexPosition ( int  index)

Gets the position of an encoder the last time an index pulse occured. An index pulse in this context refers to an input from the encoder the pulses high once every revolution.

Parameters
indexThe index of the encoder to read

Definition at line 76 of file encoder.cpp.

int phidgets::Encoder::getInputCount ( )

Gets the number of digital input channels supported by this board.

Definition at line 29 of file encoder.cpp.

bool phidgets::Encoder::getInputState ( int  index)

Reads the current state of a digital input.

Parameters
indexThe index of the input to read

Definition at line 39 of file encoder.cpp.

int phidgets::Encoder::getPosition ( int  index)

Reads the current position of an encoder.

Parameters
indexThe index of the encoder to read

Definition at line 59 of file encoder.cpp.

void phidgets::Encoder::inputChangeHandler ( int  index,
int  inputState 
)
protectedvirtual

Definition at line 123 of file encoder.cpp.

int phidgets::Encoder::InputChangeHandler ( CPhidgetEncoderHandle  phid,
void *  userPtr,
int  index,
int  inputState 
)
staticprivate

Definition at line 108 of file encoder.cpp.

void phidgets::Encoder::positionChangeHandler ( int  index,
int  time,
int  positionChange 
)
protectedvirtual

Definition at line 128 of file encoder.cpp.

int phidgets::Encoder::PositionChangeHandler ( CPhidgetEncoderHandle  phid,
void *  userPtr,
int  index,
int  time,
int  positionChange 
)
staticprivate

Definition at line 115 of file encoder.cpp.

void phidgets::Encoder::setEnabled ( int  index,
bool  enabled 
)

Set the powered state of an encoder. If an encoder is not enabled, it will not be given power, and events and changes in position will not be captured.

Parameters
indexThe index of the encoder to change
enabledThe new powered state of the encoder

Definition at line 100 of file encoder.cpp.

void phidgets::Encoder::setPosition ( int  index,
int  position 
)

Sets the offset of an encoder such that current position is the specified value.

Parameters
indexThe index of the encoder to set
positionThe new value that should be returned by 'getPosition(index)' at the current position of the encoder

Definition at line 69 of file encoder.cpp.

Member Data Documentation

CPhidgetEncoderHandle phidgets::Encoder::encoder_handle_
private

Definition at line 60 of file encoder.h.


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


phidgets_api
Author(s): Tully Foote, Ivan Dryanovski
autogenerated on Fri Apr 9 2021 02:56:02