//============================================================================= // THE "Interactive Data Language (IDL)"-"Tango" HOWTO - RELEASE 0.1 //============================================================================= 1 - From the author 2 - Installing 3 - Using TANGO within IDL //============================================================================= // 1 - NOTE FROM THE AUTHOR //============================================================================= This is a TANGO usage howto for IDL (v6.0 up). IDL, the Interactive Data Language, is a software package for data analysis, visualization, and cross-platform application development. IDL now comes from: "ITT - Visual Information Solutions", http://www.ittvis.com (formerly from RSInc, www.RSInc.com) The IDL-Java bridge gives user access to any device within a TANGO control system from the IDL environment. This HowTo rely on the following environment: a) WinXP/Version2002/SP2, Win2000/SP4 b) IDL 6.0/6.1/6.3 c) Tango 4.9.2 Please send bug report, suggestion or comment to the TANGO mailing list, or directly to the author. Have fun with TANGO under IDL. Alessandro Abrami - Synchrotron ELETTRA. //============================================================================= // 2 - Installing //============================================================================= Having installed IDL and Tango there is no special installation process. You may choose between two methods: 2.1 Environment Variable Just update the CLASSPATH environment variable: choose (My Computer)->Properties->Advanced->Environment Variables edit and/or add a User or System variable: Variable : CLASSPATH Variable Value: path-to-tango-java-installdir\TangORB-4.9.2.jar This rely on the presence of the CLASSPATH variable in the 'idljavabrc' configuration file distributed with IDL 2.2 rc file Just update the IDL-java bridge configuration file: idljavabrc, located in the directory: %InstallationDisk%\RSI\IDL63\resource\bridges\import\java (or %InstallationDisk%\RSI\IDL60\external\objbridge\java). You should add the TangORB-X.X.X.jar file location for the java virtual machine called from within IDL, adding it to the classpath, like: idljavabrc: ..... ########################## # Java CLASSPATH setting ########################## # # # This setting determines how the IDL-Java bridge finds its java classes. ..... # Allow IDL-Java bridge to use .class files located in my CLASSPATH and also the # classes found in the examples .jar file shipped with the bridge JVM Classpath = F:\RSI\\IDL63\resource\bridges\import\java\jbexamples.jar;D:\jTango\TangORB-4.9.2.jar ..... //============================================================================= // 3 - Using TANGO within IDL //============================================================================= 3.1 Documentation Tango may be used within IDL due to the IDL-java bridge that comes with IDL, see the on-line help (IDL 6.3) under: IDL Help--> -->Programmer's Guides--> -->IDL Connectivity Bridges--> -->Importing into IDL--> -->Using Java Objects in IDL 3.2 Example 1 Let's start the usual companion that comes with the Tango distribution: tangotest test -ORBendPoint giop:tcp::10000 -file=tangotest.dat with: tangotest.dat ------------------------------------------------------------------------------- tangotest/test/DEVICE/TangoTest: "1/2/3" ############################################# # CLASS TangoTest CLASS/TangoTest->ProjectTitle: "TANGO Device Server for testing generic clients" CLASS/TangoTest->Description: "A device to test generic clients." # CLASS TangoTest attribute properties # DEVICE 1/2/3 properties # DEVICE 1/2/3 attribute properties ------------------------------------------------------------------------------- now type in the IDL command line window: dev=OBJ_NEW("IDLJavaObject$FR_ESRF_TANGOAPI_DEVICEPROXY","fr.esrf.TangoApi.DeviceProxy", "tango://localhost:10000/1/2/3#dbase=no") and then: print, "ping time ", dev->ping(), " us" that's all, you have already used a Tango-DS under IDL! 3.3 Example 2 Create a file, name it (for instance tangotest.pro), ".pro" is the IDL extension for procedures, and fill in with the following code: tangotest.pro code: ------------------------------------------------------------------------------- pro TANGOTEST dev=OBJ_NEW("IDLJavaObject$FR_ESRF_TANGOAPI_DEVICEPROXY",$ "fr.esrf.TangoApi.DeviceProxy", $ "tango://localhost:10000/1/2/3#dbase=no") print a=dev->ping() print, "ping time ", a, " us" print devinfo = dev->info() devinfo->GetProperty, dev_class=dev_class print, "dev_class: ", dev_class devinfo->GetProperty, server_id=server_id print, "server_id: ", server_id devinfo->GetProperty, server_host=server_host print, "server_host: ", server_host devinfo->GetProperty, doc_url=doc_url print, "doc_url: ", doc_url print data = dev->command_inout("Status") status = data->extractString() print, "Status : ", status print print, "------------- ATTRIBUTES -------------------------" print attr_list = dev->get_attribute_list() print, "attr_list, # of elements : ", n_elements(attr_list) print attr_info = dev->get_attribute_info() print, "attr_info, # of elements : ", n_elements(attr_info) print print, " attr_info name _____________ attr_info description " for i=0 , n_elements(attr_info)-1 do begin attr_info[i]->GetProperty, name=name attr_info[i]->GetProperty, description=description print, i, " ", name, " - - - ", description endfor print print, "------------- ATTRIBUTES -------------------------" print attr=dev->read_attribute("short_scalar_ro") attr_name=attr->getName() print, "attr_name : ", attr_name attr_type=attr->getType() print, "attr_type : ", attr_type attr_value=attr->extractShort() print, "short_scalar_ro value : ", attr_value print attr=dev->read_attribute("long_scalar") attr_name=attr->getName() print, "attr_name : ", attr_name attr_type=attr->getType() print, "attr_type : ", attr_type attr_value=attr->extractLong() print, "long_scalar value : ", attr_value print print, "------------- ATTRIBUTES SPECTRUM -------------------------" print attr=dev->read_attribute("short_spectrum") attr_name=attr->getName() print, "attr_name : ", attr_name attr_type=attr->getType() print, "attr_type : ", attr_type attr_values=attr->extractShortArray() print, "short_spectrum values : ", attr_values print attr=dev->read_attribute("double_spectrum") attr_name=attr->getName() print, "attr_name : ", attr_name attr_type=attr->getType() print, "attr_type : ", attr_type attr_values=attr->extractDoubleArray() print, "double_spectrum values : ", attr_values print print, "------------- ATTRIBUTES IMAGE -------------------------" print attr=dev->read_attribute("short_image") attr_name=attr->getName() print, "attr_name : ", attr_name attr_type=attr->getType() print, "attr_type : ", attr_type imageDimX = attr->getDimX() imageDimY = attr->getDimY() print, "DimX : ", imageDimX print, "DimY : ", imageDimY print attr_info=dev->get_attribute_info("short_image") attr_info->GetProperty, data_format=data_format print, "short_image data_format : ", data_format->value() attr_values=attr->extractShortArray() print, "short_spectrum values, # of elements : ", n_elements(attr_values) ; now from 1-dim to 2-dim : image=reform(attr_values, imageDimX, imageDimY) ;rescale image levels: scaledImage=bytscl(image) tv, scaledImage end ------------------------------------------------------------------------------- Open it within IDL, compile ('Run-Compile tangotest.pro', Ctrl-F5) and run it ('Run-Run tangotest", F5) In the "Output Log" window of IDL you will see the responses from the tangotest-DS, and at the end a new window will appear with the simulated beam coming from the same ds.