/***************************************************************
 * PrEncoderTRC.h
 *
 * This is an encoder class for PC7166 board.
 *
 ****************************************************************/

/*
 * modification history
 *----------------------
 *
 * 10/26/97: K.C. Chang: created.
 */

#ifndef _PrEncoderPC7166_h
#define _PrEncoderPC7166_h

#include "PrEncoderIntf.h"

class PrEncoderPC7166 : public PrEncoderIntf
{
 public:
    // constructor sets flag
    // flag() should be called before using
    PrEncoderPC7166();
    ~PrEncoderPC7166();

    // preset encoder values with data
    virtual int valuesPreset(const int *data);

    // read the channel value and return it(meter)
    virtual Float channelValue(int channel);

    // preset encoder values with default data
    virtual int zero();

 private:
    Float *encoderDistPerCount_;
    int *encoderDistCountZero_;

    // convert encoder counts to distance(meter)
    Float BitsToDist(int channel,int bits);

    // convert distance(meter) to encoder counts
    int DistToBits(int channel,Float dist);

    // copy is not allowed
    PrEncoderPC7166(const PrEncoderPC7166 &) {}
};

#endif // _PrEncoderPC7166_h

