transsecscriptingmethodlist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
transsecscriptingmethodlist [2024/11/17 13:40]
wikiadmin
transsecscriptingmethodlist [2024/11/17 14:42] (current)
wikiadmin
Line 1: Line 1:
 =====List of Common TransSECS Scripting Methods===== =====List of Common TransSECS Scripting Methods=====
  
-This is a quick reference to the methods in the SECS/GEM (TransSECS) API to do common operations on the tool or host instances and their ids (SVIDs,DVIDs,ECIDs,CEIDs, and ALIDs). More extensive examples can be found using the wiki search (search for the method name for more examples). Short examples below are highlighted in a "note" box+This is a quick reference to the methods in the SECS/GEM (TransSECS) API to do common operations on the tool or host instances and their ids (SVIDs,DVIDs,ECIDs,CEIDs, and ALIDs). More extensive examples can be found using the wiki search (search for the method name for more examples). Short examples below are highlighted in a "code" box.
- +
-<note tip>Example: (brief example code)</note>+
  
 ====Common Declarations==== ====Common Declarations====
  
-Be sure to declare the classes used from the API so you can reference these by name in the code.+Be sure to declare the classes used from the API so you can reference these by name in the code. Here are some examples of classes you may want to use:
  
 +<code javascript>
 +var DataSource = Java.type('com.ergotech.vib.servers.DataSource');
 +var LongValueObject = Java.type('com.ergotech.vib.valueobjects.LongValueObject');
 var TransSecsController = Java.type('com.ergotech.transsecs.secs.TransSecsController'); var TransSecsController = Java.type('com.ergotech.transsecs.secs.TransSecsController');
 +var SOFTREV =  Java.type('com.ergotech.secs.SOFTREV');
 +</code>
 +
 +====SOFTREV====
 +
 +SOFTREV is a class in the SECS/GEM package which has a maxLength parameter you can set to allow 20 character SOFTREV and MDLN values
 +
 +<code javascript>
 +SOFTREV.maxLength=20; //allows 20 chars for both MDLN and SoftRev values (otherwise maximum is 6)
 +</code>
  
 ====TransSECSController==== ====TransSECSController====
  
-used to get the running tool or host instance:+TransSECSController is used to get the single running tool or host instance:
  
 TransSecsController.getSingleController() TransSecsController.getSingleController()
  
  
-<note tip+<code javascript
-tool = TransSecsController.getSingleController();</note>+tool = TransSecsController.getSingleController(); 
 +</code>
  
 with the tool instance you can do these operations: with the tool instance you can do these operations:
  
-<note tip>status = tool.getWrapper(1).toString(); //get the connection status of the tool +<code javascript> 
-gemHandler =  tool.getGemHandler(); //get the gemHandler to access ids and data sources</note>+status = tool.getWrapper(1).toString(); //get the connection status of the tool for display 
 +gemHandler =  tool.getGemHandler(); //get the gemHandler to access ids and data sources 
 +</code>
  
 +There are also some methods you can use on the tool instance:
 +
 +<code javascript>
 +tool.setDeviceId(2); //immediately change the device id to 2
 +tool.setPort(5000); //immediately change the HSMS port to 5000
 +</code>
  
 ====GemHandler==== ====GemHandler====
  
-with the gemHandler you can do these operations:+With the gemHandler you can access the id servers in the tool to set or get values
  
-//get the server for an event (CEID) so you can trigger the event+<code javascript> 
 +eventServer = gemHandler.getServerForName("CEID.STARTED"); //get the server for an event id (CEID) by name 
 +vidServer = gemHandler.getServerForName("VID.ProcessState"); //get the the server for a vid by name
  
-event = gemHandler.getServerForName("CEID.STARTED");+//example to trigger an event 
 +eventServer.setIntValue(1); //trigger the CEID.STARTED event
  
 +//directly set values to vids using the gemHandler
 +gemHandler.setValue("OnlineOfflineState",new LongValueObject(1));//Go ONLINE 
 +gemHandler.setValue("LocalRemoteState",new LongValueObject(1)); //Go REMOTE, now the tool should respond to host messages
 +
 +//access vid values
 +controlState = gemHandler.getServerForName("VID.ControlState").getIntValue();
 +
 +</code>
  
-var DataSource = Java.type('com.ergotech.vib.servers.DataSource'); 
-var DataSourceContainer = Java.type('com.ergotech.vib.utils.DataSourceContainer'); 
-//var BroadcastServer = Java.type('com.ergotech.vib.manipulators.BroadcastServer'); 
-var TransSecsController = Java.type('com.ergotech.transsecs.secs.TransSecsController'); 
-var LongValueObject = Java.type('com.ergotech.vib.valueobjects.LongValueObject'); 
-var StringValueObject = Java.type('com.ergotech.vib.valueobjects.StringValueObject'); 
-var ArrayValueObject = Java.type('com.ergotech.vib.valueobjects.ArrayValueObject'); 
-var ValueChangedEvent = Java.type('com.ergotech.vib.valueobjects.ValueChangedEvent'); 
-var Thread = Java.type('java.lang.Thread'); 
-var Runnable = Java.type('java.lang.Runnable'); 
  
-var List = Java.type('java.util.List'); 
-// Key used for encryption and decryption 
-var JavaString = Java.type("java.lang.String"); 
-var Files = Java.type("java.nio.file.Files"); 
-var Paths = Java.type("java.nio.file.Paths"); 
-var SecretKeySpec = Java.type("javax.crypto.spec.SecretKeySpec"); 
-var Cipher = Java.type("javax.crypto.Cipher"); 
-var Base64 = Java.type("java.util.Base64"); 
-var keyString = "8130506977724182"; // Ensure this is 16 bytes for AES 
-var key = new SecretKeySpec(keyString.getBytes("UTF-8"), "AES"); 
-//properties file 
-var Properties = Java.type('java.util.Properties'); 
-var FileInputStream = Java.type('java.io.FileInputStream'); 
-var FileOutputStream = Java.type('java.io.FileOutputStream'); 
  
  • transsecscriptingmethodlist.1731872407.txt.gz
  • Last modified: 2024/11/17 13:40
  • by wikiadmin