From 62bc6c1fb14238558d78093fe6544729c69e57d6 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Fri, 22 Aug 2014 22:22:38 +0200 Subject: [PATCH] PVControl::minStep implemented --- src/property/control.h | 2 +- src/property/pvControl.cpp | 12 ++++++++++-- src/property/pvControl.h | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/property/control.h b/src/property/control.h index 63149ec..a906988 100644 --- a/src/property/control.h +++ b/src/property/control.h @@ -16,7 +16,7 @@ namespace epics { namespace pvData { class epicsShareClass Control { public: - Control() : low(0.0), high(0.0) {} + Control() : low(0.0), high(0.0), minStep(0.0) {} //default constructors and destructor are OK double getLow() const {return low;} double getHigh() const {return high;} diff --git a/src/property/pvControl.cpp b/src/property/pvControl.cpp index f0390df..9de5195 100644 --- a/src/property/pvControl.cpp +++ b/src/property/pvControl.cpp @@ -30,11 +30,17 @@ bool PVControl::attach(PVFieldPtr const & pvField) PVStructurePtr pvStructure = static_pointer_cast(pvField); pvLow = pvStructure->getDoubleField("limitLow"); if(pvLow.get()==NULL) return false; - pvHigh = pvStructure->getDoubleField(string("limitHigh")); + pvHigh = pvStructure->getDoubleField("limitHigh"); if(pvHigh.get()==NULL) { pvLow.reset(); return false; } + pvMinStep = pvStructure->getDoubleField("minStep"); + if(pvMinStep.get()==NULL) { + pvLow.reset(); + pvHigh.reset(); + return false; + } return true; } @@ -56,6 +62,7 @@ void PVControl::get(Control &control) const } control.setLow(pvLow->get()); control.setHigh(pvHigh->get()); + control.setMinStep(pvMinStep->get()); } bool PVControl::set(Control const & control) @@ -63,9 +70,10 @@ bool PVControl::set(Control const & control) if(pvLow.get()==NULL) { throw std::logic_error(notAttached); } - if(pvLow->isImmutable() || pvHigh->isImmutable()) return false; + if(pvLow->isImmutable() || pvHigh->isImmutable() || pvMinStep->isImmutable()) return false; pvLow->put(control.getLow()); pvHigh->put(control.getHigh()); + pvMinStep->put(control.getMinStep()); return true; } diff --git a/src/property/pvControl.h b/src/property/pvControl.h index a091b4f..0a64d3a 100644 --- a/src/property/pvControl.h +++ b/src/property/pvControl.h @@ -33,6 +33,7 @@ public: private: PVDoublePtr pvLow; PVDoublePtr pvHigh; + PVDoublePtr pvMinStep; static std::string noControlFound; static std::string notAttached; };