Site Map   
 

 

 

Overview - Remote Control

 

Under revision

 

What is Remote Control in daVinci?  
 
Remote Control in daVinci Script means execution of a portion of the current script on a remote machine.

This possibility is almost a requirement while dealing with distributed environments, so a lot of efforts have been made in order to make this function as versatile and efficient as possible.

Communication channels
A remote unit can be controlled in a number of ways, depending on the currently available connections:
- ActiveSync between PC and mobile units (in both directions).
- Local Network between PC/mobile units and PC/mobile units.
- Internet-CGI between PC/mobile units and Windows Servers.
- Internet-FTP between PC/mobile units and PC/mobile units.

Security and privacy
During installation of daVinci Script the user is asked to provide a Main Security Password to be used in all communication to and from remote units.
It means that all the items exchanged between remote units during Remote Control (embedded scripts and answers) will travel across the communication channels in encrypted form.
 
  It means also that only units installed with the same Main Security Password will be able to communicate with each other, leaving no room for accidental or malicious interference from unauthorized units.

Addressed communication
A unit that wanting to be remotely controlled by another unit must always provide an identification string, called Remote ID, which uniquely identifies it. When the controlling unit needs to send script code to a remote unit, the ID of the addressed unit must be specified.

This makes it possible to have an indefinite number of remote units, all connected to the same controlling unit through any one of the available channels, and all provided with the same Main Security Password.
The controlling unit will then be able to separately control each one of the connected remote units, receiving individual answers from each one of them.
 
 

 

Scenarios  
  Remote Control can be very useful in a various number of circumstances. Below a few examples:

1. When the software needed for certain data processing is only found in remote computers. One can let the remote computers to collect
    and process the data, and then retrieve the narrowed results only.

2. When the remote computer is much faster, so it is convenient to process the data there. Typical would be processing of images
    originated by a mobile units.

3. When the data needed can only be accessed by the remote computers. For instance, when a user, which is working on a mobile unit,
    needs to publish on a web site images or documents located on a remote machine local network.

4. When several remote units need to be controlled in a wide number of different ways, as in the example below:
We think a situation where a large number of users are connected with their mobile units to the Internet, or to the same local network, as shown below:

With daVinciMob running in standby mode in the mobile units, an administrator could take control over the units by sending to them individually addressed scripts.
A wide number of tasks could be accomplished, like the following:
- Distribution or collection of any type of documents, reports, databases etc.
- Installation of new software.
- Upgrading of existing software (with possibly restart of the unit through a soft reset).
- Removing of existing software.
- Changing of mode of work in the mobile unit (by modifying the Registry).
- Retrieving of status information (like GPS data).
- Displaying of messages or contents of text files or web pages on the mobile screens.
- Asking of questions to the mobile operator in real time.
- Launching of any kind of activity on the mobile units (any number of applications can be started by the same script).
And many, many more.

The nice thing in this scenario is that the remote units do not need to be prepared in other way than by put them in standby mode.
They are like clean sheets, everything is decided by the administrator through the scripts, which can be changed at any time and in any possible way.
 
It would also be possible to change the current standby mode in the remote units, for instance replace the FTP server used in the remote communication or shift the communication channel between the Internet and the local network.
This can be accomplished by sending a script that launches a new instance daVinciMob (in a new standby mode) and then kills the current instance (through an Exit statement). 

 

 

How it works  
  Basically a portion of the script currently being executing on the local machine is extracted and sent to the remote machine for execution there. The script portion shall be embedded in-between BeginRemote() and EndRemote() commands, as shown by the example below:
...statements executed on the local machine...

BeginRemote( ...arguments... )
   ...statements to be executed on the remote machine...
EndRemote( ...arguments... )

...more statements to be executed locally...

Once the EndRemote statement is detected, the script portion is sent to the target machine and executed there.
If the keyword Wait is defined in the statement (EndRemote(Wait)), daVinci waits for execution completion on the remote machine before proceeding (synchronous mode); if not, it continues execution immediately (asynchronous mode).
 
In synchronous mode, any variable set on the remote side is returned to the originator unit, where it can be used as if it was created locally. Also, any error reported by the remote unit is sent back and can be displayed on the originator screen, as if it was generated by the originator machine.
Note however that function definitions are not transferred during Remote Control; functions defined on the local unit are only available on the local unit, and the same apply for the remote units too. See the example below:
Function( MyFunc )     # 'MyFunc' is only available on the originator machine
   ...statements...
