Euresys GenApi scriptsCoaxlink Programmer's Guide
console.log(' - ' + n + ': ' + attrs[n]);
}
// optional suffixes to integer or float feature names
if (port.available('DividerToolSelector') &&
port.available('DividerToolSelector', 'DIV1')) {
var feature = 'DividerToolDivisionFactor[DIV1]';
var suffixes = ['.Min', '.Max', '.Inc', '.Value'];
console.log('- Accessing ' + suffixes + ' of ' + feature);
for (var suffix of suffixes) {
console.log( ' - ' + suffix + ': ' + port.get(feature + suffix));
}
}
}
// Camera ports (RemotePort) also have the following functions:
// brRead(addr) | read bootstrap register (32-bit big endian)
// brWrite(addr,v) | write value to bootstrap register (32-bit big endian)
if (grabbers.length) {
var port = grabbers[0].RemotePort;
if (port) {
console.log('Playing with', port.tag);
var brStandard = 0x00000000;
var brRevision = 0x00000004;
var standard = port.brRead(brStandard);
var revision = port.brRead(brRevision);
if (0xc0a79ae5 === standard) {
console.log('Bootstrap register "Standard" is OK (0xc0a79ae5)');
} else {
console.log('Bootstrap register "Standard" is ' + standard);
}
console.log('Bootstrap register "Revision" is ' + revision);
}
}
doc/module1.js
// This file describes the special 'module' variable of Euresys GenApi Script.
// It can be executed by running 'gentl script coaxlink://doc/module1.js'. It
// is also dynamically loaded by the coaxlink://doc/builtins.js script.
// 'module' is a special per-module variable. It cannot be declared with var.
// It always exists, and contains a few items:
console.log('Started execution of "' + module.filename + '"');
console.log('This script is located in directory "' + module.curdir + '"');
// Modules can export values via module.exports (which is initialized as an
// empty object):
module.exports = { description: 'Example of Euresys GenApi Script module'
, plus2: function(x) {
return x + 2;
}
, hello: function() {
console.log('Hello from ' + module.filename);
}
};
console.log('module.exports contains: ');
for (var e in module.exports) {
console.log('- ' + e + ' (' + typeof module.exports[e] + ')');
}
console.log('Completed execution of ' + module.filename);
33