API. CONFIG

The API.CONFIG namespace provides a set of interfaces for managing controller configurations. It includes methods for loading configuration files, retrieving and updating attributes of signals and cross-connections, and creating or deleting configuration instances. This namespace serves as a high-level abstraction for interacting with the controller's configuration database, enabling developers to efficiently manage and customize controller configurations.

Properties
NameTypeDescription
DOMAINenum

Configuration domain, e.g. EIO

TYPEenum

Members

(static, readonly) this.DOMAIN :string

Enum for configuration domains

Type:
  • string
Properties
NameTypeDescription
EIOstring

I/O system domin.

SYSstring

Controller domin.

MOCstring

Motion control domain.

MMCstring

Man-machine communication domain.

SIOstring

Communication domain.

PROCstring

PROC domain.

EIOstring
SYSstring
MOCstring
MMCstring
SIOstring
PROCstring
Example
let config = await RWS.CFG.getInstanceByName(API.CONFIG.DOMAIN.EIO, API.CONFIG.TYPE.SIGNAL, "Auto");

(static, readonly) this.TYPE :string

Enum for configuration types

Type:
  • string
Properties
NameTypeDescription
SIGNALstring

Signal configuration.

CROSSstring

Cross-connection configuration.

ETHERNETIPstring

Ethernet/IP device configuration.

SIGNALstring
CROSSstring
ETHERNETIPstring

Methods

createCrossConnectionInstance(attr) → {Promise.<any>}

Creates a cross conneciton configuration instance with specified attributes

Parameters:
NameTypeDescription
attrobject

The attributes including cross connection name and others.

Returns:
  • A Promise object whose value is empty when it is resolved or contains a status when it is rejected
Type: 
Promise.<any>
Example
await API.CONFIG.createCrossConnectionInstance({Name:"TestCrossConnection",Act1:"GOFA_SysOut_SetMotorsOn",Act1_invert:"false",Res:"GOFA_SysIn_SetMotorsOn"});

createSignalInstance(attr) → {Promise.<any>}

Creates a signal configuraiton instance with attributes

Parameters:
NameTypeDescription
attrobject

The signal attributes.

Returns:
  • A Promise object whose value is empty when it is resolved or contains a status when it is rejected
Type: 
Promise.<any>
Example
// create a digital output signal named "TestDO1" with read-only acess level
await API.CONFIG.createSignalInstance({Name:"TestDO1",Access:"ReadOnly",SignalType:"DO"})

fetchAllCrossConnections() → {Promise.<Array.<object>>}

Gets all cross-connection instances

Returns:
  • A Promise with a list of all cross connection objects
Type: 
Promise.<Array.<object>>
Example
let connections = await API.CONFIG.fetchAllCrossConnections()

fetchAllInstancesOfType(type) → {Promise.<Array.<object>>}

Gets all the instances of a specified type

Parameters:
NameTypeDescription
typeAPI.CONFIG.TYPE

All instances of the type will be returned.

Returns:
  • A Promise with a list of objects
Type: 
Promise.<Array.<object>>
Example
let instances = await API.CONFIG.fetchAllInstancesOfType(API.CONFIG.TYPE.CROSS)

fetchAllSignals() → {Promise.<Array.<object>>}

Gets all the signal instances

Returns:
  • A Promise with a list of objects
Type: 
Promise.<Array.<object>>
Example
let signals = await API.CONFIG.fetchAllSignals()

getCrossConnectionAttributes(name) → {Promise.<object>}

Gets the attributes of a Cross-Conneciton configuraiton instance

Parameters:
NameTypeDescription
namestring

The name of the Cross-Connection configuration instance.

Returns:

The attributes of a Cross-Connection configuration instance

Type: 
Promise.<object>
Example
let attributes = await API.CONFIG.getCrossConnectionAttributes("MotorsOnInAuto")

getSignalAttributes(name) → {Promise.<object>}

Gets the attributes of the signal

Parameters:
NameTypeDescription
namestring

The name of the signal

Returns:

The attributes of a signal

Type: 
Promise.<object>
Example
// get the signal attribute of the signal Auto
let attributes = await API.CONFIG.getSignalAttributes("Auto")

loadConfiguration(filepath, action)

Loads a configuration file to the controller configuration data base. A controller restart is required for the new configuration to take effect.

Parameters:
NameTypeDefaultDescription
filepathstring

The file path, including the file name.

actionRWS.CFG.LoadMode"replace"

The validation method, whose valid values include "add", "replace" and "add-with-reset".

Example
// Load a EIO cfg file in home directory into controller
await API.CONFIG.loadConfiguration("$HOME/eio.cfg")

updateCrossConnectionAttributes(attr) → {Promise.<object>}

Updates attributes of a cross connection instance in the configuration data-base. The attributes object should only contain valid members, i.e. attributes that are valid for the instance’s specific type and the corresponding values.

Parameters:
NameTypeDescription
attrobject

The attributes to be updated

Returns:
  • A Promise with an instance object await API.CONFIG.updateCrossConnectionAttributes({Name:"TestCrossConnection",Act1:"GOFA_SysOut_SetMotorsOn",Act1_invert:"true",Res:"GOFA_SysIn_SetMotorsOn"});
Type: 
Promise.<object>

updateSignalAttributes(attr) → {Promise.<object>}

Updates attributes of a signal instance in the configuration database. The attributes object should only contain valid members, i.e. attributes that are valid for the instance’s specific type, and the corresponding values.

Parameters:
NameTypeDescription
attrobject

The attributes to be updated

Returns:
  • A Promise with an instance object
Type: 
Promise.<object>
Example
// update the access-level of signal "TestDO1" to all
await API.CONFIG.updateSignalAttributes({Name:"TestDO1",Access:"All"})

verifyConfiguration(filepath, action)

Verifies a configuration file.

Parameters:
NameTypeDefaultDescription
filepathstring

The file path, including the file name.

actionRWS.CFG.LoadMode"replace"

the validation method, The validation method, whose valid values include "add", "replace" and "add-with-reset".

Example
// Validates a EIO cfg file in home directory into controller
await API.CONFIG.verifyConfiguration("$HOME/eio.cfg")