Coaxlink Programmer's GuideEuresys GenApi scripts
// Ports also have the following functions to work on GenICam features:
// get(f) | get value of f
// set(f,v) | set value v to f
// execute(f) | execute f
// features([re]) | get list of features [matching regular expression re]
// $features([re]) | strict* variant of features([re])
// ee(f,[re]) | get list of enum entries [matching regular expression re]
// | of enumeration f
// $ee(f,[re]) | strict* variant of ee(f,[re])
// has(f) | test if f exists
// has(f,v) | test if f has an enum entry v
// available(f) | test if f is available
// available(f,v) | test if f has an enum entry v which is available
// selectors(f) | get list of features that act as selectors of f
// attributes(...) | extract information from the XML file describing the port
//
// * by strict we mean that the returned list contains only nodes/values
// that are available (as dictated by 'pIsAvailable' GenICam node elements)
if (grabbers.length) {
var port = grabbers[0].InterfacePort;
console.log('Playing with', port.tag);
// get(f)
console.log('- InterfaceID: ' + port.get('InterfaceID'));
// set(f,v)
port.set('LineSelector', 'TTLIO11');
// execute(f)
port.execute('DeviceUpdateList');
// features(re)
console.log('- Features matching \'PCIe\':');
for (var f of port.features('PCIe')) {
console.log(' - ' + f);
}
// $ee(f)
console.log('- Available enum entries for LineSource:');
for (var ee of port.$ee('LineSource')) {
console.log(' - ' + ee);
}
for (var ix of [0, 1, 2, 3, 9]) {
var ee = 'Device' + ix + 'Strobe';
// has(f, v)
if (port.has('LineSource', ee)) {
console.log('- ' + ee + ' exists');
} else {
console.log('- ' + ee + ' does not exist');
}
// available(f, v)
if (port.available('LineSource', ee)) {
console.log('- ' + ee + ' is available');
} else {
console.log('- ' + ee + ' is not available');
}
}
// selectors(f)
console.log('- LineSource feature is selected by',
port.selectors('LineSource'));
// attributes()
console.log('- attributes()');
var attrs = port.attributes();
for (var n in attrs) {
console.log(' - ' + n + ': ' + attrs[n]);
}
// attributes(f)
console.log('- attributes(\'LineFormat\')');
var attrs = port.attributes('LineFormat');
for (var n in attrs) {
console.log(' - ' + n + ': ' + attrs[n]);
}
// attributes(f)
var fmt = port.get('LineFormat');
console.log('- attributes(\'LineFormat\', \'' + fmt + '\')');
var attrs = port.attributes('LineFormat', fmt);
for (var n in attrs) {
32