GalepX Remote Control

The GalepX software can be remote controlled by script files or by user applications. All functions of the user interface, like loading and saving projects, programming or deleting devices, or setting device flags are accessible to other processes through script commands.

While the GALEP-5 oder GALEP-5D device is controlled by the GalepX software through a USB or LAN connection, the GalepX software itself can be controlled through a TCP socket. The user interface can be completely switched off with a command line parameter, allowing to run GALEP as a continous stand alone programmer without user interaction.

GalepX Software (GUI or Server Mode)





Remote Control Script



During a remote session, the script commands are executed by GalepX's script interpreter. Any output is sent back through the remote control channel. The script syntax follows ANSI C, with some differences. Pointers are not supported, but some C++ elements, such as exceptions, are supported.

GalepX Server Mode

When the user interface is not needed, the GalepX software can be started in server mode. In this mode, GALEP is only controlled by script commands. For running GalepX in server mode, start it out of its folder with the following command line options:

galepX.exe -q -c mdma-noui.config

It's then running as a server process, accepting socket commands. You can terminate it through the gxExit command or manually in the process list of the task manager.

Remote Control - Batch Mode

There are several ways to send script commands to GalepX: By directly connecting to the GalepX socket, by using the remote.dll library functions, or through batch files with the help remoteX.exe or remote.exe. For new projects we strongly recommend to use remoteX.exe because remote.exe is only available for compatibility reasons and will be not longer supported in the future. The usage is approximately equal except for some details. remoteX.exe is a console application without GUI.

The program remote(X).exe is provided for sending commands to GalepX through a batch file under Windows; the remote bash script serves the same purpose under Linux. The command lines:

remote test.gxs test.log or
remoteX test.gxs test.log

reading commands from the script file test.gxs, sends them to GalepX, and stores the output in the test.log file. If the name of the log file is omitted, the output is displayed in a window, as shown below. This way remote command scripts can be easily tested.



The remote.exe program and its lite-C source code (remote.c), as well as an archive with the remote bash script and example scripts can be found in the remote subfolder (see Batch Mode for details).
Correspondingly the remoteX.exe program and example scripts are located in the remoteX subfolder.

Remote DLL API

The remote.dll library is an easy way to implement GALEP remote control in any user software. Its API contains four simple commands:

int RemoteConnect(char* IP,long iPort)
Attempts to connect to the GalepX socket (default IP = "", iPort = 1233) and returns 0 when GalepX was not running or no connected GALEP programmer could be found.

void RemoteClose()
Closes the socket connection; must be called before terminating the program.

int RemoteSend(void *data,long size)
Sends the content of the *data buffer to the socket, with size in bytes.

int RemoteReceive(void *data,long size)
Checks if a data packet was received from the socket. In this case the *data buffer is filled and the number of bytes is returned. Otherwise 0 is returned.

The remote.dll library can be found in the remote\API subfolder, together with a small test program RemoteTest.cpp that demonstrates how to implement GALEP remote control into own programs. RemoteTest.cpp was written for Visual C++ 2010, but works also with other Visual C++ versions or other C++ compilers.

Remote sessions

With the TCP socket interface, the GalepX software runs as a server that can accept one or several remote control connections to clients. Clients control the server by sending ASCII text strings. The strings consist of optional keywords affecting the connection, followed by a script in form of a list of commands.

The server IP and port number can be configured in the Software. The default values are:

Server-IP (local host)
Server port 1233  
Interface active true (GalepX accepts remote commands)
Number of connections unlimited  

Under Linux, commands can be sent directly to GalepX through shell scripts. The script command connect localhost port 1233 opens the socket; the following commands are then sent directly to the socket.

Remote sessions can run in command mode or interactive mode. In command mode the connection is closed after receipt of a command:

connect localhost port 1233 (start connection - Linux only)
print("Hallo World");\n (send command)
  (wait for answer)
#10 Hello World \n (receive answer)
#00 \n  
  (GalepX terminates connection)

Interactive mode is activated through the keep command. The connection then stays open until the client terminates it:

connect localhost port 1233 (start connection - Linux only)
keep \n (command to hold the connection)
print("Hello World");\n (send command)
  (wait for answer)
#10 Hello World \n (receive answer)
#00 \n  
... (send more commands)
  (client terminates connection)

 !!  Make sure to terminate any command with a line feed (\n). Note that a script must be sent in a single command; the script interpreter does not preserve script states or variable declarations for later-sent scripts.



► latest version online