Values

Writing

To modify the configuration that is sent to a device you can use config.setScalarByOid:

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
    config.setScalarByOid("1.2.9.11", "Comment 1");
    config.setScalarByOid("1.2.9.12", "Comment 2");
};

Changes made by config.setScalarByOid will be visible in the config preview, as they are applied to the configuration before it is sent to the device.

The same can be achieved by using config.addScriptLine:

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
    // LCOS only:
    config.addScriptLine('set /Setup/SNMP/Comment-1 "Hello"');
    config.addScriptLine('set /Setup/SNMP/Comment-2 "World"');
};

Changes made by config.addScriptLine are NOT visible in the config preview, as they are only run on the device. This method only works on LCOS based devices.

Reading

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
    var comment1 = config.getScalarByOid("1.2.9.11");
    var comment2 = config.getScalarByOid("1.2.9.12");
};

There is no equivalent config.addScriptLine to read data from the device.

results matching ""

    No results matching ""