Connecting a nodemap to a port

48 views Asked by At

I'm struggling to use the Genicam java reference design. I cannot figure out how to connect the IPort to the NodeMap.

Port devPort = dev.getRemotePort();
// I retrieve the XML from the camera, trimmed
NodeMap map = new NodeMap();
map.loadXMLFromString(xml);
// Need to connect map to port. How?
IPort devIPort = new IPort();
map.connect(devIPort, devport.getName());

I cannot get a read from the device with the native methods or with direct register access through the IPort

// This returns the expected value
devport.read(0x11024, readBuf);
// This does not
devIPort.read((long)0x11024, byteBuf);

Attempting to read memory directly with the IPort fails with

Exception in thread "main" java.lang.RuntimeException: Attempted to invoke pure virtual method GENAPI_NAMESPACE::MyPort::ReadSwig.
    at org.genicam.genapi.genapiJNI.IPort_read(Native Method)
    at org.genicam.genapi.IPort.read(IPort.java:55)
    at imagegrab.imagegrab.main(imagegrab.java:96)

I receive exceptions like this using the readInteger method.

Exception in thread "main" org.genicam.genapi.AccessException: Node is not readable : AccessException thrown in node 'SensorWidth' while calling 'SensorWidth.ToString()' (file 'ValueT.h', line 63)
at org.genicam.genapi.genapiJNI.IValue_toString__SWIG_2(Native Method)
at org.genicam.genapi.IValue.toString(IValue.java:56)
at java.base/java.lang.String.valueOf(String.java:4220)
at imagegrab.imagegrab.main(imagegrab.java:99)

The python reference design is intuitive and transfers the GenTL Port to a GenAPI IPort through the AbstractPort abstract base class and ConcretePort.

concrete_port = ConcretePort(device.remote_port)
node_map.connect(concrete_port, device.remote_port.name)
0

There are 0 answers