This is an old revision of the document!


Host Connection Status

After building a GEM Host in TransSECS you can register to receive the current status of the connection:

    host.addConnectionStatusListener(new ConnectionStatusListener() {
 
      @Override
      public void connectionStatusChanged(int connectionStatus, String comment) {
         System.out.println ("Current Connection Status " + connectionStatus + " Status String \"" + comment + "\"");        
      }
    });

TransSECS GEM Host Connection States

JavaScript Example for MIStudio/TransSECS

Trigger this script at startup. This script pushes data to two BroadcastServers (StatusListenerCommand and StatusListenerValue) whenever there is a connection status change.

 //sets up a listener to handle connection status changes
 var TransSecsController = Java.type("com.ergotech.transsecs.secs.TransSecsController");
 var ConnectionStatusListener = Java.type("com.ergotech.transsecs.secs.host.ConnectionStatusListener");
 
 
 var statusListener  = new ConnectionStatusListener() {
    connectionStatusChanged : function(connectionStatus,comment) {
      print ("Current Connection Status " + connectionStatus + " Status String \"" + comment + "\"");    
      StatusListenerComment->setStringValue(comment);
      StatusListenerValue->setIntValue(connectionStatus);    
     }
  }
 
 host=TransSecsController.findController("GEMHost");     //use  your GEM Host name 
 host.addConnectionStatusListener(statusListener);
  • host_connection_status.1618359078.txt.gz
  • Last modified: 2021/04/13 19:11
  • by wikiadmin