The System module gives access to the internals of the Virtual Machine and access the host computer.


Change working directory for the current task.



Execute system command, sending optional parameters as array

WARNING : there is no size limit for outputs 'stdout' and 'stderr'

System.exec('/path_to_file/<command>',[ parameters array]);

Function will return JSON object :

  'exec' : '/path/to/the/command/',
  'stdout': standard output as text
  'stderr': error output as text

Example :

var c = {
    'command' : '/bin/bash', 
    'args' : ['-c','ls']
} ;

var res = System.exec( c );
print( JSON.stringify( res ));


Checks if a GPS positionning device is managed by the VM. Returns true if :
- A GPS device has been declared at startup

bool result = System.GPSAvail() ;


Allows to 'hotplug' a GPS receiver of the VM.

bool result = System.GPSConnect( String device, [optional : baudrate]) ;


  • device: comm port to be used, for example /dev/ttyACM0
  • baudrate : communication speed with the GPS receiver, default value is 9600

Returns true if the GPS has been connected.


 if( System.GPSAvail() == false ) {
    print('No GPS receiver configured by command line, testing ttyACM0') ;
    if( System.GPSConnect('/dev/ttyACM0') === true ) {
        print('GPS ready');
    } else {
        print('No GPS');


Checks if a GPS positionning device is managed by the VM. Returns true if :

  • A GPS device has been declared at startup
  • The GPS is connected and is sending NMEA frames.
bool result = System.GPSValidNMEA() ;


Returns, if a GPS device is connected and running, the following infos:

  • latitude, longitude, altitude from the last fix report
  • fix status (locked/unlocked)
  • GPS time (seconds after the 01/01/1970)
var mypos = System.GPSInfos();

Function will return JSON object :

  'fix' : boolean to indicate if we have a fix or not,
  'latitude_N': latitude in degrees,
  'longitude_E': longitude in degrees,
  'altitude' : altitude in meters,
  'speed_kmh': current estimated speed,
  'travel_angle_north' : current bearing angle,
  'system_time': system time,
  'sys_timestamp' : number of seconds since the 01/01/1970,
  'gps_timestamp' : date and time, as returned by device

GPS example

sudo ./sdrvm -g /dev/ttyACM0 -b 19200 -f gps_pos.js
for( ; ; ) {
    if( System.GPSAvail() == false ) {
        print('Run the VM with the -g option');
    if( System.GPSValidNMEA() == true ) {
        print('GPS now working.');
        break ;
    print("Waiting for NMEA frames to arrive.");
print('GPS ready');
for( ; ; ) {
    var mypos = System.GPSInfos();


Check if specified path is a mounted filesystem or not.

bool System.isMounted('path');

Example :

if( System.isMounted('/media/disk/04DA-6F70') ) {
    print('search boot');


Returns the % free in the volume where the given file is located.

number System.getFreeSpace('path');


var freespace = System.getFreeSpace('/etc/passwd');
if( freespace < 1 ) {
    print('Root filesytem almost full !');


Returns the % of system RAM currently used.

number System.getRamUSed();


Returns the CPU load average over 100 milliseconds.

number System.getCpuLoad();


Returns the list of network interfaces available, with their MAC and current IP addresses.

var nics = System.nics() ;

returns an array of JSON objects :

    "ip" : string,
    "mac": string,
    "name": string

example :


Get a list of JS tasks which are actually running on the SDR Javascript Virtual Machine

var running_tasks =;
  • Example, list tasks :
var tasks =;
print( JSON.stringify( tasks ));


Tells a specific running task to stop.



Create a Linux FIFO file.
Function will return a TRUE boolean value if FIFO was yet existing or created just now.

var ok = System.mkFifo('/tmp/data.fifo');

Note : if the FIFO will be used to transfer IQ data to a third-party application through file ( E.G.: IQData.appendToFile(...)), you have to name the fifo file with an additional extension ( .CF16 .CF32).

For more informations, please refer to IQdata object.

  • Example
var ok = System.mkFifo('/tmp/data.fifo.CS16');


Load external license file instead of usual default license file 'license.dat' located in app directory.

  • Example
var d=System.loadLicense('/tmp/mylicense.dat');

Will return TRUE and display licensing informations if success.
Returns FALSE if license file is not found


Defines the license with a string constant. Returns true if the license is valid for this system.

  • Example
var ok=System.setLicense('ToYRrOK$vHE$B3Gb3zAOvHGnVb69oCYhVPD0LHt4vmzAGZ3yZGSGJJUvpegsinXtVEIGi1$UV*oT2x*Tne');
if( ok == false ) {
    print('error in license, cannot continue.');


Defines where the "/" URL path goes in the local filesystem. By default, it is defined in the configuration file ( see WebServer) but can be overriden by this function.


// Change Web root to local folder
System.setWebRoot( './webpages');


Returns how many GPU devices are available. Return -1 if the GPU support is not enabled.


var nb = System.getGPUCount();
if( nb == -1 ) {
 print('GPU support not enabled.');
} else {
 print( nb, ' GPU devices detected.');


Defines the default GPU to be used by the SDRVM. Valid from 0 to System.etGPUCount()-1 .

Will throw an exception if no GPU support or not valid ID.

Last update: August 21, 2023