diff --git a/src/Agilent4uhv.cpp b/src/Agilent4uhv.cpp index b650d7d71a2b43b04d33dce31aec1c9540c955c3..f2e9c77ab54e5668a6469198728eb664076d9b5e 100644 --- a/src/Agilent4uhv.cpp +++ b/src/Agilent4uhv.cpp @@ -755,30 +755,25 @@ void Agilent4uhv::write_VTargetX(Tango::WAttribute &attr) check_init(); int value = w_val; - if (value > 0 && value < 3000) + if (value < 3000 || value > 7000 || value % 1000) Tango::Except::throw_exception( "", - "Out of range [3000-7000]", + "Invalid value [3000,4000,5000,6000,7000]", "Agilent4uhv::write_VTargetX()"); string channel_str = attr.get_name().substr(attr.get_name().size()-1); int channel; convert(channel_str, channel); - - string fs; - read_window_from_cache(603, fs); - fs[fs.size()-channel] = '0'; - write_window(603, fs); + + string step; + read_window_from_cache(603, step); + step[step.size()-channel] = '0'; + write_window(603, step); + read_window_into_cache(603); int win; convert("6" + channel_str + "3", win); - if (value != 0) { - write_window(win, value); - read_window_into_cache(win); - - fs[fs.size()-channel] = '1'; - write_window(603, fs); - } - read_window_into_cache(603); + write_window(win, value); + read_window_into_cache(win); /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_VTargetX } @@ -1198,62 +1193,67 @@ void Agilent4uhv::write_ProtectX(Tango::WAttribute &attr) } //-------------------------------------------------------- /** - * Read attribute FixedStepX related method + * Read attribute FixedX related method * Description: * * Data type: Tango::DevBoolean * Attr type: Scalar */ //-------------------------------------------------------- -void Agilent4uhv::read_FixedStepX(Tango::Attribute &attr) +void Agilent4uhv::read_FixedX(Tango::Attribute &attr) { - DEBUG_STREAM << "Agilent4uhv::read_FixedStepX(Tango::Attribute &attr) entering... " << endl; - Tango::DevBoolean *att_value = get_FixedStepX_data_ptr(attr.get_name()); - /*----- PROTECTED REGION ID(Agilent4uhv::read_FixedStepX) ENABLED START -----*/ + DEBUG_STREAM << "Agilent4uhv::read_FixedX(Tango::Attribute &attr) entering... " << endl; + Tango::DevBoolean *att_value = get_FixedX_data_ptr(attr.get_name()); + /*----- PROTECTED REGION ID(Agilent4uhv::read_FixedX) ENABLED START -----*/ // Set the attribute value int channel; convert(attr.get_name().substr(attr.get_name().size()-1), channel); + + string step; + read_window_from_cache(603, step); - string fs; - read_window_from_cache(603, fs); + if (step[step.size()-channel] == '0') + *att_value = true; + else /* == 1 */ + *att_value = false; - convert(fs[fs.size()-channel], *att_value); attr.set_value(att_value); - /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_FixedStepX + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::read_FixedX } //-------------------------------------------------------- /** - * Write attribute FixedStepX related method + * Write attribute FixedX related method * Description: * * Data type: Tango::DevBoolean * Attr type: Scalar */ //-------------------------------------------------------- -void Agilent4uhv::write_FixedStepX(Tango::WAttribute &attr) +void Agilent4uhv::write_FixedX(Tango::WAttribute &attr) { - DEBUG_STREAM << "Agilent4uhv::write_FixedStepX(Tango::WAttribute &attr) entering... " << endl; + DEBUG_STREAM << "Agilent4uhv::write_FixedX(Tango::WAttribute &attr) entering... " << endl; // Retrieve write value Tango::DevBoolean w_val; attr.get_write_value(w_val); - /*----- PROTECTED REGION ID(Agilent4uhv::write_FixedStepX) ENABLED START -----*/ + /*----- PROTECTED REGION ID(Agilent4uhv::write_FixedX) ENABLED START -----*/ check_init(); int channel; convert(attr.get_name().substr(attr.get_name().size()-1), channel); - string fs; - read_window_from_cache(603, fs); + string step; + read_window_from_cache(603, step); if (w_val) - fs[fs.size()-channel] = '1'; + step[step.size()-channel] = '0'; else - fs[fs.size()-channel] = '0'; + step[step.size()-channel] = '1'; - write_window(603, fs); + write_window(603, step); read_window_into_cache(603); - /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_FixedStepX + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_FixedX } //-------------------------------------------------------- /** @@ -1330,27 +1330,27 @@ void Agilent4uhv::read_StatMaskX(Tango::Attribute &attr) bool state; read_window_from_cache(10 + channel, state); if (state) - *att_value |= 0x1; + *att_value |= 1; int mode; read_window_from_cache(8, mode); if (mode != 3 /* LOCAL */) - *att_value |= 0x1 << 1; + *att_value |= 1 << 1; int errorcodes; read_window_from_cache(2060 + channel, errorcodes); if (errorcodes != 0) - *att_value |= 0x1 << 2; + *att_value |= 1 << 2; - string fs; - read_window_from_cache(603, fs); - if (fs[fs.size()-channel] == '0') - *att_value |= 0x1 << 3; + string step; + read_window_from_cache(603, step); + if (step[step.size()-channel] == '1') + *att_value |= 1 << 3; string sp; read_window_from_cache(602, sp); if (sp[sp.size()-channel] == '1') - *att_value |= 0x1 << 4; + *att_value |= 1 << 4; // FIXME bits 5,6 and 7 aren't implemented @@ -1383,7 +1383,7 @@ void Agilent4uhv::add_dynamic_attributes() // add_StatusX_dynamic_attribute("MyStatusXAttribute"); // add_AutoStartX_dynamic_attribute("MyAutoStartXAttribute"); // add_ProtectX_dynamic_attribute("MyProtectXAttribute"); - // add_FixedStepX_dynamic_attribute("MyFixedStepXAttribute"); + // add_FixedX_dynamic_attribute("MyFixedXAttribute"); // add_StatusSetPointX_dynamic_attribute("MyStatusSetPointXAttribute"); // add_InterlockStatusX_dynamic_attribute("MyInterlockStatusXAttribute"); // add_StatMaskX_dynamic_attribute("MyStatMaskXAttribute"); @@ -1411,7 +1411,7 @@ void Agilent4uhv::add_dynamic_attributes() add_AutoStartX_dynamic_attribute("AutoStart" + channels[i]); add_ProtectX_dynamic_attribute("Protect" + channels[i]); - add_FixedStepX_dynamic_attribute("Fixed" + channels[i]); + add_FixedX_dynamic_attribute("Fixed" + channels[i]); add_StatusSetPointX_dynamic_attribute("StatusSetPoint" + channels[i]); add_InterlockStatusX_dynamic_attribute("InterlockStatus" + channels[i]); add_StatMaskX_dynamic_attribute("StatMask" + channels[i]); diff --git a/src/Agilent4uhv.h b/src/Agilent4uhv.h index 3ba7951fd4a26895abf94c52c01cd199aa6177e0..40f8d29370c2aa0312dc01bb59dea76883cc26bc 100644 --- a/src/Agilent4uhv.h +++ b/src/Agilent4uhv.h @@ -407,19 +407,19 @@ public: map<string,Tango::DevBoolean> ProtectX_data; /** - * Attribute FixedStepX related methods + * Attribute FixedX related methods * Description: * * Data type: Tango::DevBoolean * Attr type: Scalar */ - virtual void read_FixedStepX(Tango::Attribute &attr); - virtual void write_FixedStepX(Tango::WAttribute &attr); - virtual bool is_FixedStepX_allowed(Tango::AttReqType type); - void add_FixedStepX_dynamic_attribute(string attname); - void remove_FixedStepX_dynamic_attribute(string attname); - Tango::DevBoolean *get_FixedStepX_data_ptr(string &name); - map<string,Tango::DevBoolean> FixedStepX_data; + virtual void read_FixedX(Tango::Attribute &attr); + virtual void write_FixedX(Tango::WAttribute &attr); + virtual bool is_FixedX_allowed(Tango::AttReqType type); + void add_FixedX_dynamic_attribute(string attname); + void remove_FixedX_dynamic_attribute(string attname); + Tango::DevBoolean *get_FixedX_data_ptr(string &name); + map<string,Tango::DevBoolean> FixedX_data; /** * Attribute StatusSetPointX related methods diff --git a/src/Agilent4uhv.xmi b/src/Agilent4uhv.xmi index c845810765ba46f154048a996feec3deac234665..4e6a91480abbecd1cd0080b7494e01e082f2bdb2 100644 --- a/src/Agilent4uhv.xmi +++ b/src/Agilent4uhv.xmi @@ -125,7 +125,7 @@ <archiveEvent fire="false" libCheckCriteria="false"/> <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - <properties description="" label="" unit="V" standardUnit="" displayUnit="" format="" maxValue="7000" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <properties description="" label="" unit="V" standardUnit="" displayUnit="" format="" maxValue="7000" minValue="3000" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> <readExcludedStates>UNKNOWN</readExcludedStates> <readExcludedStates>INIT</readExcludedStates> <writeExcludedStates>UNKNOWN</writeExcludedStates> @@ -239,7 +239,7 @@ <writeExcludedStates>UNKNOWN</writeExcludedStates> <writeExcludedStates>INIT</writeExcludedStates> </dynamicAttributes> - <dynamicAttributes name="FixedStepX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> + <dynamicAttributes name="FixedX" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="false" isDynamic="true"> <dataType xsi:type="pogoDsl:BooleanType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> diff --git a/src/Agilent4uhvClass.h b/src/Agilent4uhvClass.h index 269e9c42b0f643d8f99e09d7eea0bd8249c7d3f8..4a307aedf2ed441d8e8afb6c4056e144f4ae06bf 100644 --- a/src/Agilent4uhvClass.h +++ b/src/Agilent4uhvClass.h @@ -299,19 +299,19 @@ public: {return (static_cast<Agilent4uhv *>(dev))->is_ProtectX_allowed(ty);} }; -// Attribute FixedStepX class definition -class FixedStepXAttrib: public Tango::Attr +// Attribute FixedX class definition +class FixedXAttrib: public Tango::Attr { public: - FixedStepXAttrib(const string &att_name):Attr(att_name.c_str(), + FixedXAttrib(const string &att_name):Attr(att_name.c_str(), Tango::DEV_BOOLEAN, Tango::READ_WRITE) {}; - ~FixedStepXAttrib() {}; + ~FixedXAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<Agilent4uhv *>(dev))->read_FixedStepX(att);} + {(static_cast<Agilent4uhv *>(dev))->read_FixedX(att);} virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<Agilent4uhv *>(dev))->write_FixedStepX(att);} + {(static_cast<Agilent4uhv *>(dev))->write_FixedX(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<Agilent4uhv *>(dev))->is_FixedStepX_allowed(ty);} + {return (static_cast<Agilent4uhv *>(dev))->is_FixedX_allowed(ty);} }; // Attribute StatusSetPointX class definition diff --git a/src/Agilent4uhvDynAttrUtils.cpp b/src/Agilent4uhvDynAttrUtils.cpp index f11c350ef395cb16431ae01aa400607c00282827..deab5f603d1f024a0b912bedabe3925a4dea9323 100644 --- a/src/Agilent4uhvDynAttrUtils.cpp +++ b/src/Agilent4uhvDynAttrUtils.cpp @@ -57,7 +57,7 @@ // StatusX | Tango::DevString Scalar // AutoStartX | Tango::DevBoolean Scalar // ProtectX | Tango::DevBoolean Scalar -// FixedStepX | Tango::DevBoolean Scalar +// FixedX | Tango::DevBoolean Scalar // StatusSetPointX | Tango::DevBoolean Scalar // InterlockStatusX | Tango::DevBoolean Scalar // StatMaskX | Tango::DevLong Scalar @@ -271,7 +271,7 @@ void Agilent4uhv::add_VTargetX_dynamic_attribute(string attname) // display_unit not set for VTargetX // format not set for VTargetX vtargetx_prop.set_max_value("7000"); - vtargetx_prop.set_min_value("0"); + vtargetx_prop.set_min_value("3000"); // max_alarm not set for VTargetX // min_alarm not set for VTargetX // max_warning not set for VTargetX @@ -883,59 +883,59 @@ void Agilent4uhv::remove_ProtectX_dynamic_attribute(string attname) } //-------------------------------------------------------- /** - * Add a FixedStepX dynamic attribute. + * Add a FixedX dynamic attribute. * * parameter attname: attribute name to be cretated and added. */ //-------------------------------------------------------- -void Agilent4uhv::add_FixedStepX_dynamic_attribute(string attname) +void Agilent4uhv::add_FixedX_dynamic_attribute(string attname) { - // Attribute : FixedStepX - FixedStepXAttrib *fixedstepx = new FixedStepXAttrib(attname); - Tango::UserDefaultAttrProp fixedstepx_prop; - // description not set for FixedStepX - // label not set for FixedStepX - // unit not set for FixedStepX - // standard_unit not set for FixedStepX - // display_unit not set for FixedStepX - // format not set for FixedStepX - // max_value not set for FixedStepX - // min_value not set for FixedStepX - // max_alarm not set for FixedStepX - // min_alarm not set for FixedStepX - // max_warning not set for FixedStepX - // min_warning not set for FixedStepX - // delta_t not set for FixedStepX - // delta_val not set for FixedStepX + // Attribute : FixedX + FixedXAttrib *fixedx = new FixedXAttrib(attname); + Tango::UserDefaultAttrProp fixedx_prop; + // description not set for FixedX + // label not set for FixedX + // unit not set for FixedX + // standard_unit not set for FixedX + // display_unit not set for FixedX + // format not set for FixedX + // max_value not set for FixedX + // min_value not set for FixedX + // max_alarm not set for FixedX + // min_alarm not set for FixedX + // max_warning not set for FixedX + // min_warning not set for FixedX + // delta_t not set for FixedX + // delta_val not set for FixedX - /*----- PROTECTED REGION ID(Agilent4uhv::att_FixedStepX_dynamic_attribute) ENABLED START -----*/ + /*----- PROTECTED REGION ID(Agilent4uhv::att_FixedX_dynamic_attribute) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_FixedStepX_dynamic_attribute - fixedstepx->set_default_properties(fixedstepx_prop); + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::att_FixedX_dynamic_attribute + fixedx->set_default_properties(fixedx_prop); // Not Polled - fixedstepx->set_disp_level(Tango::OPERATOR); + fixedx->set_disp_level(Tango::OPERATOR); // Not Memorized - FixedStepX_data.insert(make_pair(attname, false)); - add_attribute(fixedstepx); + FixedX_data.insert(make_pair(attname, false)); + add_attribute(fixedx); } //-------------------------------------------------------- /** - * remove a FixedStepX dynamic attribute. + * remove a FixedX dynamic attribute. * * parameter attname: attribute name to be removed. */ //-------------------------------------------------------- -void Agilent4uhv::remove_FixedStepX_dynamic_attribute(string attname) +void Agilent4uhv::remove_FixedX_dynamic_attribute(string attname) { remove_attribute(attname, true); map<string,Tango::DevBoolean>::iterator ite; - if ((ite=FixedStepX_data.find(attname))!=FixedStepX_data.end()) + if ((ite=FixedX_data.find(attname))!=FixedX_data.end()) { - /*----- PROTECTED REGION ID(Agilent4uhv::remove_FixedStepX_dynamic_attribute) ENABLED START -----*/ + /*----- PROTECTED REGION ID(Agilent4uhv::remove_FixedX_dynamic_attribute) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_FixedStepX_dynamic_attribute - FixedStepX_data.erase(ite); + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::remove_FixedX_dynamic_attribute + FixedX_data.erase(ite); } } //-------------------------------------------------------- @@ -1410,22 +1410,22 @@ Tango::DevBoolean *Agilent4uhv::get_ProtectX_data_ptr(string &name) } //-------------------------------------------------------- /** - * Return a pointer on FixedStepX data. + * Return a pointer on FixedX data. * * parameter attname: the specified attribute name. */ //-------------------------------------------------------- -Tango::DevBoolean *Agilent4uhv::get_FixedStepX_data_ptr(string &name) +Tango::DevBoolean *Agilent4uhv::get_FixedX_data_ptr(string &name) { map<string,Tango::DevBoolean>::iterator ite; - if ((ite=FixedStepX_data.find(name))==FixedStepX_data.end()) + if ((ite=FixedX_data.find(name))==FixedX_data.end()) { TangoSys_OMemStream tms; tms << "Dynamic attribute " << name << " has not been created"; Tango::Except::throw_exception( (const char *)"ATTRIBUTE_NOT_FOUND", tms.str().c_str(), - (const char *)"Agilent4uhv::get_FixedStepX_data_ptr()"); + (const char *)"Agilent4uhv::get_FixedX_data_ptr()"); } return &(ite->second); } diff --git a/src/Agilent4uhvStateMachine.cpp b/src/Agilent4uhvStateMachine.cpp index d38264bc273ee984c0f11c568ff46635d0f66eea..61683f19a7fc46996c0d441419f54f99f6427168 100644 --- a/src/Agilent4uhvStateMachine.cpp +++ b/src/Agilent4uhvStateMachine.cpp @@ -602,11 +602,11 @@ bool Agilent4uhv::is_ProtectX_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : Agilent4uhv::is_FixedStepX_allowed() - * Description : Execution allowed for FixedStepX attribute + * Method : Agilent4uhv::is_FixedX_allowed() + * Description : Execution allowed for FixedX attribute */ //-------------------------------------------------------- -bool Agilent4uhv::is_FixedStepX_allowed(TANGO_UNUSED(Tango::AttReqType type)) +bool Agilent4uhv::is_FixedX_allowed(TANGO_UNUSED(Tango::AttReqType type)) { // Check access type. if ( type!=Tango::READ_REQ ) @@ -615,9 +615,9 @@ bool Agilent4uhv::is_FixedStepX_allowed(TANGO_UNUSED(Tango::AttReqType type)) if (get_state()==Tango::UNKNOWN || get_state()==Tango::INIT) { - /*----- PROTECTED REGION ID(Agilent4uhv::FixedStepXStateAllowed_WRITE) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Agilent4uhv::FixedStepXStateAllowed_WRITE + /*----- PROTECTED REGION ID(Agilent4uhv::FixedXStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::FixedXStateAllowed_WRITE return false; } return true; @@ -631,9 +631,9 @@ bool Agilent4uhv::is_FixedStepX_allowed(TANGO_UNUSED(Tango::AttReqType type)) if (get_state()==Tango::UNKNOWN || get_state()==Tango::INIT) { - /*----- PROTECTED REGION ID(Agilent4uhv::FixedStepXStateAllowed_READ) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Agilent4uhv::FixedStepXStateAllowed_READ + /*----- PROTECTED REGION ID(Agilent4uhv::FixedXStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // Agilent4uhv::FixedXStateAllowed_READ return false; } return true;