EndFunction

BeginRemote( Mobile )
   Function( MyFunc )  # Alternative definition of 'MyFunc' on the remote machine (no name conflict)
      ...statements...
   EndFunction

   MyFunc              # Execute remotely defined function

EndRemote( Wait )

MyFunc                 # Execute locally defined function

Please see also in Functions - Remote Control the details about the remote commands.
 

 

Modes of work  
  Remote Control can be done in a number of different ways, depending on the type of machine on which the original script runs (originator), the target machine (executor) and the used communication channel.
Below a list over all the available modes of work:
 
 
 
 
1. Remote control through the local network
When running on a PC or mobile unit connected to a local network, daVinci can make other units unit connected to the same network to execute the embedded script.
Requirements:
- All the remote units must be running with daVinci or daVinciMob in standby mode.
 
 
 
 
 
2. Remote control of a mobile unit from a PC
When running on a PC connected to a Windows Mobile unit, daVinci can make the mobile unit to execute the embedded script.
Requirements:
- daVinciMob must be installed on the mobile unit. Since the unit in this case acts as a server, daVinciMob does not need to be running in standby mode.
 
 
 
 
 
3. Remote control of a PC from a mobile unit
When running on a Windows Mobile unit connected to a PC, daVinciMob can make the PC to execute the embedded script.
Requirements:
- daVinci must be installed and running in standby mode on PC side.
 
 
 
 
 
4. Remote control of a Windows Server from a mobile unit or a PC
While online, a PC or a Windows Mobile unit can make a Windows server to execute the embedded script, according to the permissions currently defined for the particular user on server side.
Requirements:
- The CGI application daVinciSrv must be installed on server side.
 
 
 
 
 
5. Remote full-rights control of a Windows server from a mobile unit or a PC
While online, a PC or a Windows Mobile unit can make a Windows server to execute the embedded script with full capabilities (no server restrictions).
Requirements:
- Both daVinciSrv and daVinciAdv must be installed on server side, and daVinciAdv must be running in standby mode.
 
 
 
 
 
6. Remote control of different PC and mobile units from a PC or mobile unit through a Windows server
While online, a PC or a Windows Mobile unit can send through a Windows server the embedded script to a remote PC or remote mobile unit.
If different remote units are to be controlled, an identification code can be defined for each one of them.
Requirements:
- The CGI application daVinciSrv must be installed on server side.
- All daVinci applications on the remote units (daVinci and daVinciMob) must be running in standby mode.
 
 
 
 
 
7. Remote control of different PC or mobile units from a PC or mobile unit through an FTP server
While online, a PC or a Windows Mobile unit can send through an FTP server (of any kind) the embedded script to a remote PC or remote mobile unit.
If different remote units are to be controlled, an identification code can be defined for each one of them.
Requirements:
- All daVinci applications on the remote units (daVinci and daVinciMob) must be running in standby mode.
 

 

Embedding remote scripts  
  It is also possible to embed remote scripts inside other remote scripts, as shown by the following example.
The task performed in the example has no practical meaning, its only purpose is to illustrate how nesting of remote scripts works.

BeginRemote( Cgi( "www.myserver.org" "cgi-bin" "davincisrv" ) )
   BeginRemote( Local( "\\My PC\Remote Scripts" ) )
      BeginRemote( Ftp( "ftp.company.com" "admin" "pswd" "remote_scripts" ) )
         BeginRemote( Mobile )
            GetSerialNumber( @Serial )
         EndRemote( Wait )
      EndRemote( Wait )
   EndRemote( Wait )
EndRemote( Wait(120) ) # Wait up to 2 minutes

Print( "PDA serial number: %Serial%" )

The above code is all you need in order to retrieve from the mobile unit on the right side its serial number and return it to the PC on the left side.

Please see in Example of embedded remote scripts the details about this example.
 

 

Reciprocal control  
  You can also choose to have all of your units running in standby mode. This way, no matter of which machine you approach, you will always be able to control all the others without restrictions.

 

 

   
Produced by Carso  |  Last update: 2010-04-12