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.
| Name | Type | Description |
|---|---|---|
DOMAIN | enum | Configuration domain, e.g. EIO |
TYPE | enum |
- Source
Members
(static, readonly) this.DOMAIN :string
Enum for configuration domains
- string
| Name | Type | Description |
|---|---|---|
EIO | string | I/O system domin. |
SYS | string | Controller domin. |
MOC | string | Motion control domain. |
MMC | string | Man-machine communication domain. |
SIO | string | Communication domain. |
PROC | string | PROC domain. |
EIO | string | |
SYS | string | |
MOC | string | |
MMC | string | |
SIO | string | |
PROC | string |
- Source
let config = await RWS.CFG.getInstanceByName(API.CONFIG.DOMAIN.EIO, API.CONFIG.TYPE.SIGNAL, "Auto");(static, readonly) this.TYPE :string
Enum for configuration types
- string
| Name | Type | Description |
|---|---|---|
SIGNAL | string | Signal configuration. |
CROSS | string | Cross-connection configuration. |
ETHERNETIP | string | Ethernet/IP device configuration. |
SIGNAL | string | |
CROSS | string | |
ETHERNETIP | string |
- Source
Methods
createCrossConnectionInstance(attr) → {Promise.<any>}
Creates a cross conneciton configuration instance with specified attributes
| Name | Type | Description |
|---|---|---|
attr | object | The attributes including cross connection name and others. |
- Source
- A Promise object whose value is empty when it is resolved or contains a status when it is rejected
- Type:
- Promise.<any>
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
| Name | Type | Description |
|---|---|---|
attr | object | The signal attributes. |
- Source
- A Promise object whose value is empty when it is resolved or contains a status when it is rejected
- Type:
- Promise.<any>
// 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
- Source
- A Promise with a list of all cross connection objects
- Type:
- Promise.<Array.<object>>
let connections = await API.CONFIG.fetchAllCrossConnections()fetchAllInstancesOfType(type) → {Promise.<Array.<object>>}
Gets all the instances of a specified type
| Name | Type | Description |
|---|---|---|
type | API. | All instances of the type will be returned. |
- Source
- A Promise with a list of objects
- Type:
- Promise.<Array.<object>>
let instances = await API.CONFIG.fetchAllInstancesOfType(API.CONFIG.TYPE.CROSS)fetchAllSignals() → {Promise.<Array.<object>>}
Gets all the signal instances
- Source
- A Promise with a list of objects
- Type:
- Promise.<Array.<object>>
let signals = await API.CONFIG.fetchAllSignals()getCrossConnectionAttributes(name) → {Promise.<object>}
Gets the attributes of a Cross-Conneciton configuraiton instance
| Name | Type | Description |
|---|---|---|
name | string | The name of the Cross-Connection configuration instance. |
- Source
The attributes of a Cross-Connection configuration instance
- Type:
- Promise.<object>
let attributes = await API.CONFIG.getCrossConnectionAttributes("MotorsOnInAuto")getSignalAttributes(name) → {Promise.<object>}
Gets the attributes of the signal
| Name | Type | Description |
|---|---|---|
name | string | The name of the signal |
- Source
The attributes of a signal
- Type:
- Promise.<object>
// 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.
| Name | Type | Default | Description |
|---|---|---|---|
filepath | string | The file path, including the file name. | |
action | RWS. | "replace" | The validation method, whose valid values include "add", "replace" and "add-with-reset". |
- Source
// 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.
| Name | Type | Description |
|---|---|---|
attr | object | The attributes to be updated |
- Source
- 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.
| Name | Type | Description |
|---|---|---|
attr | object | The attributes to be updated |
- Source
- A Promise with an instance object
- Type:
- Promise.<object>
// update the access-level of signal "TestDO1" to all
await API.CONFIG.updateSignalAttributes({Name:"TestDO1",Access:"All"})verifyConfiguration(filepath, action)
Verifies a configuration file.
| Name | Type | Default | Description |
|---|---|---|---|
filepath | string | The file path, including the file name. | |
action | RWS. | "replace" | the validation method, The validation method, whose valid values include "add", "replace" and "add-with-reset". |
- Source
// Validates a EIO cfg file in home directory into controller
await API.CONFIG.verifyConfiguration("$HOME/eio.cfg")