Hi all,
for a project I tried to use the java bindings.
Unfortunately, I have the following problem with the DatafeedCallback.
I'm unable to access the data of the payload, because I cannot cast the
payload to ANALOG, HEADER, LOGIC, ... [1]
As far as I understand the swig documentation [2], it is not possible to
cast an class to a new class and the programm has to take care of casting.
How to solve this problem?
Thanks,
Sven
[1] From the DataFeedCallback:
public void run(Device device, Packet packet) {
if (packet.type().id() == PacketType.ANALOG.id()) {
// Analog a = (Analog) packet.payload(); // Not possible
} else {
System.out.println("Unknown: " + packet.type().name());
}
}
[2] From:
http://www.swig.org/Doc1.3/Java.html
"By design it is also not possible to manually cast a pointer to a new
type by using Java casts as it is particularly dangerous especially when
casting C++ objects. If you need to cast a pointer or change its value,
consider writing some helper functions instead."
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel