# Generated driver for aerolas_doppler # vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent # namespace eval ::scobj::aerolas_doppler { set debug_threshold 5 } proc ::scobj::aerolas_doppler::debug_log {tc_root debug_level debug_string} { set catch_status [ catch { set debug_threshold [hgetpropval ${tc_root} debug_threshold] if {${debug_level} >= ${debug_threshold}} { set now [clock seconds] set ts [clock format ${now} -format "%Y%m%d"] set log_file_name "../log/aerolas_doppler_[basename ${tc_root}]_${ts}.log" set fd [open "${log_file_name}" "a"] set ts [clock format ${now} -format "%T"] puts ${fd} "${ts} ${debug_string}" close ${fd} } } catch_message ] } proc ::scobj::aerolas_doppler::sics_log {debug_level debug_string} { set catch_status [ catch { set debug_threshold ${::scobj::aerolas_doppler::debug_threshold} if {${debug_level} >= ${debug_threshold}} { sicslog "::scobj::aerolas_doppler::${debug_string}" } } catch_message ] } # check function for hset change proc ::scobj::aerolas_doppler::checkrange {tc_root} { set catch_status [ catch { debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]" set setpoint [sct target] if { [hpropexists [sct] lowerlimit] } { set lolimit [sct lowerlimit] } else { # lowerlimit not set, use target set lolimit [sct target] } if { [hpropexists [sct] upperlimit] } { set hilimit [sct upperlimit] } else { # upperlimit not set, use target set hilimit [sct target] } # checkrange hook code goes here if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } { error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]" } return OK } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to request the read of a parameter on a device proc ::scobj::aerolas_doppler::getFloat {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "getFloat tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set cmd "${cmd_str}" # getFloat hook code starts set cmd "1:3:${cmd_str}:1:F32" # getFloat hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } debug_log ${tc_root} 1 "getFloat sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to request the read of a parameter on a device proc ::scobj::aerolas_doppler::getULong {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "getULong tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set cmd "${cmd_str}" # getULong hook code starts set cmd "1:3:${cmd_str}:1:U32" # getULong hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } debug_log ${tc_root} 1 "getULong sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to request the read of a parameter on a device proc ::scobj::aerolas_doppler::getUShort {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "getUShort tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set cmd "${cmd_str}" # getUShort hook code starts set cmd "1:3:${cmd_str}:1:U16" # getUShort hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } debug_log ${tc_root} 1 "getUShort sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to check the write parameter on a device proc ::scobj::aerolas_doppler::noResponse {tc_root} { set catch_status [ catch { debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]" # noResponse hook code goes here return "idle" } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::aerolas_doppler::rdFloat {tc_root} { set catch_status [ catch { debug_log ${tc_root} 1 "rdFloat tc_root=${tc_root} sct=[sct] result=[sct result]" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set data [sct result] set nextState "idle" if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { # the protocol driver has reported an error sct geterror "${data}" error "[sct geterror]" } # rdFloat hook code goes here if { ${data} != [sct oldval] } { debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" sct oldval ${data} sct update ${data} sct utime readtime } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::aerolas_doppler::rdULong {tc_root} { set catch_status [ catch { debug_log ${tc_root} 1 "rdULong tc_root=${tc_root} sct=[sct] result=[sct result]" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set data [sct result] set nextState "idle" if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { # the protocol driver has reported an error sct geterror "${data}" error "[sct geterror]" } # rdULong hook code goes here if { ${data} != [sct oldval] } { debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" sct oldval ${data} sct update ${data} sct utime readtime } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to parse the read of a parameter on a device proc ::scobj::aerolas_doppler::rdUShort {tc_root} { set catch_status [ catch { debug_log ${tc_root} 1 "rdUShort tc_root=${tc_root} sct=[sct] result=[sct result]" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set data [sct result] set nextState "idle" if {[string equal -nocase -length 7 ${data} "ASCERR:"]} { # the protocol driver has reported an error sct geterror "${data}" error "[sct geterror]" } # rdUShort hook code goes here if { ${data} != [sct oldval] } { debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]" sct oldval ${data} sct update ${data} sct utime readtime } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::aerolas_doppler::setValue {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set par [sct target] set cmd "${cmd_str}${par}" # setValue hook code goes here if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 1 "setValue sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::aerolas_doppler::wrFloat {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "wrFloat tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set par [sct target] set cmd "${cmd_str}${par}" # wrFloat hook code starts set cmd "1:16:${cmd_str}:1:F32:${par}" # wrFloat hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 1 "wrFloat sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::aerolas_doppler::wrULong {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "wrULong tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set par [sct target] set cmd "${cmd_str}${par}" # wrULong hook code starts set cmd "1:16:${cmd_str}:1:U32:${par}" # wrULong hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 1 "wrULong sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } # function to write a parameter value on a device proc ::scobj::aerolas_doppler::wrUShort {tc_root nextState cmd_str} { set catch_status [ catch { debug_log ${tc_root} 1 "wrUShort tc_root=${tc_root} sct=[sct] cmd=${cmd_str}" if { [hpropexists [sct] geterror] } { hdelprop [sct] geterror } set par [sct target] set cmd "${cmd_str}${par}" # wrUShort hook code starts set cmd "1:16:${cmd_str}:1:U16:${par}" # wrUShort hook code ends if { [hpropexists [sct] geterror] } { debug_log ${tc_root} 9 "[sct] error: [sct geterror]" error "[sct geterror]" } if { [hpropexists [sct] driving] } { if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } { sct driving 1 } } debug_log ${tc_root} 1 "wrUShort sct send ${cmd}" if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} { sct send "${cmd}" } return ${nextState} } catch_message ] handle_exception ${catch_status} ${catch_message} } proc ::scobj::aerolas_doppler::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } { ::scobj::aerolas_doppler::sics_log 9 "::scobj::aerolas_doppler::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" set ns "[namespace current]" set catch_status [ catch { MakeSICSObj ${name} SCT_OBJECT sicslist setatt ${name} driver aerolas_doppler sicslist setatt ${name} klass ${device_class} sicslist setatt ${name} long_name ${name} set scobj_hpath /sics/${name} hfactory ${scobj_hpath}/amplitude plain user float hsetprop ${scobj_hpath}/amplitude read ${ns}::getFloat ${scobj_hpath} rdFloat {2} hsetprop ${scobj_hpath}/amplitude rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/amplitude write ${ns}::wrFloat ${scobj_hpath} noResponse {2} hsetprop ${scobj_hpath}/amplitude noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/amplitude check ${ns}::checkrange ${scobj_hpath} hsetprop ${scobj_hpath}/amplitude control true hsetprop ${scobj_hpath}/amplitude data true hsetprop ${scobj_hpath}/amplitude mutable true hsetprop ${scobj_hpath}/amplitude nxsave true hsetprop ${scobj_hpath}/amplitude lowerlimit 0 hsetprop ${scobj_hpath}/amplitude upperlimit 75 hsetprop ${scobj_hpath}/amplitude units mm hsetprop ${scobj_hpath}/amplitude oldval 0.0 hsetprop ${scobj_hpath}/amplitude klass "parameter" hsetprop ${scobj_hpath}/amplitude sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/amplitude type "part" hsetprop ${scobj_hpath}/amplitude nxalias "${name}_amplitude" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/amplitude 1 ${sct_controller} write ${scobj_hpath}/amplitude hsetprop ${scobj_hpath}/amplitude simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/amplitude simulated true } hfactory ${scobj_hpath}/run_cmd plain user int hsetprop ${scobj_hpath}/run_cmd read ${ns}::getUShort ${scobj_hpath} rdUShort {1} hsetprop ${scobj_hpath}/run_cmd rdUShort ${ns}::rdUShort ${scobj_hpath} hsetprop ${scobj_hpath}/run_cmd write ${ns}::wrUShort ${scobj_hpath} noResponse {1} hsetprop ${scobj_hpath}/run_cmd noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/run_cmd check ${ns}::checkrange ${scobj_hpath} hsetprop ${scobj_hpath}/run_cmd control true hsetprop ${scobj_hpath}/run_cmd data true hsetprop ${scobj_hpath}/run_cmd mutable true hsetprop ${scobj_hpath}/run_cmd nxsave true hsetprop ${scobj_hpath}/run_cmd values 0,1 hsetprop ${scobj_hpath}/run_cmd oldval 0 hsetprop ${scobj_hpath}/run_cmd klass "parameter" hsetprop ${scobj_hpath}/run_cmd sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/run_cmd type "part" hsetprop ${scobj_hpath}/run_cmd nxalias "${name}_run_cmd" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/run_cmd 1 ${sct_controller} write ${scobj_hpath}/run_cmd hsetprop ${scobj_hpath}/run_cmd simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/run_cmd simulated true } hfactory ${scobj_hpath}/velocity plain user float hsetprop ${scobj_hpath}/velocity read ${ns}::getFloat ${scobj_hpath} rdFloat {4} hsetprop ${scobj_hpath}/velocity rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/velocity write ${ns}::wrFloat ${scobj_hpath} noResponse {4} hsetprop ${scobj_hpath}/velocity noResponse ${ns}::noResponse ${scobj_hpath} hsetprop ${scobj_hpath}/velocity check ${ns}::checkrange ${scobj_hpath} hsetprop ${scobj_hpath}/velocity control true hsetprop ${scobj_hpath}/velocity data true hsetprop ${scobj_hpath}/velocity mutable true hsetprop ${scobj_hpath}/velocity nxsave true hsetprop ${scobj_hpath}/velocity lowerlimit 0 hsetprop ${scobj_hpath}/velocity upperlimit 4700 hsetprop ${scobj_hpath}/velocity units mm/S hsetprop ${scobj_hpath}/velocity oldval 0.0 hsetprop ${scobj_hpath}/velocity klass "parameter" hsetprop ${scobj_hpath}/velocity sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/velocity type "part" hsetprop ${scobj_hpath}/velocity nxalias "${name}_velocity" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/velocity 1 ${sct_controller} write ${scobj_hpath}/velocity hsetprop ${scobj_hpath}/velocity simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/velocity simulated true } hsetprop ${scobj_hpath} data "true" hsetprop ${scobj_hpath} klass "@none" hsetprop ${scobj_hpath} type "part" hfactory ${scobj_hpath}/read_only plain spy none hfactory ${scobj_hpath}/read_only/arc_state plain user int hsetprop ${scobj_hpath}/read_only/arc_state read ${ns}::getUShort ${scobj_hpath} rdUShort {1017} hsetprop ${scobj_hpath}/read_only/arc_state rdUShort ${ns}::rdUShort ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/arc_state control true hsetprop ${scobj_hpath}/read_only/arc_state data false hsetprop ${scobj_hpath}/read_only/arc_state mutable false hsetprop ${scobj_hpath}/read_only/arc_state nxsave false hsetprop ${scobj_hpath}/read_only/arc_state oldval 0 hsetprop ${scobj_hpath}/read_only/arc_state sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/arc_state type "part" hsetprop ${scobj_hpath}/read_only/arc_state nxalias "${name}_read_only_arc_state" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/arc_state 1 hsetprop ${scobj_hpath}/read_only/arc_state simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/arc_state simulated true } hfactory ${scobj_hpath}/read_only/braking_distance plain user float hsetprop ${scobj_hpath}/read_only/braking_distance read ${ns}::getFloat ${scobj_hpath} rdFloat {1022} hsetprop ${scobj_hpath}/read_only/braking_distance rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/braking_distance control true hsetprop ${scobj_hpath}/read_only/braking_distance data false hsetprop ${scobj_hpath}/read_only/braking_distance mutable false hsetprop ${scobj_hpath}/read_only/braking_distance nxsave false hsetprop ${scobj_hpath}/read_only/braking_distance oldval 0.0 hsetprop ${scobj_hpath}/read_only/braking_distance sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/braking_distance type "part" hsetprop ${scobj_hpath}/read_only/braking_distance nxalias "${name}_read_only_braking_distance" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/braking_distance 1 hsetprop ${scobj_hpath}/read_only/braking_distance simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/braking_distance simulated true } hfactory ${scobj_hpath}/read_only/calc_error_code plain user int hsetprop ${scobj_hpath}/read_only/calc_error_code read ${ns}::getULong ${scobj_hpath} rdULong {1020} hsetprop ${scobj_hpath}/read_only/calc_error_code rdULong ${ns}::rdULong ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/calc_error_code control true hsetprop ${scobj_hpath}/read_only/calc_error_code data false hsetprop ${scobj_hpath}/read_only/calc_error_code mutable false hsetprop ${scobj_hpath}/read_only/calc_error_code nxsave false hsetprop ${scobj_hpath}/read_only/calc_error_code oldval 0 hsetprop ${scobj_hpath}/read_only/calc_error_code sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/calc_error_code type "part" hsetprop ${scobj_hpath}/read_only/calc_error_code nxalias "${name}_read_only_calc_error_code" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/calc_error_code 1 hsetprop ${scobj_hpath}/read_only/calc_error_code simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/calc_error_code simulated true } hfactory ${scobj_hpath}/read_only/continuous_acceleration plain user float hsetprop ${scobj_hpath}/read_only/continuous_acceleration read ${ns}::getFloat ${scobj_hpath} rdFloat {1026} hsetprop ${scobj_hpath}/read_only/continuous_acceleration rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/continuous_acceleration control true hsetprop ${scobj_hpath}/read_only/continuous_acceleration data false hsetprop ${scobj_hpath}/read_only/continuous_acceleration mutable false hsetprop ${scobj_hpath}/read_only/continuous_acceleration nxsave false hsetprop ${scobj_hpath}/read_only/continuous_acceleration oldval 0.0 hsetprop ${scobj_hpath}/read_only/continuous_acceleration sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/continuous_acceleration type "part" hsetprop ${scobj_hpath}/read_only/continuous_acceleration nxalias "${name}_read_only_continuous_acceleration" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/continuous_acceleration 1 hsetprop ${scobj_hpath}/read_only/continuous_acceleration simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/continuous_acceleration simulated true } hfactory ${scobj_hpath}/read_only/maximum_acceleration plain user float hsetprop ${scobj_hpath}/read_only/maximum_acceleration read ${ns}::getFloat ${scobj_hpath} rdFloat {1028} hsetprop ${scobj_hpath}/read_only/maximum_acceleration rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/maximum_acceleration control true hsetprop ${scobj_hpath}/read_only/maximum_acceleration data false hsetprop ${scobj_hpath}/read_only/maximum_acceleration mutable false hsetprop ${scobj_hpath}/read_only/maximum_acceleration nxsave false hsetprop ${scobj_hpath}/read_only/maximum_acceleration oldval 0.0 hsetprop ${scobj_hpath}/read_only/maximum_acceleration sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/maximum_acceleration type "part" hsetprop ${scobj_hpath}/read_only/maximum_acceleration nxalias "${name}_read_only_maximum_acceleration" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/maximum_acceleration 1 hsetprop ${scobj_hpath}/read_only/maximum_acceleration simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/maximum_acceleration simulated true } hfactory ${scobj_hpath}/read_only/move_abs_counter plain user int hsetprop ${scobj_hpath}/read_only/move_abs_counter read ${ns}::getULong ${scobj_hpath} rdULong {1006} hsetprop ${scobj_hpath}/read_only/move_abs_counter rdULong ${ns}::rdULong ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/move_abs_counter control true hsetprop ${scobj_hpath}/read_only/move_abs_counter data false hsetprop ${scobj_hpath}/read_only/move_abs_counter mutable false hsetprop ${scobj_hpath}/read_only/move_abs_counter nxsave false hsetprop ${scobj_hpath}/read_only/move_abs_counter oldval 0 hsetprop ${scobj_hpath}/read_only/move_abs_counter sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/move_abs_counter type "part" hsetprop ${scobj_hpath}/read_only/move_abs_counter nxalias "${name}_read_only_move_abs_counter" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/move_abs_counter 1 hsetprop ${scobj_hpath}/read_only/move_abs_counter simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/move_abs_counter simulated true } hfactory ${scobj_hpath}/read_only/move_amplitude_max plain user float hsetprop ${scobj_hpath}/read_only/move_amplitude_max read ${ns}::getFloat ${scobj_hpath} rdFloat {1010} hsetprop ${scobj_hpath}/read_only/move_amplitude_max rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/move_amplitude_max control true hsetprop ${scobj_hpath}/read_only/move_amplitude_max data false hsetprop ${scobj_hpath}/read_only/move_amplitude_max mutable false hsetprop ${scobj_hpath}/read_only/move_amplitude_max nxsave false hsetprop ${scobj_hpath}/read_only/move_amplitude_max oldval 0.0 hsetprop ${scobj_hpath}/read_only/move_amplitude_max sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/move_amplitude_max type "part" hsetprop ${scobj_hpath}/read_only/move_amplitude_max nxalias "${name}_read_only_move_amplitude_max" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/move_amplitude_max 1 hsetprop ${scobj_hpath}/read_only/move_amplitude_max simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/move_amplitude_max simulated true } hfactory ${scobj_hpath}/read_only/move_amplitude_min plain user float hsetprop ${scobj_hpath}/read_only/move_amplitude_min read ${ns}::getFloat ${scobj_hpath} rdFloat {1008} hsetprop ${scobj_hpath}/read_only/move_amplitude_min rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/move_amplitude_min control true hsetprop ${scobj_hpath}/read_only/move_amplitude_min data false hsetprop ${scobj_hpath}/read_only/move_amplitude_min mutable false hsetprop ${scobj_hpath}/read_only/move_amplitude_min nxsave false hsetprop ${scobj_hpath}/read_only/move_amplitude_min oldval 0.0 hsetprop ${scobj_hpath}/read_only/move_amplitude_min sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/move_amplitude_min type "part" hsetprop ${scobj_hpath}/read_only/move_amplitude_min nxalias "${name}_read_only_move_amplitude_min" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/move_amplitude_min 1 hsetprop ${scobj_hpath}/read_only/move_amplitude_min simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/move_amplitude_min simulated true } hfactory ${scobj_hpath}/read_only/move_error_code plain user int hsetprop ${scobj_hpath}/read_only/move_error_code read ${ns}::getULong ${scobj_hpath} rdULong {1004} hsetprop ${scobj_hpath}/read_only/move_error_code rdULong ${ns}::rdULong ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/move_error_code control true hsetprop ${scobj_hpath}/read_only/move_error_code data false hsetprop ${scobj_hpath}/read_only/move_error_code mutable false hsetprop ${scobj_hpath}/read_only/move_error_code nxsave false hsetprop ${scobj_hpath}/read_only/move_error_code oldval 0 hsetprop ${scobj_hpath}/read_only/move_error_code sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/move_error_code type "part" hsetprop ${scobj_hpath}/read_only/move_error_code nxalias "${name}_read_only_move_error_code" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/move_error_code 1 hsetprop ${scobj_hpath}/read_only/move_error_code simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/move_error_code simulated true } hfactory ${scobj_hpath}/read_only/move_velocity_max plain user float hsetprop ${scobj_hpath}/read_only/move_velocity_max read ${ns}::getFloat ${scobj_hpath} rdFloat {1014} hsetprop ${scobj_hpath}/read_only/move_velocity_max rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/move_velocity_max control true hsetprop ${scobj_hpath}/read_only/move_velocity_max data false hsetprop ${scobj_hpath}/read_only/move_velocity_max mutable false hsetprop ${scobj_hpath}/read_only/move_velocity_max nxsave false hsetprop ${scobj_hpath}/read_only/move_velocity_max oldval 0.0 hsetprop ${scobj_hpath}/read_only/move_velocity_max sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/move_velocity_max type "part" hsetprop ${scobj_hpath}/read_only/move_velocity_max nxalias "${name}_read_only_move_velocity_max" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/move_velocity_max 1 hsetprop ${scobj_hpath}/read_only/move_velocity_max simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/move_velocity_max simulated true } hfactory ${scobj_hpath}/read_only/move_velocity_min plain user float hsetprop ${scobj_hpath}/read_only/move_velocity_min read ${ns}::getFloat ${scobj_hpath} rdFloat {1012} hsetprop ${scobj_hpath}/read_only/move_velocity_min rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/move_velocity_min control true hsetprop ${scobj_hpath}/read_only/move_velocity_min data false hsetprop ${scobj_hpath}/read_only/move_velocity_min mutable false hsetprop ${scobj_hpath}/read_only/move_velocity_min nxsave false hsetprop ${scobj_hpath}/read_only/move_velocity_min oldval 0.0 hsetprop ${scobj_hpath}/read_only/move_velocity_min sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/move_velocity_min type "part" hsetprop ${scobj_hpath}/read_only/move_velocity_min nxalias "${name}_read_only_move_velocity_min" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/move_velocity_min 1 hsetprop ${scobj_hpath}/read_only/move_velocity_min simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/move_velocity_min simulated true } hfactory ${scobj_hpath}/read_only/run_state plain user int hsetprop ${scobj_hpath}/read_only/run_state read ${ns}::getUShort ${scobj_hpath} rdUShort {1001} hsetprop ${scobj_hpath}/read_only/run_state rdUShort ${ns}::rdUShort ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/run_state control true hsetprop ${scobj_hpath}/read_only/run_state data false hsetprop ${scobj_hpath}/read_only/run_state mutable false hsetprop ${scobj_hpath}/read_only/run_state nxsave false hsetprop ${scobj_hpath}/read_only/run_state oldval 0 hsetprop ${scobj_hpath}/read_only/run_state sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/run_state type "part" hsetprop ${scobj_hpath}/read_only/run_state nxalias "${name}_read_only_run_state" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/run_state 1 hsetprop ${scobj_hpath}/read_only/run_state simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/run_state simulated true } hfactory ${scobj_hpath}/read_only/velocity_ratio plain user float hsetprop ${scobj_hpath}/read_only/velocity_ratio read ${ns}::getFloat ${scobj_hpath} rdFloat {1024} hsetprop ${scobj_hpath}/read_only/velocity_ratio rdFloat ${ns}::rdFloat ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/velocity_ratio control true hsetprop ${scobj_hpath}/read_only/velocity_ratio data false hsetprop ${scobj_hpath}/read_only/velocity_ratio mutable false hsetprop ${scobj_hpath}/read_only/velocity_ratio nxsave false hsetprop ${scobj_hpath}/read_only/velocity_ratio oldval 0.0 hsetprop ${scobj_hpath}/read_only/velocity_ratio sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/velocity_ratio type "part" hsetprop ${scobj_hpath}/read_only/velocity_ratio nxalias "${name}_read_only_velocity_ratio" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/velocity_ratio 1 hsetprop ${scobj_hpath}/read_only/velocity_ratio simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/velocity_ratio simulated true } hfactory ${scobj_hpath}/read_only/version_number plain user int hsetprop ${scobj_hpath}/read_only/version_number read ${ns}::getUShort ${scobj_hpath} rdUShort {1019} hsetprop ${scobj_hpath}/read_only/version_number rdUShort ${ns}::rdUShort ${scobj_hpath} hsetprop ${scobj_hpath}/read_only/version_number control true hsetprop ${scobj_hpath}/read_only/version_number data false hsetprop ${scobj_hpath}/read_only/version_number mutable false hsetprop ${scobj_hpath}/read_only/version_number nxsave false hsetprop ${scobj_hpath}/read_only/version_number oldval 0 hsetprop ${scobj_hpath}/read_only/version_number sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_only/version_number type "part" hsetprop ${scobj_hpath}/read_only/version_number nxalias "${name}_read_only_version_number" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_only/version_number 1 hsetprop ${scobj_hpath}/read_only/version_number simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_only/version_number simulated true } hsetprop ${scobj_hpath}/read_only data "false" hsetprop ${scobj_hpath}/read_only klass "@none" hsetprop ${scobj_hpath}/read_only type "part" hfactory ${scobj_hpath}/read_write plain spy none hfactory ${scobj_hpath}/read_write/move_profile plain user int hsetprop ${scobj_hpath}/read_write/move_profile read ${ns}::getUShort ${scobj_hpath} rdUShort {7} hsetprop ${scobj_hpath}/read_write/move_profile rdUShort ${ns}::rdUShort ${scobj_hpath} hsetprop ${scobj_hpath}/read_write/move_profile control true hsetprop ${scobj_hpath}/read_write/move_profile data false hsetprop ${scobj_hpath}/read_write/move_profile mutable false hsetprop ${scobj_hpath}/read_write/move_profile nxsave false hsetprop ${scobj_hpath}/read_write/move_profile values 0,1 hsetprop ${scobj_hpath}/read_write/move_profile oldval 0 hsetprop ${scobj_hpath}/read_write/move_profile sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_write/move_profile type "part" hsetprop ${scobj_hpath}/read_write/move_profile nxalias "${name}_read_write_move_profile" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_write/move_profile 1 hsetprop ${scobj_hpath}/read_write/move_profile simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_write/move_profile simulated true } hfactory ${scobj_hpath}/read_write/te_ok_cycles plain user int hsetprop ${scobj_hpath}/read_write/te_ok_cycles read ${ns}::getULong ${scobj_hpath} rdULong {8} hsetprop ${scobj_hpath}/read_write/te_ok_cycles rdULong ${ns}::rdULong ${scobj_hpath} hsetprop ${scobj_hpath}/read_write/te_ok_cycles control true hsetprop ${scobj_hpath}/read_write/te_ok_cycles data false hsetprop ${scobj_hpath}/read_write/te_ok_cycles mutable false hsetprop ${scobj_hpath}/read_write/te_ok_cycles nxsave false hsetprop ${scobj_hpath}/read_write/te_ok_cycles oldval 0 hsetprop ${scobj_hpath}/read_write/te_ok_cycles sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_write/te_ok_cycles type "part" hsetprop ${scobj_hpath}/read_write/te_ok_cycles nxalias "${name}_read_write_te_ok_cycles" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_write/te_ok_cycles 1 hsetprop ${scobj_hpath}/read_write/te_ok_cycles simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_write/te_ok_cycles simulated true } hfactory ${scobj_hpath}/read_write/te_ok_time plain user int hsetprop ${scobj_hpath}/read_write/te_ok_time read ${ns}::getULong ${scobj_hpath} rdULong {10} hsetprop ${scobj_hpath}/read_write/te_ok_time rdULong ${ns}::rdULong ${scobj_hpath} hsetprop ${scobj_hpath}/read_write/te_ok_time control true hsetprop ${scobj_hpath}/read_write/te_ok_time data false hsetprop ${scobj_hpath}/read_write/te_ok_time mutable false hsetprop ${scobj_hpath}/read_write/te_ok_time nxsave false hsetprop ${scobj_hpath}/read_write/te_ok_time oldval 0 hsetprop ${scobj_hpath}/read_write/te_ok_time sdsinfo "::nexus::scobj::sdsinfo" hsetprop ${scobj_hpath}/read_write/te_ok_time type "part" hsetprop ${scobj_hpath}/read_write/te_ok_time nxalias "${name}_read_write_te_ok_time" if {[string equal -nocase "${simulation_flag}" "false"]} { ${sct_controller} poll ${scobj_hpath}/read_write/te_ok_time 1 hsetprop ${scobj_hpath}/read_write/te_ok_time simulated false } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for aerolas_doppler" hsetprop ${scobj_hpath}/read_write/te_ok_time simulated true } hsetprop ${scobj_hpath}/read_write data "false" hsetprop ${scobj_hpath}/read_write klass "@none" hsetprop ${scobj_hpath}/read_write type "part" hsetprop ${scobj_hpath} driver aerolas_doppler hsetprop ${scobj_hpath} klass ${device_class} hsetprop ${scobj_hpath} data true hsetprop ${scobj_hpath} debug_threshold 5 # mkDriver hook code goes here } catch_message ] handle_exception ${catch_status} ${catch_message} } proc ::scobj::aerolas_doppler::add_driver {name device_class simulation_flag ip_address tcp_port} { set catch_status [ catch { ::scobj::aerolas_doppler::sics_log 9 "::scobj::aerolas_doppler::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" if {[string equal -nocase "${simulation_flag}" "false"]} { if {[string equal -nocase "aqadapter" "${ip_address}"]} { ::scobj::aerolas_doppler::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}" makesctcontroller sct_${name} aqadapter ${tcp_port} } else { ::scobj::aerolas_doppler::sics_log 9 "makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}" makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port} } } else { ::scobj::aerolas_doppler::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for aerolas_doppler" ::scobj::aerolas_doppler::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" makesctcontroller sct_${name} aqadapter NULL } ::scobj::aerolas_doppler::sics_log 1 "::scobj::aerolas_doppler::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}" ::scobj::aerolas_doppler::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} } catch_message ] handle_exception ${catch_status} ${catch_message} } namespace eval ::scobj::aerolas_doppler { namespace export debug_threshold namespace export debug_log namespace export sics_log namespace export mkDriver namespace export add_driver } proc add_aerolas_doppler {name ip_address tcp_port} { set simulation_flag "[string tolower [SplitReply [motor_simulation]]]" ::scobj::aerolas_doppler::add_driver ${name} "instrument" ${simulation_flag} ${ip_address} ${tcp_port} } clientput "file evaluation of sct_aerolas_doppler.tcl" ::scobj::aerolas_doppler::sics_log 9 "file evaluation of sct_aerolas_doppler.tcl" proc ::scobj::aerolas_doppler::read_config {} { set catch_status [ catch { set ns "::scobj::aerolas_doppler" dict for {k u} $::config_dict { if { [dict exists $u "implementation"] } { set simulation_flag "[string tolower [SplitReply [motor_simulation]]]" set device_class "instrument" if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } { continue } set enabled [string tolower [dict get $u "enabled"]] if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } { continue } if { [dict exists $u "simulation_group"] } { set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]] } if { [dict exists $u "device_class"] } { set device_class "[dict get $u "device_class"]" } set name [dict get $u name] set implementation [dict get $u "implementation"] if { !([dict exists $::config_dict $implementation]) } { continue } set v [dict get $::config_dict $implementation] if { !([dict exists $v "driver"]) } { continue } if { [string equal -nocase [dict get $v "driver"] "aerolas_doppler"] } { if { ![string equal -nocase "${simulation_flag}" "false"] } { set asyncqueue "null" ${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue" ${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL" makesctcontroller sct_${name} aqadapter NULL } elseif { [dict exists $v "asyncqueue"] } { set asyncqueue [dict get $v "asyncqueue"] if { [string equal -nocase ${asyncqueue} "sct"] } { set ip_address [dict get $v ip] set tcp_port [dict get $v port] makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port} } else { makesctcontroller sct_${name} aqadapter ${asyncqueue} } } else { if { [dict exists $v "asyncprotocol"] } { set asyncprotocol [dict get $v "asyncprotocol"] } else { set asyncprotocol ${name}_protocol MakeAsyncProtocol ${asyncprotocol} if { [dict exists $v "sendterminator"] } { ${asyncprotocol} sendterminator "[dict get $v "sendterminator"]" } elseif { [dict exists $v "terminator"] } { ${asyncprotocol} sendterminator "[dict get $v "terminator"]" } if { [dict exists $v "replyterminator"] } { ${asyncprotocol} replyterminator "[dict get $v "replyterminator"]" } elseif { [dict exists $v "terminator"] } { ${asyncprotocol} replyterminator "[dict get $v "terminator"]" } } set asyncqueue ${name}_queue set ip_address [dict get $v ip] set tcp_port [dict get $v port] MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port} if { [dict exists $v "timeout"] } { ${asyncqueue} timeout "[dict get $v "timeout"]" } makesctcontroller sct_${name} aqadapter ${asyncqueue} } ${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} } } } } catch_message ] handle_exception ${catch_status} ${catch_message} } if { [info exists ::config_dict] } { ::scobj::aerolas_doppler::read_config } else { ::scobj::aerolas_doppler::sics_log 5 "No config dict" }