Skip to content

Commit

Permalink
* Correct enum classes in presets for Spinnaker (pull #1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsacha authored May 17, 2021
1 parent 787e40d commit 345dc8e
Show file tree
Hide file tree
Showing 7 changed files with 1,590 additions and 1,437 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Correct `enum` classes in presets for Spinnaker ([pull #1048](https://github.com/bytedeco/javacpp-presets/pull/1048))
* Add Windows build for ONNX ([issue #983](https://github.com/bytedeco/javacpp-presets/issues/983))
* Add `linux-arm64` builds to presets for DNNL, OpenCL, TensorRT ([pull #1044](https://github.com/bytedeco/javacpp-presets/pull/1044)), and ONNX Runtime
* Build FFmpeg with libxml2, enabling support for DASH demuxing ([pull #1033](https://github.com/bytedeco/javacpp-presets/pull/1033)), and libsrt for SRT protocol support ([pull #1036](https://github.com/bytedeco/javacpp-presets/pull/1036))
Expand Down
42 changes: 21 additions & 21 deletions spinnaker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class Acquisition_C {
private final static int MAX_BUFF_LEN = 256;

private static String findErrorNameByValue(int value) {
for (_spinError v : _spinError.values()) {
for (spinError v : spinError.values()) {
if (v.value == value) {
return v.name();
}
Expand All @@ -98,7 +98,7 @@ public class Acquisition_C {
}

private static String findImageStatusNameByValue(int value) {
for (_spinImageStatus v : _spinImageStatus.values()) {
for (spinImageStatus v : spinImageStatus.values()) {
if (v.value == value) {
return v.name();
}
Expand All @@ -115,7 +115,7 @@ public class Acquisition_C {
* @param message additional message to print.
*/

private static void exitOnError(_spinError err, String message) {
private static void exitOnError(spinError err, String message) {
if (printOnError(err, message)) {
System.out.println("Aborting.");
System.exit(err.value);
Expand All @@ -130,8 +130,8 @@ public class Acquisition_C {
* @param message additional message to print.
* @return 'false' if err is not SPINNAKER_ERR_SUCCESS, or 'true' for any other 'err' value.
*/
private static boolean printOnError(_spinError err, String message) {
if (err.value != _spinError.SPINNAKER_ERR_SUCCESS.value) {
private static boolean printOnError(spinError err, String message) {
if (err.value != spinError.SPINNAKER_ERR_SUCCESS.value) {
System.out.println(message);
System.out.println("Error " + err.value + " " + findErrorNameByValue(err.value) + "\n");
return true;
Expand All @@ -145,7 +145,7 @@ public class Acquisition_C {
*/
private static boolean isAvailableAndReadable(spinNodeHandle hNode, String nodeName) {
BytePointer pbAvailable = new BytePointer(1);
_spinError err;
spinError err;
err = spinNodeIsAvailable(hNode, pbAvailable);
printOnError(err, "Unable to retrieve node availability (" + nodeName + " node)");

Expand All @@ -160,7 +160,7 @@ public class Acquisition_C {
*/
private static boolean isAvailableAndWritable(spinNodeHandle hNode, String nodeName) {
BytePointer pbAvailable = new BytePointer(1);
_spinError err;
spinError err;
err = spinNodeIsAvailable(hNode, pbAvailable);
printOnError(err, "Unable to retrieve node availability (" + nodeName + " node).");

Expand All @@ -183,8 +183,8 @@ public class Acquisition_C {
* layer; please see NodeMapInfo_C example for more in-depth comments on
* printing device information from the nodemap.
*/
private static _spinError printDeviceInfo(spinNodeMapHandle hNodeMap) {
_spinError err;
private static spinError printDeviceInfo(spinNodeMapHandle hNodeMap) {
spinError err;
System.out.println("\n*** DEVICE INFORMATION ***\n\n");
// Retrieve device information category node
spinNodeHandle hDeviceInformation = new spinNodeHandle();
Expand All @@ -198,7 +198,7 @@ public class Acquisition_C {
printOnError(err, "Unable to retrieve number of nodes.");
} else {
printRetrieveNodeFailure("node", "DeviceInformation");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

// Iterate through nodes and print information
Expand All @@ -216,7 +216,7 @@ public class Acquisition_C {
featureName.putString("Unknown name");
}

int[] featureType = {_spinNodeType.UnknownNode.value};
int[] featureType = {spinNodeType.UnknownNode.value};
if (isAvailableAndReadable(hFeatureNode, featureName.getString())) {
err = spinNodeGetType(hFeatureNode, featureType);
if (printOnError(err, "Unable to retrieve node type.")) {
Expand All @@ -240,9 +240,9 @@ public class Acquisition_C {
}

// This function acquires and saves 10 images from a device.
private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNodeMap, spinNodeMapHandle hNodeMapTLDevice) {
private static spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNodeMap, spinNodeMapHandle hNodeMapTLDevice) {
System.out.println("\n*** IMAGE ACQUISITION ***\n");
_spinError err;
spinError err;
//
// Set acquisition mode to continuous
//
Expand Down Expand Up @@ -287,7 +287,7 @@ public class Acquisition_C {
}
} else {
printRetrieveNodeFailure("entry", "AcquisitionMode");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

// Retrieve integer from entry node
Expand All @@ -300,7 +300,7 @@ public class Acquisition_C {
}
} else {
printRetrieveNodeFailure("entry", "AcquisitionMode 'Continuous'");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

// Set integer as new value of enumeration node
Expand All @@ -311,7 +311,7 @@ public class Acquisition_C {
}
} else {
printRetrieveNodeFailure("entry", "AcquisitionMode");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

System.out.println("Acquisition mode set to continuous...");
Expand Down Expand Up @@ -473,7 +473,7 @@ public class Acquisition_C {
if (printOnError(err, "Unable to create image. Non-fatal error.")) {
hasFailed = true;
}
err = spinImageConvert(hResultImage, _spinPixelFormatEnums.PixelFormat_Mono8.value, hConvertedImage);
err = spinImageConvert(hResultImage, spinPixelFormatEnums.PixelFormat_Mono8, hConvertedImage);
if (printOnError(err, "\"Unable to convert image. Non-fatal error.")) {
hasFailed = true;
}
Expand All @@ -492,7 +492,7 @@ public class Acquisition_C {
// numbers to keep images of one device from overwriting those of
// another.
//
err = spinImageSave(hConvertedImage, new BytePointer(filename), _spinImageFileFormat.JPEG.value);
err = spinImageSave(hConvertedImage, new BytePointer(filename), spinImageFileFormat.JPEG);
if (!printOnError(err, "Unable to save image. Non-fatal error.")) {
System.out.println("Image saved at " + filename + "\n");
}
Expand Down Expand Up @@ -535,8 +535,8 @@ public class Acquisition_C {
* This function acts as the body of the example; please see NodeMapInfo_C
* example for more in-depth comments on setting up cameras.
*/
private static _spinError runSingleCamera(spinCamera hCam) {
_spinError err;
private static spinError runSingleCamera(spinCamera hCam) {
spinError err;
// Retrieve TL device nodemap and print device information
spinNodeMapHandle hNodeMapTLDevice = new spinNodeMapHandle();
err = spinCameraGetTLDeviceNodeMap(hCam, hNodeMapTLDevice);
Expand Down Expand Up @@ -579,7 +579,7 @@ public class Acquisition_C {
public static void main(String[] args) {


_spinError err;
spinError err;

// Since this application saves images in the current folder
// we must ensure that we have permission to write to this folder.
Expand Down
42 changes: 21 additions & 21 deletions spinnaker/samples/Acquisition_C.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Acquisition_C {
private final static int MAX_BUFF_LEN = 256;

private static String findErrorNameByValue(int value) {
for (_spinError v : _spinError.values()) {
for (spinError v : spinError.values()) {
if (v.value == value) {
return v.name();
}
Expand All @@ -39,7 +39,7 @@ private static String findErrorNameByValue(int value) {
}

private static String findImageStatusNameByValue(int value) {
for (_spinImageStatus v : _spinImageStatus.values()) {
for (spinImageStatus v : spinImageStatus.values()) {
if (v.value == value) {
return v.name();
}
Expand All @@ -56,7 +56,7 @@ private static String findImageStatusNameByValue(int value) {
* @param message additional message to print.
*/

private static void exitOnError(_spinError err, String message) {
private static void exitOnError(spinError err, String message) {
if (printOnError(err, message)) {
System.out.println("Aborting.");
System.exit(err.value);
Expand All @@ -71,8 +71,8 @@ private static void exitOnError(_spinError err, String message) {
* @param message additional message to print.
* @return 'false' if err is not SPINNAKER_ERR_SUCCESS, or 'true' for any other 'err' value.
*/
private static boolean printOnError(_spinError err, String message) {
if (err.value != _spinError.SPINNAKER_ERR_SUCCESS.value) {
private static boolean printOnError(spinError err, String message) {
if (err.value != spinError.SPINNAKER_ERR_SUCCESS.value) {
System.out.println(message);
System.out.println("Error " + err.value + " " + findErrorNameByValue(err.value) + "\n");
return true;
Expand All @@ -86,7 +86,7 @@ private static boolean printOnError(_spinError err, String message) {
*/
private static boolean isAvailableAndReadable(spinNodeHandle hNode, String nodeName) {
BytePointer pbAvailable = new BytePointer(1);
_spinError err;
spinError err;
err = spinNodeIsAvailable(hNode, pbAvailable);
printOnError(err, "Unable to retrieve node availability (" + nodeName + " node)");

Expand All @@ -101,7 +101,7 @@ private static boolean isAvailableAndReadable(spinNodeHandle hNode, String nodeN
*/
private static boolean isAvailableAndWritable(spinNodeHandle hNode, String nodeName) {
BytePointer pbAvailable = new BytePointer(1);
_spinError err;
spinError err;
err = spinNodeIsAvailable(hNode, pbAvailable);
printOnError(err, "Unable to retrieve node availability (" + nodeName + " node).");

Expand All @@ -124,8 +124,8 @@ private static void printRetrieveNodeFailure(String node, String name) {
* layer; please see NodeMapInfo_C example for more in-depth comments on
* printing device information from the nodemap.
*/
private static _spinError printDeviceInfo(spinNodeMapHandle hNodeMap) {
_spinError err;
private static spinError printDeviceInfo(spinNodeMapHandle hNodeMap) {
spinError err;
System.out.println("\n*** DEVICE INFORMATION ***\n\n");
// Retrieve device information category node
spinNodeHandle hDeviceInformation = new spinNodeHandle();
Expand All @@ -139,7 +139,7 @@ private static _spinError printDeviceInfo(spinNodeMapHandle hNodeMap) {
printOnError(err, "Unable to retrieve number of nodes.");
} else {
printRetrieveNodeFailure("node", "DeviceInformation");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

// Iterate through nodes and print information
Expand All @@ -157,7 +157,7 @@ private static _spinError printDeviceInfo(spinNodeMapHandle hNodeMap) {
featureName.putString("Unknown name");
}

int[] featureType = {_spinNodeType.UnknownNode.value};
int[] featureType = {spinNodeType.UnknownNode.value};
if (isAvailableAndReadable(hFeatureNode, featureName.getString())) {
err = spinNodeGetType(hFeatureNode, featureType);
if (printOnError(err, "Unable to retrieve node type.")) {
Expand All @@ -181,9 +181,9 @@ private static _spinError printDeviceInfo(spinNodeMapHandle hNodeMap) {
}

// This function acquires and saves 10 images from a device.
private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNodeMap, spinNodeMapHandle hNodeMapTLDevice) {
private static spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNodeMap, spinNodeMapHandle hNodeMapTLDevice) {
System.out.println("\n*** IMAGE ACQUISITION ***\n");
_spinError err;
spinError err;
//
// Set acquisition mode to continuous
//
Expand Down Expand Up @@ -228,7 +228,7 @@ private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNode
}
} else {
printRetrieveNodeFailure("entry", "AcquisitionMode");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

// Retrieve integer from entry node
Expand All @@ -241,7 +241,7 @@ private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNode
}
} else {
printRetrieveNodeFailure("entry", "AcquisitionMode 'Continuous'");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

// Set integer as new value of enumeration node
Expand All @@ -252,7 +252,7 @@ private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNode
}
} else {
printRetrieveNodeFailure("entry", "AcquisitionMode");
return _spinError.SPINNAKER_ERR_ACCESS_DENIED;
return spinError.SPINNAKER_ERR_ACCESS_DENIED;
}

System.out.println("Acquisition mode set to continuous...");
Expand Down Expand Up @@ -414,7 +414,7 @@ private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNode
if (printOnError(err, "Unable to create image. Non-fatal error.")) {
hasFailed = true;
}
err = spinImageConvert(hResultImage, _spinPixelFormatEnums.PixelFormat_Mono8.value, hConvertedImage);
err = spinImageConvert(hResultImage, spinPixelFormatEnums.PixelFormat_Mono8, hConvertedImage);
if (printOnError(err, "\"Unable to convert image. Non-fatal error.")) {
hasFailed = true;
}
Expand All @@ -433,7 +433,7 @@ private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNode
// numbers to keep images of one device from overwriting those of
// another.
//
err = spinImageSave(hConvertedImage, new BytePointer(filename), _spinImageFileFormat.JPEG.value);
err = spinImageSave(hConvertedImage, new BytePointer(filename), spinImageFileFormat.JPEG);
if (!printOnError(err, "Unable to save image. Non-fatal error.")) {
System.out.println("Image saved at " + filename + "\n");
}
Expand Down Expand Up @@ -476,8 +476,8 @@ private static _spinError acquireImages(spinCamera hCam, spinNodeMapHandle hNode
* This function acts as the body of the example; please see NodeMapInfo_C
* example for more in-depth comments on setting up cameras.
*/
private static _spinError runSingleCamera(spinCamera hCam) {
_spinError err;
private static spinError runSingleCamera(spinCamera hCam) {
spinError err;
// Retrieve TL device nodemap and print device information
spinNodeMapHandle hNodeMapTLDevice = new spinNodeMapHandle();
err = spinCameraGetTLDeviceNodeMap(hCam, hNodeMapTLDevice);
Expand Down Expand Up @@ -520,7 +520,7 @@ private static _spinError runSingleCamera(spinCamera hCam) {
public static void main(String[] args) {


_spinError err;
spinError err;

// Since this application saves images in the current folder
// we must ensure that we have permission to write to this folder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ public class actionCommandResult extends Pointer {
public native @Cast("unsigned int") int DeviceAddress(); public native actionCommandResult DeviceAddress(int setter);

/* Action Command status return from device */
public native @Cast("actionCommandStatus") int Status(); public native actionCommandResult Status(int setter);
public native actionCommandStatus Status(); public native actionCommandResult Status(actionCommandStatus setter);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class spinTIFFOption extends Pointer {
}

/** Compression method to use for encoding TIFF images. */
public native @Cast("spinCompressionMethod") int compression(); public native spinTIFFOption compression(int setter);
public native spinCompressionMethod compression(); public native spinTIFFOption compression(spinCompressionMethod setter);
/** Reserved for future use. */
public native @Cast("unsigned int") int reserved(int i); public native spinTIFFOption reserved(int i, int setter);
@MemberGetter public native @Cast("unsigned int*") IntPointer reserved();
Expand Down
Loading

0 comments on commit 345dc8e

Please sign in to comment.