Skip to content

Commit

Permalink
framegrabber_protocol/FrameGrabberControls_Forwarder: Implement depre…
Browse files Browse the repository at this point in the history
…cated methods
  • Loading branch information
drdanz committed Jun 7, 2021
1 parent 685d159 commit 55d31e6
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,154 @@ bool FrameGrabberControls_Forwarder::setOnePush(int feature)
cmd.addInt32(feature);
return m_port.write(cmd, response);
}

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
bool FrameGrabberControls_Forwarder::setCommand(int code, double v)
{
yarp::os::Bottle cmd;
yarp::os::Bottle response;
cmd.addVocab(VOCAB_FRAMEGRABBER_CONTROL);
cmd.addVocab(VOCAB_SET);
cmd.addVocab(code);
cmd.addFloat64(v);
return m_port.write(cmd, response);
}

bool FrameGrabberControls_Forwarder::setCommand(int code, double b, double r)
{
yarp::os::Bottle cmd;
yarp::os::Bottle response;
cmd.addVocab(VOCAB_FRAMEGRABBER_CONTROL);
cmd.addVocab(VOCAB_SET);
cmd.addVocab(code);
cmd.addFloat64(b);
cmd.addFloat64(r);
return m_port.write(cmd, response);
}

double FrameGrabberControls_Forwarder::getCommand(int code) const
{
yarp::os::Bottle cmd;
yarp::os::Bottle response;
cmd.addVocab(VOCAB_FRAMEGRABBER_CONTROL);
cmd.addVocab(VOCAB_GET);
cmd.addVocab(code);
m_port.write(cmd,response);
// response should be [cmd] [name] value
return response.get(2).asFloat64();
}

bool FrameGrabberControls_Forwarder::getCommand(int code, double &b, double &r) const
{
yarp::os::Bottle cmd;
yarp::os::Bottle response;
cmd.addVocab(VOCAB_FRAMEGRABBER_CONTROL);
cmd.addVocab(VOCAB_GET);
cmd.addVocab(code);
m_port.write(cmd,response);
// response should be [cmd] [name] value
b=response.get(2).asFloat64();
r=response.get(3).asFloat64();
return true;
}

bool FrameGrabberControls_Forwarder::setBrightness(double v)
{
return setCommand(VOCAB_BRIGHTNESS, v);
}

double FrameGrabberControls_Forwarder::getBrightness()
{
return getCommand(VOCAB_BRIGHTNESS);
}

bool FrameGrabberControls_Forwarder::setExposure(double v)
{
return setCommand(VOCAB_EXPOSURE, v);
}

double FrameGrabberControls_Forwarder::getExposure()
{
return getCommand(VOCAB_EXPOSURE);
}

bool FrameGrabberControls_Forwarder::setSharpness(double v)
{
return setCommand(VOCAB_SHARPNESS, v);
}

double FrameGrabberControls_Forwarder::getSharpness()
{
return getCommand(VOCAB_SHARPNESS);
}

bool FrameGrabberControls_Forwarder::setWhiteBalance(double blue, double red)
{
return setCommand(VOCAB_WHITE, blue, red);
}

bool FrameGrabberControls_Forwarder::getWhiteBalance(double &blue, double &red)
{
return getCommand(VOCAB_WHITE, blue, red);
}

bool FrameGrabberControls_Forwarder::setHue(double v)
{
return setCommand(VOCAB_HUE,v);
}

double FrameGrabberControls_Forwarder::getHue()
{
return getCommand(VOCAB_HUE);
}

bool FrameGrabberControls_Forwarder::setSaturation(double v)
{
return setCommand(VOCAB_SATURATION,v);
}

double FrameGrabberControls_Forwarder::getSaturation()
{
return getCommand(VOCAB_SATURATION);
}

bool FrameGrabberControls_Forwarder::setGamma(double v)
{
return setCommand(VOCAB_GAMMA,v);
}

double FrameGrabberControls_Forwarder::getGamma()
{
return getCommand(VOCAB_GAMMA);
}

bool FrameGrabberControls_Forwarder::setShutter(double v)
{
return setCommand(VOCAB_SHUTTER,v);
}

double FrameGrabberControls_Forwarder::getShutter()
{
return getCommand(VOCAB_SHUTTER);
}

bool FrameGrabberControls_Forwarder::setGain(double v)
{
return setCommand(VOCAB_GAIN,v);
}

double FrameGrabberControls_Forwarder::getGain()
{
return getCommand(VOCAB_GAIN);
}

bool FrameGrabberControls_Forwarder::setIris(double v)
{
return setCommand(VOCAB_IRIS,v);
}

double FrameGrabberControls_Forwarder::getIris()
{
return getCommand(VOCAB_IRIS);
}
#endif // YARP_NO_DEPRECATED
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,36 @@ class FrameGrabberControls_Forwarder :
bool setMode(int feature, FeatureMode mode) override;
bool getMode(int feature, FeatureMode* mode) override;
bool setOnePush(int feature) override;

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
bool setBrightness(double v) override;
double getBrightness() override;
bool setExposure(double v) override;
double getExposure() override;
bool setSharpness(double v) override;
double getSharpness() override;
bool setWhiteBalance(double blue, double red) override;
bool getWhiteBalance(double &blue, double &red) override;
bool setHue(double v) override;
double getHue() override;
bool setSaturation(double v) override;
double getSaturation() override;
bool setGamma(double v) override;
double getGamma() override;
bool setShutter(double v) override;
double getShutter() override;
bool setGain(double v) override;
double getGain() override;
bool setIris(double v) override;
double getIris() override;

private:
bool setCommand(int code, double v);
bool setCommand(int code, double b, double r);
double getCommand(int code) const;
bool getCommand(int code, double &b, double &r) const;
#endif // YARP_NO_DEPRECATED

};

} // namespace framegrabber
Expand Down

0 comments on commit 55d31e6

Please sign in to comment.