19 CPhidgetEncoder_set_OnInputChange_Handler(encoder_handle_,
21 CPhidgetEncoder_set_OnPositionChange_Handler(encoder_handle_,
34 assert(ret == EPHIDGET_OK);
42 int ret = CPhidgetEncoder_getInputState(
encoder_handle_, index, &state);
44 assert(ret == EPHIDGET_OK);
46 return state == PTRUE;
54 assert(ret == EPHIDGET_OK);
62 int ret = CPhidgetEncoder_getPosition(
encoder_handle_, index, &position);
64 assert(ret == EPHIDGET_OK);
71 int ret = CPhidgetEncoder_setPosition(
encoder_handle_, index, position);
73 assert(ret == EPHIDGET_OK);
83 if (ret == EPHIDGET_UNKNOWNVAL)
return 0;
85 assert(ret == EPHIDGET_OK);
95 assert(ret == EPHIDGET_OK);
97 return enabled == PTRUE;
103 enabled ? PTRUE : PFALSE);
105 assert(ret == EPHIDGET_OK);
109 int index,
int inputState)
111 ((
Encoder *)userPtr)->inputChangeHandler(index, inputState);
116 void *userPtr,
int index,
int time,
119 ((
Encoder *)userPtr)->positionChangeHandler(index, time, positionChange);
CPhidgetEncoderHandle encoder_handle_
static int InputChangeHandler(CPhidgetEncoderHandle phid, void *userPtr, int index, int inputState)
int getInputCount()
Gets the number of digital input channels supported by this board.
int getIndexPosition(int index)
Gets the position of an encoder the last time an index pulse occured. An index pulse in this context ...
virtual void inputChangeHandler(int index, int inputState)
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...
int getEncoderCount()
Gets the number of encoder input channels supported by this board.
int getPosition(int index)
Reads the current position of an encoder.
static int PositionChangeHandler(CPhidgetEncoderHandle phid, void *userPtr, int index, int time, int positionChange)
bool getInputState(int index)
Reads the current state of a digital input.
void setPosition(int index, int position)
Sets the offset of an encoder such that current position is the specified value.
void init(CPhidgetHandle handle)
bool getEnabled(int index)
Checks if an encoder is powered on and receiving events.
virtual void positionChangeHandler(int index, int time, int positionChange)