#ifndef VIRTUALHARDWARE_H
#define VIRTUALHARDWARE_H

class left_encoder
{
private:
    int value;
    bool run;
public:
    left_encoder()
    {
        if(connectionIsInitialize())
            value = StrToInt( sendMessageToServer("leftEncoderValue","get") );
        else
            value = 0;
        run = true;
    }
    void start()
    {
        if(!run)
            value = StrToInt( sendMessageToServer("leftEncoderValue","get") );
        run = true;
    }
    void stop()
    {
        if(run)
        {
            value = StrToInt( sendMessageToServer("leftEncoderValue","get") ) - value;
            run = false;
        }
    }
    void clear()
    {
        value = StrToInt( sendMessageToServer("leftEncoderValue","get") );
    }
    int get()
    {
        if(run)
            return StrToInt( sendMessageToServer("leftEncoderValue","get") ) - value;
        else
            return value;
    }
};

class right_encoder
{
private:
    int value;
    bool run;
public:
    right_encoder()
    {
        if(connectionIsInitialize())
            value = StrToInt( sendMessageToServer("rightEncoderValue","get") );
        else
            value = 0;
        run = true;
    }
    void start()
    {
        if(!run)
            value = StrToInt( sendMessageToServer("rightEncoderValue","get") );
        run = true;
    }
    void stop()
    {
        if(run)
        {
            value = StrToInt( sendMessageToServer("rightEncoderValue","get") ) - value;
            run = false;
        }
    }
    void clear()
    {
        value = StrToInt( sendMessageToServer("rightEncoderValue","get") );
    }
    int get()
    {
        if(run)
            return StrToInt( sendMessageToServer("rightEncoderValue","get") ) - value;
        else
            return value;
    }
};


#endif // VIRTUALHARDWARE_H

