This is an example for setting up remote desktop and file transfer for an asset in Thingworx Utilities using the Java Edge SDK.

 

Step 1.   EMS Configuration

 

ClientConfigurator config = new ClientConfigurator();

 

// application key RemoteAccessThingKey

String appKey = "s2ad46d04-5907-4182-88c2-0aad284f902c";

config.setAppKey(appKey);

 

// Thingworx server Uri

config.setUri("wss://10.128.49.63:8445//Thingworx/WS");

config.ignoreSSLErrors(true);

config.setReconnectInterval(15);

SecurityClaims claims = SecurityClaims.fromAppKey(appKey);

config.setSecurityClaims(claims);

      

// enable tunnels for the EMS

config.tunnelsEnabled(true);

 

// initialize a virtual thing with identifier PTCDemoRemoteAccessThing

VirtualThing myThing = new VirtualThing(ThingName, "PTCDemoRemoteAccessThing", "PTCDemoRemoteAccessThing", client);

 

**// for the file transfer functionality

FileTransferVirtualThing myThing = new FileTransferVirtualThing(ThingName, "PTCDemoRemoteAccessThing", "PTCDemoRemoteAccessThing", client);

myThing.addVirtualDirectory("AssetRepo""E:/AssetRepo");

 

Step 2.   Install TightVNC on the asset ( http://www.tightvnc.com/download.php )

 

Step 3.   Go to Thingworx Composer, search for thing PTCDemoRemoteAccessThing

                a.   pair  PTCDemoRemoteAccessThing with identifier PTCDemoRemoteAccessThing

                b.   go to PTCDemoRemoteAccessThing Configuration  and add a tunnel

      • name: vnc
      • host: asset IP
      • port: 5900 (this is the default port for VNC servers; it can be changed)

                c.   go to PTCDemoRemoteAccessThing Properties and set the vncPassword

 

Troubleshooting

                If the VNC server is on the same machine with the Thingworx server, check “Allow loopback connections” from Access Control tab in TightVNC Server Configuration.