mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Removes NiVision from allwpilib (#305)
This commit is contained in:
committed by
Peter Johnson
parent
ecb873ff45
commit
ac50d7cf8a
@@ -1,646 +0,0 @@
|
||||
//==============================================================================
|
||||
//
|
||||
// Title : NIIMAQdx.h
|
||||
// Created : 1403685834 seconds after 1/1/1970 12:00:00 UTC
|
||||
// Copyright : © Copyright 2006, National Instruments Corporation, All rights reserved
|
||||
// Purpose : Include file for NI-IMAQdx library support.
|
||||
//
|
||||
//==============================================================================
|
||||
#ifndef ___niimaqdx_h___
|
||||
#define ___niimaqdx_h___
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(niimaqdx_types)
|
||||
#define niimaqdx_types
|
||||
|
||||
#ifdef _CVI_
|
||||
#pragma EnableLibraryRuntimeChecking
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// Typedefs
|
||||
//==============================================================================
|
||||
#ifndef _NI_uInt8_DEFINED_
|
||||
#define _NI_uInt8_DEFINED_
|
||||
typedef unsigned char uInt8;
|
||||
#endif
|
||||
|
||||
#ifndef _NI_uInt16_DEFINED_
|
||||
#define _NI_uInt16_DEFINED_
|
||||
typedef unsigned short int uInt16;
|
||||
#endif
|
||||
|
||||
#ifndef _NI_uInt32_DEFINED_
|
||||
#define _NI_uInt32_DEFINED_
|
||||
#if defined(_MSC_VER)
|
||||
typedef unsigned long uInt32;
|
||||
#elif __GNUC__
|
||||
#if __x86_64__
|
||||
typedef unsigned int uInt32;
|
||||
#else
|
||||
typedef unsigned long uInt32;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _NI_uInt64_DEFINED_
|
||||
#define _NI_uInt64_DEFINED_
|
||||
#if defined(_MSC_VER) || _CVI_ >= 700
|
||||
typedef unsigned __int64 uInt64;
|
||||
#elif __GNUC__
|
||||
typedef unsigned long long uInt64;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _NI_Int8_DEFINED_
|
||||
#define _NI_Int8_DEFINED_
|
||||
typedef char Int8;
|
||||
#endif
|
||||
|
||||
#ifndef _NI_Int16_DEFINED_
|
||||
#define _NI_Int16_DEFINED_
|
||||
typedef short int Int16;
|
||||
#endif
|
||||
|
||||
#ifndef _NI_Int32_DEFINED_
|
||||
#define _NI_Int32_DEFINED_
|
||||
#if defined(_MSC_VER)
|
||||
typedef long Int32;
|
||||
#elif __GNUC__
|
||||
#if __x86_64__
|
||||
typedef int Int32;
|
||||
#else
|
||||
typedef long Int32;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _NI_Int64_DEFINED_
|
||||
#define _NI_Int64_DEFINED_
|
||||
#if defined(_MSC_VER) || _CVI_ >= 700
|
||||
typedef __int64 Int64;
|
||||
#elif __GNUC__
|
||||
typedef long long int Int64;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _NI_float32_DEFINED_
|
||||
#define _NI_float32_DEFINED_
|
||||
typedef float float32;
|
||||
#endif
|
||||
|
||||
#ifndef _NI_float64_DEFINED_
|
||||
#define _NI_float64_DEFINED_
|
||||
typedef double float64;
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (1L)
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (0L)
|
||||
#endif
|
||||
|
||||
#ifndef _NI_GUIDHNDL_DEFINED
|
||||
typedef uInt32 GUIHNDL;
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) || defined(_CVI_))
|
||||
#ifndef _NI_FUNC_DEFINED
|
||||
#define NI_FUNC __stdcall
|
||||
#endif
|
||||
|
||||
#ifndef _NI_FUNCC_DEFINED
|
||||
#define NI_FUNCC __cdecl
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
#ifndef _NI_FUNC_DEFINED
|
||||
#define NI_FUNC
|
||||
#endif
|
||||
|
||||
#ifndef _NI_FUNCC_DEFINED
|
||||
#define NI_FUNCC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _NI_bool32_DEFINED_
|
||||
#define _NI_bool32_DEFINED_
|
||||
typedef uInt32 bool32;
|
||||
#endif
|
||||
|
||||
#ifndef _NI_IMAQdxSession_DEFINED_
|
||||
#define _NI_IMAQdxSession_DEFINED_
|
||||
typedef uInt32 IMAQdxSession;
|
||||
#endif
|
||||
|
||||
#define IMAQDX_MAX_API_STRING_LENGTH 512
|
||||
|
||||
//==============================================================================
|
||||
// Forward Declare Data Structures
|
||||
//==============================================================================
|
||||
typedef struct Image_struct Image;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Error Codes Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxError_enum {
|
||||
IMAQdxErrorSuccess = 0x0, // Success
|
||||
IMAQdxErrorSystemMemoryFull = 0xBFF69000, // Not enough memory
|
||||
IMAQdxErrorInternal, // Internal error
|
||||
IMAQdxErrorInvalidParameter, // Invalid parameter
|
||||
IMAQdxErrorInvalidPointer, // Invalid pointer
|
||||
IMAQdxErrorInvalidInterface, // Invalid camera session
|
||||
IMAQdxErrorInvalidRegistryKey, // Invalid registry key
|
||||
IMAQdxErrorInvalidAddress, // Invalid address
|
||||
IMAQdxErrorInvalidDeviceType, // Invalid device type
|
||||
IMAQdxErrorNotImplemented, // Not implemented
|
||||
IMAQdxErrorCameraNotFound, // Camera not found
|
||||
IMAQdxErrorCameraInUse, // Camera is already in use.
|
||||
IMAQdxErrorCameraNotInitialized, // Camera is not initialized.
|
||||
IMAQdxErrorCameraRemoved, // Camera has been removed.
|
||||
IMAQdxErrorCameraRunning, // Acquisition in progress.
|
||||
IMAQdxErrorCameraNotRunning, // No acquisition in progress.
|
||||
IMAQdxErrorAttributeNotSupported, // Attribute not supported by the camera.
|
||||
IMAQdxErrorAttributeNotSettable, // Unable to set attribute.
|
||||
IMAQdxErrorAttributeNotReadable, // Unable to get attribute.
|
||||
IMAQdxErrorAttributeOutOfRange, // Attribute value is out of range.
|
||||
IMAQdxErrorBufferNotAvailable, // Requested buffer is unavailable.
|
||||
IMAQdxErrorBufferListEmpty, // Buffer list is empty. Add one or more buffers.
|
||||
IMAQdxErrorBufferListLocked, // Buffer list is already locked. Reconfigure acquisition and try again.
|
||||
IMAQdxErrorBufferListNotLocked, // No buffer list. Reconfigure acquisition and try again.
|
||||
IMAQdxErrorResourcesAllocated, // Transfer engine resources already allocated. Reconfigure acquisition and try again.
|
||||
IMAQdxErrorResourcesUnavailable, // Insufficient transfer engine resources.
|
||||
IMAQdxErrorAsyncWrite, // Unable to perform asychronous register write.
|
||||
IMAQdxErrorAsyncRead, // Unable to perform asychronous register read.
|
||||
IMAQdxErrorTimeout, // Timeout.
|
||||
IMAQdxErrorBusReset, // Bus reset occurred during a transaction.
|
||||
IMAQdxErrorInvalidXML, // Unable to load camera's XML file.
|
||||
IMAQdxErrorFileAccess, // Unable to read/write to file.
|
||||
IMAQdxErrorInvalidCameraURLString, // Camera has malformed URL string.
|
||||
IMAQdxErrorInvalidCameraFile, // Invalid camera file.
|
||||
IMAQdxErrorGenICamError, // Unknown Genicam error.
|
||||
IMAQdxErrorFormat7Parameters, // For format 7: The combination of speed, image position, image size, and color coding is incorrect.
|
||||
IMAQdxErrorInvalidAttributeType, // The attribute type is not compatible with the passed variable type.
|
||||
IMAQdxErrorDLLNotFound, // The DLL could not be found.
|
||||
IMAQdxErrorFunctionNotFound, // The function could not be found.
|
||||
IMAQdxErrorLicenseNotActivated, // License not activated.
|
||||
IMAQdxErrorCameraNotConfiguredForListener, // The camera is not configured properly to support a listener.
|
||||
IMAQdxErrorCameraMulticastNotAvailable, // Unable to configure the system for multicast support.
|
||||
IMAQdxErrorBufferHasLostPackets, // The requested buffer has lost packets and the user requested an error to be generated.
|
||||
IMAQdxErrorGiGEVisionError, // Unknown GiGE Vision error.
|
||||
IMAQdxErrorNetworkError, // Unknown network error.
|
||||
IMAQdxErrorCameraUnreachable, // Unable to connect to the camera.
|
||||
IMAQdxErrorHighPerformanceNotSupported, // High performance acquisition is not supported on the specified network interface. Connect the camera to a network interface running the high performance driver.
|
||||
IMAQdxErrorInterfaceNotRenamed, // Unable to rename interface. Invalid or duplicate name specified.
|
||||
IMAQdxErrorNoSupportedVideoModes, // The camera does not have any video modes which are supported.
|
||||
IMAQdxErrorSoftwareTriggerOverrun, // Software trigger overrun.
|
||||
IMAQdxErrorTestPacketNotReceived, // The system did not receive a test packet from the camera. The packet size may be too large for the network configuration or a firewall may be enabled.
|
||||
IMAQdxErrorCorruptedImageReceived, // The camera returned a corrupted image.
|
||||
IMAQdxErrorCameraConfigurationHasChanged, // The camera did not return an image of the correct type it was configured for previously.
|
||||
IMAQdxErrorCameraInvalidAuthentication, // The camera is configured with password authentication and either the user name and password were not configured or they are incorrect.
|
||||
IMAQdxErrorUnknownHTTPError, // The camera returned an unknown HTTP error.
|
||||
IMAQdxErrorKernelDriverUnavailable, // Unable to attach to the kernel mode driver.
|
||||
IMAQdxErrorPixelFormatDecoderUnavailable, // No decoder available for selected pixel format.
|
||||
IMAQdxErrorFirmwareUpdateNeeded, // The acquisition hardware needs a firmware update before it can be used.
|
||||
IMAQdxErrorFirmwareUpdateRebootNeeded, // The firmware on the acquisition hardware has been updated and the system must be rebooted before use.
|
||||
IMAQdxErrorLightingCurrentOutOfRange, // The requested current level from the lighting controller is not possible.
|
||||
IMAQdxErrorUSB3VisionError, // Unknown USB3 Vision error.
|
||||
IMAQdxErrorInvalidU3VUSBDescriptor, // The camera has a USB descriptor that is incompatible with the USB3 Vision specification.
|
||||
IMAQdxErrorU3VInvalidControlInterface, // The USB3 Vision control interface is not implemented or is invalid on this camera.
|
||||
IMAQdxErrorU3VControlInterfaceError, // There was an error from the control interface of the USB3 Vision camera.
|
||||
IMAQdxErrorU3VInvalidEventInterface, // The USB3 Vision event interface is not implemented or is invalid on this camera.
|
||||
IMAQdxErrorU3VEventInterfaceError, // There was an error from the event interface of the USB3 Vision camera.
|
||||
IMAQdxErrorU3VInvalidStreamInterface, // The USB3 Vision stream interface is not implemented or is invalid on this camera.
|
||||
IMAQdxErrorU3VStreamInterfaceError, // There was an error from the stream interface of the USB3 Vision camera.
|
||||
IMAQdxErrorU3VUnsupportedConnectionSpeed, // The USB connection speed is not supported by the camera. Check whether the camera is plugged into a USB 2.0 port instead of a USB 3.0 port. If so, verify that the camera supports this use case.
|
||||
IMAQdxErrorU3VInsufficientPower, // The USB3 Vision camera requires more current than can be supplied by the USB port in use.
|
||||
IMAQdxErrorU3VInvalidMaxCurrent, // The U3V_MaximumCurrentUSB20_mA registry value is not valid for the connected USB3 Vision camera.
|
||||
IMAQdxErrorBufferIncompleteData, // The requested buffer has incomplete data and the user requested an error to be generated.
|
||||
IMAQdxErrorCameraAcquisitionConfigFailed, // The camera returned an error starting the acquisition.
|
||||
IMAQdxErrorCameraClosePending, // The camera still has outstanding references and will be closed when these operations complete.
|
||||
IMAQdxErrorSoftwareFault, // An unexpected software error occurred.
|
||||
IMAQdxErrorCameraPropertyInvalid, // The value for an invalid camera property was requested.
|
||||
IMAQdxErrorJumboFramesNotEnabled, // Jumbo frames are not enabled on the host. Maximum packet size is 1500 bytes.
|
||||
IMAQdxErrorBayerPixelFormatNotSelected, // This operation requires that the camera has a Bayer pixel format selected.
|
||||
IMAQdxErrorGuard = 0xFFFFFFFF,
|
||||
} IMAQdxError;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Bus Type Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxBusType_enum {
|
||||
IMAQdxBusTypeFireWire = 0x31333934,
|
||||
IMAQdxBusTypeEthernet = 0x69707634,
|
||||
IMAQdxBusTypeSimulator = 0x2073696D,
|
||||
IMAQdxBusTypeDirectShow = 0x64736877,
|
||||
IMAQdxBusTypeIP = 0x4950636D,
|
||||
IMAQdxBusTypeSmartCam2 = 0x53436132,
|
||||
IMAQdxBusTypeUSB3Vision = 0x55534233,
|
||||
IMAQdxBusTypeUVC = 0x55564320,
|
||||
IMAQdxBusTypeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxBusType;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Camera Control Mode Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxCameraControlMode_enum {
|
||||
IMAQdxCameraControlModeController,
|
||||
IMAQdxCameraControlModeListener,
|
||||
IMAQdxCameraControlModeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxCameraControlMode;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Buffer Number Mode Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxBufferNumberMode_enum {
|
||||
IMAQdxBufferNumberModeNext,
|
||||
IMAQdxBufferNumberModeLast,
|
||||
IMAQdxBufferNumberModeBufferNumber,
|
||||
IMAQdxBufferNumberModeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxBufferNumberMode;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Plug n Play Event Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxPnpEvent_enum {
|
||||
IMAQdxPnpEventCameraAttached,
|
||||
IMAQdxPnpEventCameraDetached,
|
||||
IMAQdxPnpEventBusReset,
|
||||
IMAQdxPnpEventGuard = 0xFFFFFFFF,
|
||||
} IMAQdxPnpEvent;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Bayer Pattern Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxBayerPattern_enum {
|
||||
IMAQdxBayerPatternNone,
|
||||
IMAQdxBayerPatternGB,
|
||||
IMAQdxBayerPatternGR,
|
||||
IMAQdxBayerPatternBG,
|
||||
IMAQdxBayerPatternRG,
|
||||
IMAQdxBayerPatternHardware,
|
||||
IMAQdxBayerPatternGuard = 0xFFFFFFFF,
|
||||
} IMAQdxBayerPattern;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Bayer Decode Algorithm Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxBayerAlgorithm_enum {
|
||||
IMAQdxBayerAlgorithmBilinear,
|
||||
IMAQdxBayerAlgorithmVNG,
|
||||
IMAQdxBayerAlgorithmGuard = 0xFFFFFFFF,
|
||||
} IMAQdxBayerAlgorithm;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Output Image Types -- Values match Vision Development Module image types
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxOutputImageType_enum {
|
||||
IMAQdxOutputImageTypeU8 = 0,
|
||||
IMAQdxOutputImageTypeI16 = 1,
|
||||
IMAQdxOutputImageTypeU16 = 7,
|
||||
IMAQdxOutputImageTypeRGB32 = 4,
|
||||
IMAQdxOutputImageTypeRGB64 = 6,
|
||||
IMAQdxOutputImageTypeAuto = 0x7FFFFFFF,
|
||||
IMAQdxOutputImageTypeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxOutputImageType;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Controller Destination Mode Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxDestinationMode_enum {
|
||||
IMAQdxDestinationModeUnicast,
|
||||
IMAQdxDestinationModeBroadcast,
|
||||
IMAQdxDestinationModeMulticast,
|
||||
IMAQdxDestinationModeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxDestinationMode;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Attribute Type Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxAttributeType_enum {
|
||||
IMAQdxAttributeTypeU32,
|
||||
IMAQdxAttributeTypeI64,
|
||||
IMAQdxAttributeTypeF64,
|
||||
IMAQdxAttributeTypeString,
|
||||
IMAQdxAttributeTypeEnum,
|
||||
IMAQdxAttributeTypeBool,
|
||||
IMAQdxAttributeTypeCommand,
|
||||
IMAQdxAttributeTypeBlob,
|
||||
IMAQdxAttributeTypeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxAttributeType;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Value Type Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxValueType_enum {
|
||||
IMAQdxValueTypeU32,
|
||||
IMAQdxValueTypeI64,
|
||||
IMAQdxValueTypeF64,
|
||||
IMAQdxValueTypeString,
|
||||
IMAQdxValueTypeEnumItem,
|
||||
IMAQdxValueTypeBool,
|
||||
IMAQdxValueTypeDisposableString,
|
||||
IMAQdxValueTypeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxValueType;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Interface File Flags Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxInterfaceFileFlags_enum {
|
||||
IMAQdxInterfaceFileFlagsConnected = 0x1,
|
||||
IMAQdxInterfaceFileFlagsDirty = 0x2,
|
||||
IMAQdxInterfaceFileFlagsGuard = 0xFFFFFFFF,
|
||||
} IMAQdxInterfaceFileFlags;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Overwrite Mode Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxOverwriteMode_enum {
|
||||
IMAQdxOverwriteModeGetOldest = 0x0,
|
||||
IMAQdxOverwriteModeFail = 0x2,
|
||||
IMAQdxOverwriteModeGetNewest = 0x3,
|
||||
IMAQdxOverwriteModeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxOverwriteMode;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Incomplete Buffer Mode Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxIncompleteBufferMode_enum {
|
||||
IMAQdxIncompleteBufferModeIgnore,
|
||||
IMAQdxIncompleteBufferModeFail,
|
||||
IMAQdxIncompleteBufferModeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxIncompleteBufferMode;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Lost Packet Mode Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxLostPacketMode_enum {
|
||||
IMAQdxLostPacketModeIgnore,
|
||||
IMAQdxLostPacketModeFail,
|
||||
IMAQdxLostPacketModeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxLostPacketMode;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Attribute Visibility Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxAttributeVisibility_enum {
|
||||
IMAQdxAttributeVisibilitySimple = 0x00001000,
|
||||
IMAQdxAttributeVisibilityIntermediate = 0x00002000,
|
||||
IMAQdxAttributeVisibilityAdvanced = 0x00004000,
|
||||
IMAQdxAttributeVisibilityGuard = 0xFFFFFFFF,
|
||||
} IMAQdxAttributeVisibility;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Stream Channel Mode Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxStreamChannelMode_enum {
|
||||
IMAQdxStreamChannelModeAutomatic,
|
||||
IMAQdxStreamChannelModeManual,
|
||||
IMAQdxStreamChannelModeGuard = 0xFFFFFFFF,
|
||||
} IMAQdxStreamChannelMode;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Pixel Signedness Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxPixelSignedness_enum {
|
||||
IMAQdxPixelSignednessUnsigned,
|
||||
IMAQdxPixelSignednessSigned,
|
||||
IMAQdxPixelSignednessHardware,
|
||||
IMAQdxPixelSignednessGuard = 0xFFFFFFFF,
|
||||
} IMAQdxPixelSignedness;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// USB Connection Speed Enumeration
|
||||
//==============================================================================
|
||||
typedef enum IMAQdxUSBConnectionSpeed_enum {
|
||||
IMAQdxUSBConnectionSpeedLow = 1,
|
||||
IMAQdxUSBConnectionSpeedFull = 2,
|
||||
IMAQdxUSBConnectionSpeedHigh = 4,
|
||||
IMAQdxUSBConnectionSpeedSuper = 8,
|
||||
IMAQdxUSBConnectionSpeedGuard = 0xFFFFFFFF,
|
||||
} IMAQdxUSBConnectionSpeed;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// CVI Structures
|
||||
//==============================================================================
|
||||
#pragma pack(push, 4)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Camera Information Structure
|
||||
//==============================================================================
|
||||
typedef struct IMAQdxCameraInformation_struct {
|
||||
uInt32 Type;
|
||||
uInt32 Version;
|
||||
uInt32 Flags;
|
||||
uInt32 SerialNumberHi;
|
||||
uInt32 SerialNumberLo;
|
||||
IMAQdxBusType BusType;
|
||||
char InterfaceName[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
char VendorName[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
char ModelName[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
char CameraFileName[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
char CameraAttributeURL[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
} IMAQdxCameraInformation;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Camera File Structure
|
||||
//==============================================================================
|
||||
typedef struct IMAQdxCameraFile_struct {
|
||||
uInt32 Type;
|
||||
uInt32 Version;
|
||||
char FileName[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
} IMAQdxCameraFile;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Attribute Information Structure
|
||||
//==============================================================================
|
||||
typedef struct IMAQdxAttributeInformation_struct {
|
||||
IMAQdxAttributeType Type;
|
||||
bool32 Readable;
|
||||
bool32 Writable;
|
||||
char Name[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
} IMAQdxAttributeInformation;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Enumeration Item Structure
|
||||
//==============================================================================
|
||||
typedef struct IMAQdxEnumItem_struct {
|
||||
uInt32 Value;
|
||||
uInt32 Reserved;
|
||||
char Name[IMAQDX_MAX_API_STRING_LENGTH];
|
||||
} IMAQdxEnumItem;
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Camera Information Structure
|
||||
//==============================================================================
|
||||
typedef IMAQdxEnumItem IMAQdxVideoMode;
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Callbacks
|
||||
//==============================================================================
|
||||
typedef uInt32 (NI_FUNC *FrameDoneEventCallbackPtr)(IMAQdxSession id, uInt32 bufferNumber, void* callbackData);
|
||||
typedef uInt32 (NI_FUNC *PnpEventCallbackPtr)(IMAQdxSession id, IMAQdxPnpEvent pnpEvent, void* callbackData);
|
||||
typedef void (NI_FUNC *AttributeUpdatedEventCallbackPtr)(IMAQdxSession id, const char* name, void* callbackData);
|
||||
|
||||
#endif //niimaqdx_types
|
||||
//==============================================================================
|
||||
// Attributes
|
||||
//==============================================================================
|
||||
#define IMAQdxAttributeBaseAddress "CameraInformation::BaseAddress" // Read only. Gets the base address of the camera registers.
|
||||
#define IMAQdxAttributeBusType "CameraInformation::BusType" // Read only. Gets the bus type of the camera.
|
||||
#define IMAQdxAttributeModelName "CameraInformation::ModelName" // Read only. Returns the model name.
|
||||
#define IMAQdxAttributeSerialNumberHigh "CameraInformation::SerialNumberHigh" // Read only. Gets the upper 32-bits of the camera 64-bit serial number.
|
||||
#define IMAQdxAttributeSerialNumberLow "CameraInformation::SerialNumberLow" // Read only. Gets the lower 32-bits of the camera 64-bit serial number.
|
||||
#define IMAQdxAttributeVendorName "CameraInformation::VendorName" // Read only. Returns the vendor name.
|
||||
#define IMAQdxAttributeHostIPAddress "CameraInformation::HostIPAddress" // Read only. Returns the host adapter IP address.
|
||||
#define IMAQdxAttributeIPAddress "CameraInformation::IPAddress" // Read only. Returns the IP address.
|
||||
#define IMAQdxAttributePrimaryURLString "CameraInformation::PrimaryURLString" // Read only. Gets the camera's primary URL string.
|
||||
#define IMAQdxAttributeSecondaryURLString "CameraInformation::SecondaryURLString" // Read only. Gets the camera's secondary URL string.
|
||||
#define IMAQdxAttributeAcqInProgress "StatusInformation::AcqInProgress" // Read only. Gets the current state of the acquisition. TRUE if acquiring; otherwise FALSE.
|
||||
#define IMAQdxAttributeLastBufferCount "StatusInformation::LastBufferCount" // Read only. Gets the number of transferred buffers.
|
||||
#define IMAQdxAttributeLastBufferNumber "StatusInformation::LastBufferNumber" // Read only. Gets the last cumulative buffer number transferred.
|
||||
#define IMAQdxAttributeLostBufferCount "StatusInformation::LostBufferCount" // Read only. Gets the number of lost buffers during an acquisition session.
|
||||
#define IMAQdxAttributeLostPacketCount "StatusInformation::LostPacketCount" // Read only. Gets the number of lost packets during an acquisition session.
|
||||
#define IMAQdxAttributeRequestedResendPackets "StatusInformation::RequestedResendPacketCount" // Read only. Gets the number of packets requested to be resent during an acquisition session.
|
||||
#define IMAQdxAttributeReceivedResendPackets "StatusInformation::ReceivedResendPackets" // Read only. Gets the number of packets that were requested to be resent during an acquisition session and were completed.
|
||||
#define IMAQdxAttributeHandledEventCount "StatusInformation::HandledEventCount" // Read only. Gets the number of handled events during an acquisition session.
|
||||
#define IMAQdxAttributeLostEventCount "StatusInformation::LostEventCount" // Read only. Gets the number of lost events during an acquisition session.
|
||||
#define IMAQdxAttributeBayerGainB "AcquisitionAttributes::Bayer::GainB" // Sets/gets the white balance gain for the blue component of the Bayer conversion.
|
||||
#define IMAQdxAttributeBayerGainG "AcquisitionAttributes::Bayer::GainG" // Sets/gets the white balance gain for the green component of the Bayer conversion.
|
||||
#define IMAQdxAttributeBayerGainR "AcquisitionAttributes::Bayer::GainR" // Sets/gets the white balance gain for the red component of the Bayer conversion.
|
||||
#define IMAQdxAttributeBayerPattern "AcquisitionAttributes::Bayer::Pattern" // Sets/gets the Bayer pattern to use.
|
||||
#define IMAQdxAttributeStreamChannelMode "AcquisitionAttributes::Controller::StreamChannelMode" // Gets/sets the mode for allocating a FireWire stream channel.
|
||||
#define IMAQdxAttributeDesiredStreamChannel "AcquisitionAttributes::Controller::DesiredStreamChannel" // Gets/sets the stream channel to manually allocate.
|
||||
#define IMAQdxAttributeFrameInterval "AcquisitionAttributes::FrameInterval" // Read only. Gets the duration in milliseconds between successive frames.
|
||||
#define IMAQdxAttributeIgnoreFirstFrame "AcquisitionAttributes::IgnoreFirstFrame" // Gets/sets the video delay of one frame between starting the camera and receiving the video feed.
|
||||
#define IMAQdxAttributeOffsetX "OffsetX" // Gets/sets the left offset of the image.
|
||||
#define IMAQdxAttributeOffsetY "OffsetY" // Gets/sets the top offset of the image.
|
||||
#define IMAQdxAttributeWidth "Width" // Gets/sets the width of the image.
|
||||
#define IMAQdxAttributeHeight "Height" // Gets/sets the height of the image.
|
||||
#define IMAQdxAttributePixelFormat "PixelFormat" // Gets/sets the pixel format of the source sensor.
|
||||
#define IMAQdxAttributePacketSize "PacketSize" // Gets/sets the packet size in bytes.
|
||||
#define IMAQdxAttributePayloadSize "PayloadSize" // Gets/sets the frame size in bytes.
|
||||
#define IMAQdxAttributeSpeed "AcquisitionAttributes::Speed" // Gets/sets the transfer speed in Mbps for a FireWire packet.
|
||||
#define IMAQdxAttributeShiftPixelBits "AcquisitionAttributes::ShiftPixelBits" // Gets/sets the alignment of 16-bit cameras. Downshift the pixel bits if the camera returns most significant bit-aligned data.
|
||||
#define IMAQdxAttributeSwapPixelBytes "AcquisitionAttributes::SwapPixelBytes" // Gets/sets the endianness of 16-bit cameras. Swap the pixel bytes if the camera returns little endian data.
|
||||
#define IMAQdxAttributeOverwriteMode "AcquisitionAttributes::OverwriteMode" // Gets/sets the overwrite mode, used to determine acquisition when an image transfer cannot be completed due to an overwritten internal buffer.
|
||||
#define IMAQdxAttributeTimeout "AcquisitionAttributes::Timeout" // Gets/sets the timeout value in milliseconds, used to abort an acquisition when the image transfer cannot be completed within the delay.
|
||||
#define IMAQdxAttributeVideoMode "AcquisitionAttributes::VideoMode" // Gets/sets the video mode for a camera.
|
||||
#define IMAQdxAttributeBitsPerPixel "AcquisitionAttributes::BitsPerPixel" // Gets/sets the actual bits per pixel. For 16-bit components, this represents the actual bit depth (10-, 12-, 14-, or 16-bit).
|
||||
#define IMAQdxAttributePixelSignedness "AcquisitionAttributes::PixelSignedness" // Gets/sets the signedness of the pixel. For 16-bit components, this represents the actual pixel signedness (Signed, or Unsigned).
|
||||
#define IMAQdxAttributeReserveDualPackets "AcquisitionAttributes::ReserveDualPackets" // Gets/sets if dual packets will be reserved for a very large FireWire packet.
|
||||
#define IMAQdxAttributeReceiveTimestampMode "AcquisitionAttributes::ReceiveTimestampMode" // Gets/sets the mode for timestamping images received by the driver.
|
||||
#define IMAQdxAttributeActualPeakBandwidth "AcquisitionAttributes::AdvancedEthernet::BandwidthControl::ActualPeakBandwidth" // Read only. Returns the actual maximum peak bandwidth the camera will be configured to use.
|
||||
#define IMAQdxAttributeDesiredPeakBandwidth "AcquisitionAttributes::AdvancedEthernet::BandwidthControl::DesiredPeakBandwidth" // Gets/sets the desired maximum peak bandwidth the camera should use.
|
||||
#define IMAQdxAttributeDestinationMode "AcquisitionAttributes::AdvancedEthernet::Controller::DestinationMode" // Gets/Sets where the camera is instructed to send the image stream.
|
||||
#define IMAQdxAttributeDestinationMulticastAddress "AcquisitionAttributes::AdvancedEthernet::Controller::DestinationMulticastAddress" // Gets/Sets the multicast address the camera should send data in multicast mode.
|
||||
#define IMAQdxAttributeEventsEnabled "AcquisitionAttributes::AdvancedEthernet::EventParameters::EventsEnabled" // Gets/Sets if events will be handled.
|
||||
#define IMAQdxAttributeMaxOutstandingEvents "AcquisitionAttributes::AdvancedEthernet::EventParameters::MaxOutstandingEvents" // Gets/Sets the maximum number of outstanding events to queue.
|
||||
#define IMAQdxAttributeTestPacketEnabled "AcquisitionAttributes::AdvancedEthernet::TestPacketParameters::TestPacketEnabled" // Gets/Sets whether the driver will validate the image streaming settings using test packets prior to an acquisition
|
||||
#define IMAQdxAttributeTestPacketTimeout "AcquisitionAttributes::AdvancedEthernet::TestPacketParameters::TestPacketTimeout" // Gets/Sets the timeout for validating test packet reception (if enabled)
|
||||
#define IMAQdxAttributeMaxTestPacketRetries "AcquisitionAttributes::AdvancedEthernet::TestPacketParameters::MaxTestPacketRetries" // Gets/Sets the number of retries for validating test packet reception (if enabled)
|
||||
#define IMAQdxAttributeChunkDataDecodingEnabled "AcquisitionAttributes::ChunkDataDecoding::ChunkDataDecodingEnabled" // Gets/Sets whether the driver will decode any chunk data in the image stream
|
||||
#define IMAQdxAttributeChunkDataDecodingMaxElementSize "AcquisitionAttributes::ChunkDataDecoding::MaximumChunkCopySize" // Gets/Sets the maximum size of any single chunk data element that will be made available
|
||||
#define IMAQdxAttributeLostPacketMode "AcquisitionAttributes::AdvancedEthernet::LostPacketMode" // Gets/sets the behavior when the user extracts a buffer that has missing packets.
|
||||
#define IMAQdxAttributeMemoryWindowSize "AcquisitionAttributes::AdvancedEthernet::ResendParameters::MemoryWindowSize" // Gets/sets the size of the memory window of the camera in kilobytes. Should match the camera's internal buffer size.
|
||||
#define IMAQdxAttributeResendsEnabled "AcquisitionAttributes::AdvancedEthernet::ResendParameters::ResendsEnabled" // Gets/sets if resends will be issued for missing packets.
|
||||
#define IMAQdxAttributeResendThresholdPercentage "AcquisitionAttributes::AdvancedEthernet::ResendParameters::ResendThresholdPercentage" // Gets/sets the threshold of the packet processing window that will trigger packets to be resent.
|
||||
#define IMAQdxAttributeResendBatchingPercentage "AcquisitionAttributes::AdvancedEthernet::ResendParameters::ResendBatchingPercentage" // Gets/sets the percent of the packet resend threshold that will be issued as one group past the initial threshold sent in a single request.
|
||||
#define IMAQdxAttributeMaxResendsPerPacket "AcquisitionAttributes::AdvancedEthernet::ResendParameters::MaxResendsPerPacket" // Gets/sets the maximum number of resend requests that will be issued for a missing packet.
|
||||
#define IMAQdxAttributeResendResponseTimeout "AcquisitionAttributes::AdvancedEthernet::ResendParameters::ResendResponseTimeout" // Gets/sets the time to wait for a resend request to be satisfied before sending another.
|
||||
#define IMAQdxAttributeNewPacketTimeout "AcquisitionAttributes::AdvancedEthernet::ResendParameters::NewPacketTimeout" // Gets/sets the time to wait for new packets to arrive in a partially completed image before assuming the rest of the image was lost.
|
||||
#define IMAQdxAttributeMissingPacketTimeout "AcquisitionAttributes::AdvancedEthernet::ResendParameters::MissingPacketTimeout" // Gets/sets the time to wait for a missing packet before issuing a resend.
|
||||
#define IMAQdxAttributeResendTimerResolution "AcquisitionAttributes::AdvancedEthernet::ResendParameters::ResendTimerResolution" // Gets/sets the resolution of the packet processing system that is used for all packet-related timeouts.
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Functions
|
||||
//==============================================================================
|
||||
IMAQdxError NI_FUNC IMAQdxSnap(IMAQdxSession id, Image* image);
|
||||
IMAQdxError NI_FUNC IMAQdxConfigureGrab(IMAQdxSession id);
|
||||
IMAQdxError NI_FUNC IMAQdxGrab(IMAQdxSession id, Image* image, bool32 waitForNextBuffer, uInt32* actualBufferNumber);
|
||||
IMAQdxError NI_FUNC IMAQdxSequence(IMAQdxSession id, Image* images[], uInt32 count);
|
||||
IMAQdxError NI_FUNC IMAQdxDiscoverEthernetCameras(const char* address, uInt32 timeout);
|
||||
IMAQdxError NI_FUNC IMAQdxEnumerateCameras(IMAQdxCameraInformation cameraInformationArray[], uInt32* count, bool32 connectedOnly);
|
||||
IMAQdxError NI_FUNC IMAQdxResetCamera(const char* name, bool32 resetAll);
|
||||
IMAQdxError NI_FUNC IMAQdxOpenCamera(const char* name, IMAQdxCameraControlMode mode, IMAQdxSession* id);
|
||||
IMAQdxError NI_FUNC IMAQdxCloseCamera(IMAQdxSession id);
|
||||
IMAQdxError NI_FUNC IMAQdxConfigureAcquisition(IMAQdxSession id, bool32 continuous, uInt32 bufferCount);
|
||||
IMAQdxError NI_FUNC IMAQdxStartAcquisition(IMAQdxSession id);
|
||||
IMAQdxError NI_FUNC IMAQdxGetImage(IMAQdxSession id, Image* image, IMAQdxBufferNumberMode mode, uInt32 desiredBufferNumber, uInt32* actualBufferNumber);
|
||||
IMAQdxError NI_FUNC IMAQdxGetImageData(IMAQdxSession id, void* buffer, uInt32 bufferSize, IMAQdxBufferNumberMode mode, uInt32 desiredBufferNumber, uInt32* actualBufferNumber);
|
||||
IMAQdxError NI_FUNC IMAQdxStopAcquisition(IMAQdxSession id);
|
||||
IMAQdxError NI_FUNC IMAQdxUnconfigureAcquisition(IMAQdxSession id);
|
||||
IMAQdxError NI_FUNC IMAQdxEnumerateVideoModes(IMAQdxSession id, IMAQdxVideoMode videoModeArray[], uInt32* count, uInt32* currentMode);
|
||||
IMAQdxError NI_FUNC IMAQdxEnumerateAttributes(IMAQdxSession id, IMAQdxAttributeInformation attributeInformationArray[], uInt32* count, const char* root);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttribute(IMAQdxSession id, const char* name, IMAQdxValueType type, void* value);
|
||||
IMAQdxError NI_FUNCC IMAQdxSetAttribute(IMAQdxSession id, const char* name, IMAQdxValueType type, ...);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMinimum(IMAQdxSession id, const char* name, IMAQdxValueType type, void* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMaximum(IMAQdxSession id, const char* name, IMAQdxValueType type, void* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeIncrement(IMAQdxSession id, const char* name, IMAQdxValueType type, void* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeType(IMAQdxSession id, const char* name, IMAQdxAttributeType* type);
|
||||
IMAQdxError NI_FUNC IMAQdxIsAttributeReadable(IMAQdxSession id, const char* name, bool32* readable);
|
||||
IMAQdxError NI_FUNC IMAQdxIsAttributeWritable(IMAQdxSession id, const char* name, bool32* writable);
|
||||
IMAQdxError NI_FUNC IMAQdxEnumerateAttributeValues(IMAQdxSession id, const char* name, IMAQdxEnumItem list[], uInt32* size);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeTooltip(IMAQdxSession id, const char* name, char* tooltip, uInt32 length);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeUnits(IMAQdxSession id, const char* name, char* units, uInt32 length);
|
||||
IMAQdxError NI_FUNC IMAQdxRegisterFrameDoneEvent(IMAQdxSession id, uInt32 bufferInterval, FrameDoneEventCallbackPtr callbackFunction, void* callbackData);
|
||||
IMAQdxError NI_FUNC IMAQdxRegisterPnpEvent(IMAQdxSession id, IMAQdxPnpEvent event, PnpEventCallbackPtr callbackFunction, void* callbackData);
|
||||
IMAQdxError NI_FUNC IMAQdxWriteRegister(IMAQdxSession id, uInt32 offset, uInt32 value);
|
||||
IMAQdxError NI_FUNC IMAQdxReadRegister(IMAQdxSession id, uInt32 offset, uInt32* value);
|
||||
IMAQdxError NI_FUNC IMAQdxWriteMemory(IMAQdxSession id, uInt32 offset, const char* values, uInt32 count);
|
||||
IMAQdxError NI_FUNC IMAQdxReadMemory(IMAQdxSession id, uInt32 offset, char* values, uInt32 count);
|
||||
IMAQdxError NI_FUNC IMAQdxGetErrorString(IMAQdxError error, char* message, uInt32 messageLength);
|
||||
IMAQdxError NI_FUNC IMAQdxWriteAttributes(IMAQdxSession id, const char* filename);
|
||||
IMAQdxError NI_FUNC IMAQdxReadAttributes(IMAQdxSession id, const char* filename);
|
||||
IMAQdxError NI_FUNC IMAQdxResetEthernetCameraAddress(const char* name, const char* address, const char* subnet, const char* gateway, uInt32 timeout);
|
||||
IMAQdxError NI_FUNC IMAQdxEnumerateAttributes2(IMAQdxSession id, IMAQdxAttributeInformation attributeInformationArray[], uInt32* count, const char* root, IMAQdxAttributeVisibility visibility);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeVisibility(IMAQdxSession id, const char* name, IMAQdxAttributeVisibility* visibility);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeDescription(IMAQdxSession id, const char* name, char* description, uInt32 length);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeDisplayName(IMAQdxSession id, const char* name, char* displayName, uInt32 length);
|
||||
IMAQdxError NI_FUNC IMAQdxDispose(void* buffer);
|
||||
IMAQdxError NI_FUNC IMAQdxRegisterAttributeUpdatedEvent(IMAQdxSession id, const char* name, AttributeUpdatedEventCallbackPtr callbackFunction, void* callbackData);
|
||||
IMAQdxError NI_FUNC IMAQdxEnumerateAttributes3(IMAQdxSession id, IMAQdxAttributeInformation attributeInformationArray[], uInt32* count, const char* root, IMAQdxAttributeVisibility visibility);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // ___niimaqdx_h___
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,63 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeU32(IMAQdxSession id, const char* name,
|
||||
uInt32* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeI64(IMAQdxSession id, const char* name,
|
||||
Int64* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeF64(IMAQdxSession id, const char* name,
|
||||
float64* value);
|
||||
IMAQdxError NI_FUNC
|
||||
IMAQdxGetAttributeString(IMAQdxSession id, const char* name,
|
||||
char value[IMAQDX_MAX_API_STRING_LENGTH]);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeEnum(IMAQdxSession id, const char* name,
|
||||
IMAQdxEnumItem* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeBool(IMAQdxSession id, const char* name,
|
||||
bool32* value);
|
||||
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMinimumU32(IMAQdxSession id,
|
||||
const char* name,
|
||||
uInt32* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMinimumI64(IMAQdxSession id,
|
||||
const char* name,
|
||||
Int64* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMinimumF64(IMAQdxSession id,
|
||||
const char* name,
|
||||
float64* value);
|
||||
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMaximumU32(IMAQdxSession id,
|
||||
const char* name,
|
||||
uInt32* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMaximumI64(IMAQdxSession id,
|
||||
const char* name,
|
||||
Int64* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeMaximumF64(IMAQdxSession id,
|
||||
const char* name,
|
||||
float64* value);
|
||||
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeIncrementU32(IMAQdxSession id,
|
||||
const char* name,
|
||||
uInt32* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeIncrementI64(IMAQdxSession id,
|
||||
const char* name,
|
||||
Int64* value);
|
||||
IMAQdxError NI_FUNC IMAQdxGetAttributeIncrementF64(IMAQdxSession id,
|
||||
const char* name,
|
||||
float64* value);
|
||||
|
||||
IMAQdxError NI_FUNC IMAQdxSetAttributeU32(IMAQdxSession id, const char* name,
|
||||
uInt32 value);
|
||||
IMAQdxError NI_FUNC IMAQdxSetAttributeI64(IMAQdxSession id, const char* name,
|
||||
Int64 value);
|
||||
IMAQdxError NI_FUNC IMAQdxSetAttributeF64(IMAQdxSession id, const char* name,
|
||||
float64 value);
|
||||
IMAQdxError NI_FUNC IMAQdxSetAttributeString(IMAQdxSession id, const char* name,
|
||||
const char* value);
|
||||
IMAQdxError NI_FUNC IMAQdxSetAttributeEnum(IMAQdxSession id, const char* name,
|
||||
const IMAQdxEnumItem* value);
|
||||
IMAQdxError NI_FUNC IMAQdxSetAttributeBool(IMAQdxSession id, const char* name,
|
||||
bool32 value);
|
||||
@@ -1,5 +0,0 @@
|
||||
[IMAQdxGetAttributeString]
|
||||
outparams=value
|
||||
|
||||
[Block Comment]
|
||||
exclude=
|
||||
@@ -1,21 +0,0 @@
|
||||
IMAQdxGetAttributeU32
|
||||
IMAQdxGetAttributeI64
|
||||
IMAQdxGetAttributeF64
|
||||
IMAQdxGetAttributeString
|
||||
IMAQdxGetAttributeEnum
|
||||
IMAQdxGetAttributeBool
|
||||
IMAQdxGetAttributeMinimumU32
|
||||
IMAQdxGetAttributeMinimumI64
|
||||
IMAQdxGetAttributeMinimumF64
|
||||
IMAQdxGetAttributeMaximumU32
|
||||
IMAQdxGetAttributeMaximumI64
|
||||
IMAQdxGetAttributeMaximumF64
|
||||
IMAQdxGetAttributeIncrementU32
|
||||
IMAQdxGetAttributeIncrementI64
|
||||
IMAQdxGetAttributeIncrementF64
|
||||
IMAQdxSetAttributeU32
|
||||
IMAQdxSetAttributeI64
|
||||
IMAQdxSetAttributeF64
|
||||
IMAQdxSetAttributeString
|
||||
IMAQdxSetAttributeEnum
|
||||
IMAQdxSetAttributeBool
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,121 +0,0 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import configparser
|
||||
except ImportError:
|
||||
import ConfigParser as configparser
|
||||
|
||||
from nivision_parse import *
|
||||
|
||||
|
||||
class StructSizerEmitter:
|
||||
def __init__(self, out, config, hname):
|
||||
self.out = out
|
||||
self.config = config
|
||||
print("""#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <{hname}>
|
||||
|
||||
int main()
|
||||
{{
|
||||
asm("#STRUCT_SIZER [_platform_]\\n");
|
||||
asm("#STRUCT_SIZER pointer=%0\\n" : : "n"((int)sizeof(void*)));
|
||||
""".format(hname=hname), file=self.out)
|
||||
|
||||
def finish(self):
|
||||
print("}", file=self.out)
|
||||
|
||||
def config_get(self, section, option, fallback):
|
||||
try:
|
||||
return self.config.get(section, option)
|
||||
except (ValueError, configparser.NoSectionError, configparser.NoOptionError):
|
||||
return fallback
|
||||
|
||||
def config_getboolean(self, section, option, fallback):
|
||||
try:
|
||||
return self.config.getboolean(section, option)
|
||||
except (ValueError, configparser.NoSectionError, configparser.NoOptionError):
|
||||
return fallback
|
||||
|
||||
def block_comment(self, comment):
|
||||
pass
|
||||
|
||||
def opaque_struct(self, name):
|
||||
pass
|
||||
|
||||
def define(self, name, value, comment):
|
||||
pass
|
||||
|
||||
def text(self, text):
|
||||
print(text, file=self.out)
|
||||
|
||||
def static_const(self, name, ctype, value):
|
||||
pass
|
||||
|
||||
def enum(self, name, values):
|
||||
pass
|
||||
|
||||
def typedef(self, name, typedef, arr):
|
||||
pass
|
||||
|
||||
def typedef_function(self, name, restype, params):
|
||||
pass
|
||||
|
||||
def function(self, name, restype, params):
|
||||
pass
|
||||
|
||||
def structunion(self, ctype, name, fields):
|
||||
if name in opaque_structs:
|
||||
return
|
||||
|
||||
print('asm("#STRUCT_SIZER [{name}]\\n");'.format(name=name), file=self.out)
|
||||
print('asm("#STRUCT_SIZER _SIZE_=%0\\n" : : "n"((int)sizeof({name})));'.format(name=name),
|
||||
file=self.out)
|
||||
|
||||
for fname, ftype, arr, comment in fields:
|
||||
if ':' in fname:
|
||||
continue # can't handle bitfields
|
||||
print(
|
||||
'asm("#STRUCT_SIZER {field}=%0\\n" : : "n"((int)offsetof({name}, {field})));'.format(
|
||||
name=name, field=fname), file=self.out)
|
||||
|
||||
def struct(self, name, fields):
|
||||
self.structunion("Structure", name, fields)
|
||||
|
||||
def union(self, name, fields):
|
||||
self.structunion("Union", name, fields)
|
||||
|
||||
|
||||
def generate(srcdir, configpath=None, hpath=None):
|
||||
# read config file
|
||||
config = configparser.ConfigParser()
|
||||
config.read(configpath)
|
||||
block_comment_exclude = set(x.strip() for x in
|
||||
config.get("Block Comment", "exclude").splitlines())
|
||||
|
||||
# open input file
|
||||
inf = open(hpath)
|
||||
|
||||
# prescan for undefined structures
|
||||
prescan_file(inf)
|
||||
inf.seek(0)
|
||||
|
||||
# generate
|
||||
with open("struct_sizer.c", "wt") as out:
|
||||
emit = StructSizerEmitter(out, config, os.path.basename(hpath))
|
||||
parse_file(emit, inf, block_comment_exclude)
|
||||
emit.finish()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: gen_struct_sizer.py <header.h> <config.ini>")
|
||||
exit(0)
|
||||
|
||||
fname = sys.argv[1]
|
||||
configname = sys.argv[2]
|
||||
|
||||
generate("", configname, fname)
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
#This script should be able to generate the JNI
|
||||
# bindings for NIVision. At some point,
|
||||
# it should be integrated into the build system.
|
||||
# Assumes running from allwpilib/wpilibj/wpilibJavaJNI/nivision
|
||||
|
||||
# Get structure sizes.
|
||||
python gen_struct_sizer.py ../../../wpilibc/wpilibC++Devices/include/nivision.h nivision_2011.ini
|
||||
arm-frc-linux-gnueabi-gcc -I../../../wpilibc/wpilibC++Devices/include -S struct_sizer.c
|
||||
cat struct_sizer.s | python get_struct_size.py > nivision_arm.ini
|
||||
|
||||
python gen_struct_sizer.py ../../../wpilibc/wpilibC++Devices/include/NIIMAQdx.h imaqdx.ini
|
||||
arm-frc-linux-gnueabi-gcc -I../../../wpilibc/wpilibC++Devices/include -S struct_sizer.c
|
||||
cat struct_sizer.s | python get_struct_size.py > imaqdx_arm.ini
|
||||
|
||||
# Get functions actually in the .so; some functions are in the header but
|
||||
# not the shared library!
|
||||
arm-frc-linux-gnueabi-nm -D ../../../ni-libraries/libnivision.so.14.0.0 | cut -c 12- | grep ^imaq > nivision_funcs.txt
|
||||
echo Priv_ReadJPEGString_C >> nivision_funcs.txt
|
||||
arm-frc-linux-gnueabi-nm -D ../../../ni-libraries/libniimaqdx.so.14.0.0 | cut -c 12- | grep ^IMAQdx > imaqdx_funcs.txt
|
||||
|
||||
# Run python generator.
|
||||
python gen_java.py \
|
||||
../../../wpilibc/wpilibC++Devices/include/nivision.h \
|
||||
nivision_arm.ini \
|
||||
nivision_2011.ini \
|
||||
nivision_funcs.txt \
|
||||
\
|
||||
../../../wpilibc/wpilibC++Devices/include/NIIMAQdx.h \
|
||||
imaqdx_arm.ini \
|
||||
imaqdx.ini \
|
||||
imaqdx_funcs.txt \
|
||||
\
|
||||
dxattr.h \
|
||||
imaqdx_arm.ini \
|
||||
dxattr.ini \
|
||||
dxattr_funcs.txt
|
||||
|
||||
# Stick generated files into appropriate places.
|
||||
cp NIVision.cpp ../lib/NIVisionJNI.cpp
|
||||
mkdir -p ../../wpilibJavaDevices/src/main/java/com/ni/vision
|
||||
cp *.java ../../wpilibJavaDevices/src/main/java/com/ni/vision/
|
||||
@@ -1,17 +0,0 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
for line in sys.stdin:
|
||||
line = line.strip()
|
||||
if not line.startswith("#STRUCT_SIZER"):
|
||||
continue
|
||||
line = line[14:]
|
||||
line = line.replace("#", "")
|
||||
print(line)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,80 +0,0 @@
|
||||
[Block Comment]
|
||||
exclude=
|
||||
Typedefs
|
||||
Forward Declare Data Structures
|
||||
Error Codes Enumeration
|
||||
Callbacks
|
||||
|
||||
; Error Codes Enumeration
|
||||
[IMAQdxError]
|
||||
|
||||
; Callbacks
|
||||
[FrameDoneEventCallbackPtr]
|
||||
exclude=True
|
||||
[PnpEventCallbackPtr]
|
||||
exclude=True
|
||||
[AttributeUpdatedEventCallbackPtr]
|
||||
exclude=True
|
||||
|
||||
; Functions
|
||||
[IMAQdxSequence]
|
||||
arraysize=images:count
|
||||
exclude=True
|
||||
[IMAQdxEnumerateCameras]
|
||||
arraysize=cameraInformationArray:count
|
||||
exclude=True
|
||||
[IMAQdxGetImageData]
|
||||
#arraysize=buffer:bufferSize
|
||||
[IMAQdxEnumerateVideoModes]
|
||||
arraysize=videoModeArray:count
|
||||
exclude=True
|
||||
[IMAQdxEnumerateAttributes]
|
||||
arraysize=attributeInformationArray:count
|
||||
exclude=True
|
||||
[IMAQdxGetAttribute]
|
||||
exclude=True
|
||||
[IMAQdxSetAttribute]
|
||||
# has to be manual due to "..."
|
||||
exclude=True
|
||||
[IMAQdxGetAttributeMinimum]
|
||||
exclude=True
|
||||
[IMAQdxGetAttributeMaximum]
|
||||
exclude=True
|
||||
[IMAQdxGetAttributeIncrement]
|
||||
exclude=True
|
||||
[IMAQdxEnumerateAttributeValues]
|
||||
arraysize=list:size
|
||||
exclude=True
|
||||
[IMAQdxGetAttributeTooltip]
|
||||
exclude=True
|
||||
[IMAQdxGetAttributeUnits]
|
||||
exclude=True
|
||||
[IMAQdxRegisterFrameDoneEvent]
|
||||
# callback
|
||||
exclude=True
|
||||
[IMAQdxRegisterPnpEvent]
|
||||
# callback
|
||||
exclude=True
|
||||
[IMAQdxWriteMemory]
|
||||
arraysize=values:count
|
||||
exclude=True
|
||||
[IMAQdxReadMemory]
|
||||
arraysize=values:count
|
||||
exclude=True
|
||||
[IMAQdxGetErrorString]
|
||||
exclude=True
|
||||
[IMAQdxEnumerateAttributes2]
|
||||
arraysize=attributeInformationArray:count
|
||||
exclude=True
|
||||
[IMAQdxGetAttributeDescription]
|
||||
exclude=True
|
||||
[IMAQdxGetAttributeDisplayName]
|
||||
exclude=True
|
||||
[IMAQdxDispose]
|
||||
exclude=True
|
||||
[IMAQdxRegisterAttributeUpdatedEvent]
|
||||
# callback
|
||||
exclude=True
|
||||
[IMAQdxEnumerateAttributes3]
|
||||
arraysize=attributeInformationArray:count
|
||||
exclude=True
|
||||
@@ -1,840 +0,0 @@
|
||||
;
|
||||
; [name]
|
||||
; arraysize -- comma separated list of "param:numParam" where param is the
|
||||
; name of the pointer parameter, and numParam is the name of
|
||||
; the parameter that contains the array size for the pointer
|
||||
; retarraysize -- name of the pass-by-reference parameter that on function
|
||||
; return contains the array size of the returned pointer
|
||||
; exclude -- if True, no code is output for this name (full custom)
|
||||
; underscore -- if True, only underscored raw wrapper is output (partial custom)
|
||||
; outparams -- comma separated list of output parameter names
|
||||
; inparams -- comma separated list of parameter names that are input
|
||||
; parameters (e.g. not output parameters)
|
||||
; defaults -- comma separated list of "param:default" where param is the
|
||||
; parameter name and default is the default value
|
||||
; exclude_members -- for structures, members to not emit
|
||||
; nullok -- comma separated list of parameter names that may be null
|
||||
; retref -- parameter that (if non-null) is returned as a reference
|
||||
; retunowned -- if True, return value should not be owned
|
||||
;
|
||||
; The generator code auto-detects many parameters, so this file is only needed
|
||||
; for overriding the auto-detected behavior.
|
||||
|
||||
; defines
|
||||
[IMAQ_IMPORT]
|
||||
exclude=True
|
||||
[IMAQ_FUNC]
|
||||
exclude=True
|
||||
[IMAQ_STDCALL]
|
||||
exclude=True
|
||||
[IMAQ_CALLBACK]
|
||||
exclude=True
|
||||
[IMAQ_DEFAULT_LEARNING_MODE]
|
||||
exclude=True
|
||||
[ERR_INVALID_COLORCOMPLEXITY]
|
||||
exclude=True
|
||||
|
||||
; structures
|
||||
[PolyModel]
|
||||
arraysize=kCoeffs:numKCoeffs
|
||||
[CalibrationReferencePoints]
|
||||
arraysize=pixelCoords:numPixelCoords,realCoords:numRealCoords
|
||||
[GetCameraParametersReport]
|
||||
#TODO: projectionMatrix:projectionMatrixRows*projectionMatrixCols
|
||||
exclude_members=projectionMatrix
|
||||
[GetCalibrationInfoReport]
|
||||
#TODO: errorMap:errorMapRows*errorMapCols
|
||||
exclude_members=errorMap
|
||||
[ContourFitSplineReport]
|
||||
arraysize=points:numberOfPoints
|
||||
[ContourFitPolynomialReport]
|
||||
arraysize=bestFit:numberOfPoints,polynomialCoefficients:numberOfCoefficients
|
||||
[SetupMatchPatternData]
|
||||
arraysize=matchSetupData:numMatchSetupData
|
||||
[ContourInfoReport]
|
||||
arraysize=pointsPixel:numPointsPixel,pointsReal:numPointsReal,curvaturePixel:numCurvaturePixel,curvatureReal:numCurvatureReal
|
||||
[SupervisedColorSegmentationReport]
|
||||
arraysize=labelOut:numLabelOut
|
||||
[LabelToROIReport]
|
||||
arraysize=roiArray:numOfROIs,labelsOutArray:numOfLabels,isTooManyVectorsArray:isTooManyVectorsArraySize
|
||||
[ClassifiedCurve]
|
||||
arraysize=curvePoints:numCurvePoints
|
||||
[CurvatureAnalysisReport]
|
||||
arraysize=curves:numCurves
|
||||
[ComputeDistancesReport]
|
||||
arraysize=distances:numDistances,distancesReal:numDistancesReal
|
||||
[ClassifiedDisparity]
|
||||
arraysize=templateSubsection:numTemplateSubsection,targetSubsection:numTargetSubsection
|
||||
[ClassifyDistancesReport]
|
||||
arraysize=classifiedDistances:numClassifiedDistances
|
||||
[ContourComputeCurvatureReport]
|
||||
arraysize=curvaturePixel:numCurvaturePixel,curvatureReal:numCurvatureReal
|
||||
[ExtractContourReport]
|
||||
arraysize=contourPoints:numContourPoints,sourcePoints:numSourcePoints
|
||||
[ExtractTextureFeaturesReport]
|
||||
arraysize=waveletBands:numWaveletBands
|
||||
#TODO: textureFeatures:textureFeaturesRows:textureFeaturesCols
|
||||
exclude_members=textureFeatures
|
||||
[WaveletBandsReport]
|
||||
#TODO: LLBand:rows:cols
|
||||
#TODO: LHBand:rows:cols
|
||||
#TODO: HLBand:rows:cols
|
||||
#TODO: HHBand:rows:cols
|
||||
#TODO: LLLBand:rows:cols
|
||||
#TODO: LLHBand:rows:cols
|
||||
#TODO: LHHBand:rows:cols
|
||||
exclude_members=LLBand,LHBand,HLBand,HHBand,LLLBand,LLHBand,LHHBand
|
||||
[MeasureParticlesReport]
|
||||
#TODO: pixelMeasurements:numParticles:numMeasurements
|
||||
#TODO: calibratedMeasurements:numParticles:numMeasurements
|
||||
exclude_members=pixelMeasurements,calibratedMeasurements
|
||||
[ClassifierReportAdvanced]
|
||||
arraysize=allScores:allScoresSize,sampleScores:sampleScoresSize
|
||||
[FindEdgeReport]
|
||||
arraysize=straightEdges:numStraightEdges
|
||||
[ReadTextReport3]
|
||||
arraysize=characterReport:numCharacterReports
|
||||
[EdgeReport2]
|
||||
arraysize=edges:numEdges,gradientInfo:numGradientInfo
|
||||
[ConcentricRakeReport2]
|
||||
arraysize=firstEdges:numFirstEdges,lastEdges:numLastEdges,searchArcs:numSearchArcs
|
||||
[SpokeReport2]
|
||||
arraysize=firstEdges:numFirstEdges,lastEdges:numLastEdges,searchLines:numSearchLines
|
||||
[RakeReport2]
|
||||
arraysize=firstEdges:numFirstEdges,lastEdges:numLastEdges,searchLines:numSearchLines
|
||||
[QRCodeDataToken]
|
||||
arraysize=data:dataLength
|
||||
[StraightEdgeReport2]
|
||||
arraysize=straightEdges:numStraightEdges,searchLines:numSearchLines
|
||||
[StraightEdge]
|
||||
arraysize=usedEdges:numUsedEdges
|
||||
[QRCodeReport]
|
||||
arraysize=data:dataLength,tokenizedData:sizeOfTokenizedData
|
||||
[DataMatrixReport]
|
||||
arraysize=data:dataLength
|
||||
[ReadTextReport2]
|
||||
arraysize=characterReport:numCharacterReports
|
||||
[FeatureData]
|
||||
arraysize=contourPoints:numContourPoints
|
||||
uniontype=feature:type:IMAQ_CIRCLE_FEATURE=circle:IMAQ_ELLIPSE_FEATURE=ellipse:IMAQ_CONST_CURVE_FEATURE=constCurve:IMAQ_RECTANGLE_FEATURE=rectangle:IMAQ_LEG_FEATURE=leg:IMAQ_CORNER_FEATURE=corner:IMAQ_PARALLEL_LINE_PAIR_FEATURE=parallelLinePair:IMAQ_PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE=pairOfParallelLinePairs:IMAQ_LINE_FEATURE=line:IMAQ_CLOSED_CURVE_FEATURE=closedCurve
|
||||
[GeometricPatternMatch2]
|
||||
arraysize=featureData:numFeatureData
|
||||
[ShapeDetectionOptions]
|
||||
arraysize=angleRanges:numAngleRanges
|
||||
[Curve]
|
||||
arraysize=points:numPoints
|
||||
[Barcode2DInfo]
|
||||
arraysize=data:dataLength
|
||||
[ClassifierAccuracyReport]
|
||||
arraysize=classNames:size,classAccuracy:size,classPredictiveValue:size
|
||||
#TODO: classificationDistribution:classPredictiveValue:size
|
||||
exclude_members=classificationDistribution
|
||||
[NearestNeighborTrainingReport]
|
||||
arraysize=allScores:allScoresSize
|
||||
#TODO: classDistancesTable
|
||||
exclude_members=classDistancesTable
|
||||
[ClassifierSampleInfo]
|
||||
arraysize=featureVector:featureVectorSize
|
||||
[ClassifierReport]
|
||||
arraysize=allScores:allScoresSize
|
||||
[MatchGeometricPatternOptions]
|
||||
arraysize=angleRanges:numAngleRanges
|
||||
[ConstructROIOptions2]
|
||||
arraysize=palette:numColors
|
||||
[BestEllipse2]
|
||||
arraysize=pointsUsed:numPointsUsed
|
||||
[BestCircle2]
|
||||
arraysize=pointsUsed:numPointsUsed
|
||||
[ReadTextOptions]
|
||||
arraysize=validChars:numValidChars
|
||||
[ReadTextReport]
|
||||
arraysize=characterReport:numCharacterReports
|
||||
[EdgeLocationReport]
|
||||
arraysize=edges:numEdges
|
||||
[ImageInfo]
|
||||
#TODO: imageStart
|
||||
exclude_members=reserved0,reserved1,imageStart
|
||||
[LCDReport]
|
||||
arraysize=segmentInfo:numCharacters
|
||||
exclude_members=reserved
|
||||
[LCDSegments]
|
||||
exclude_members=reserved
|
||||
[LearnColorPatternOptions]
|
||||
arraysize=colorsToIgnore:numColorsToIgnore
|
||||
[LinearAverages]
|
||||
arraysize=columnAverages:columnCount,rowAverages:rowCount,risingDiagAverages:risingDiagCount,fallingDiagAverages:fallingDiagCount
|
||||
[LineProfile]
|
||||
arraysize=profileData:dataCount
|
||||
[MatchColorPatternOptions]
|
||||
arraysize=angleRanges:numRanges
|
||||
[HistogramReport]
|
||||
arraysize=histogram:histogramCount
|
||||
[BestLine]
|
||||
arraysize=pointsUsed:numPointsUsed
|
||||
[CalibrationInfo]
|
||||
#TODO: errorMap:mapColumns*mapRows
|
||||
exclude_members=errorMap
|
||||
[CalibrationPoints]
|
||||
arraysize=pixelCoordinates:numCoordinates,realWorldCoordinates:numCoordinates
|
||||
[CaliperReport]
|
||||
exclude_members=reserved
|
||||
[ClosedContour]
|
||||
arraysize=points:numPoints
|
||||
[ColorInformation]
|
||||
arraysize=info:infoCount
|
||||
[ConcentricRakeReport]
|
||||
arraysize=rakeArcs:numArcs,firstEdges:numFirstEdges,lastEdges:numLastEdges,allEdges:numLinesWithEdges,linesWithEdges:numLinesWithEdges
|
||||
[ConstructROIOptions]
|
||||
arraysize=palette:numColors
|
||||
[ContourInfo]
|
||||
arraysize=points:numPoints
|
||||
[ContourInfo2]
|
||||
uniontype=structure:type:IMAQ_POINT=point:IMAQ_LINE=line:IMAQ_RECT=rect:IMAQ_OVAL=ovalBoundingBox:IMAQ_CLOSED_CONTOUR=closedContour:IMAQ_OPEN_CONTOUR=openContour:IMAQ_ANNULUS=annulus:IMAQ_ROTATED_RECT=rotatedRect
|
||||
[UserPointSymbol]
|
||||
#TODO: pixels:cols*rows
|
||||
exclude_members=pixels
|
||||
[MatchPatternOptions]
|
||||
arraysize=angleRanges:numRanges
|
||||
[OpenContour]
|
||||
arraysize=points:numPoints
|
||||
[QuantifyReport]
|
||||
arraysize=regions:regionCount
|
||||
[RakeReport]
|
||||
arraysize=rakeLines:numRakeLines,firstEdges:numFirstEdges,lastEdges:numLastEdges,allEdges:numLinesWithEdges,linesWithEdges:numLinesWithEdges
|
||||
[TransformReport]
|
||||
arraysize=points:numPoints,validPoints:numPoints
|
||||
[MeterArc]
|
||||
arraysize=arcCoordPoints:numOfArcCoordPoints
|
||||
[StructuringElement]
|
||||
#TODO: arraysize=kernel:matrixRows*matrixCols
|
||||
exclude_members=kernel
|
||||
[SpokeReport]
|
||||
arraysize=spokeLines:numSpokeLines,firstEdges:numFirstEdges,lastEdges:numLastEdges,allEdges:numLinesWithEdges,linesWithEdges:numLinesWithEdges
|
||||
[ToolWindowOptions]
|
||||
exclude_members=reserved2,reserved3,reserved4
|
||||
[EventCallback]
|
||||
exclude=True
|
||||
|
||||
; Logical functions
|
||||
; TODO: constant versions
|
||||
[imaqAndConstant]
|
||||
exclude=True
|
||||
[imaqCompareConstant]
|
||||
exclude=True
|
||||
[imaqLogicalDifferenceConstant]
|
||||
exclude=True
|
||||
[imaqNandConstant]
|
||||
exclude=True
|
||||
[imaqNorConstant]
|
||||
exclude=True
|
||||
[imaqOrConstant]
|
||||
exclude=True
|
||||
[imaqXnorConstant]
|
||||
exclude=True
|
||||
[imaqXorConstant]
|
||||
exclude=True
|
||||
|
||||
; Arithmetic functions
|
||||
; TODO: constant versions
|
||||
[imaqAbsoluteDifferenceConstant]
|
||||
exclude=True
|
||||
[imaqAddConstant]
|
||||
exclude=True
|
||||
[imaqAverageConstant]
|
||||
exclude=True
|
||||
[imaqDivideConstant2]
|
||||
exclude=True
|
||||
[imaqMaxConstant2]
|
||||
exclude=True
|
||||
[imaqMinConstant]
|
||||
exclude=True
|
||||
[imaqModuloConstant]
|
||||
exclude=True
|
||||
[imaqMultiplyConstant]
|
||||
exclude=True
|
||||
[imaqSubtractConstant]
|
||||
exclude=True
|
||||
|
||||
; Particle Analysis functions
|
||||
[imaqCountParticles]
|
||||
outparams=numParticles
|
||||
[imaqMeasureParticle]
|
||||
outparams=value
|
||||
[imaqMeasureParticles]
|
||||
arraysize=measurements:numMeasurements
|
||||
[imaqParticleFilter4]
|
||||
arraysize=criteria:criteriaCount
|
||||
outparams=numParticles
|
||||
nullok=roi
|
||||
|
||||
; Morphology functions
|
||||
[imaqFindCircles]
|
||||
retarraysize=numCircles
|
||||
[imaqLabel2]
|
||||
outparams=particleCount
|
||||
[imaqMorphology]
|
||||
nullok=structuringElement
|
||||
[imaqSeparation]
|
||||
nullok=structuringElement
|
||||
[imaqSimpleDistance]
|
||||
nullok=structuringElement
|
||||
[imaqSizeFilter]
|
||||
nullok=structuringElement
|
||||
|
||||
; Acquisition functions
|
||||
[imaqCopyFromRing]
|
||||
nullok=image,imageNumber
|
||||
outparams=imageNumber
|
||||
retref=image
|
||||
[imaqExtractFromRing]
|
||||
nullok=imageNumber
|
||||
outparams=imageNumber
|
||||
retunowned=True
|
||||
[imaqGrab]
|
||||
nullok=image
|
||||
retref=image
|
||||
[imaqSetupRing]
|
||||
arraysize=images:numImages
|
||||
inparams=images
|
||||
[imaqSetupSequence]
|
||||
arraysize=images:numImages
|
||||
inparams=images
|
||||
[imaqSnap]
|
||||
nullok=image
|
||||
retref=image
|
||||
|
||||
; Caliper functions
|
||||
[imaqCaliperTool]
|
||||
retarraysize=numEdgePairs
|
||||
arraysize=points:numPoints
|
||||
[imaqDetectExtremes]
|
||||
retarraysize=numExtremes
|
||||
arraysize=pixels:numPixels
|
||||
[imaqFindTransformRect2]
|
||||
outparams=baseSystem,newSystem,axisReport
|
||||
[imaqFindTransformRects2]
|
||||
outparams=baseSystem,newSystem,axisReport
|
||||
[imaqSimpleEdge]
|
||||
retarraysize=numEdges
|
||||
arraysize=points:numPoints
|
||||
|
||||
; Spatial Filters functions
|
||||
[imaqCannyEdgeFilter]
|
||||
nullok=options
|
||||
[imaqConvolve2]
|
||||
inparams=kernel
|
||||
exclude=True
|
||||
[imaqEdgeFilter]
|
||||
nullok=mask
|
||||
[imaqLowPass]
|
||||
nullok=mask
|
||||
[imaqMedianFilter]
|
||||
nullok=mask
|
||||
[imaqNthOrderFilter]
|
||||
nullok=mask
|
||||
|
||||
; Drawing functions
|
||||
[imaqDrawTextOnImage]
|
||||
nullok=options,fontNameUsed
|
||||
|
||||
; Interlacing functions
|
||||
[imaqInterlaceSeparate]
|
||||
nullok=odd,even
|
||||
|
||||
; Image Information functions
|
||||
[imaqEnumerateCustomKeys]
|
||||
retarraysize=size
|
||||
[imaqGetImageSize]
|
||||
nullok=width,height
|
||||
[imaqGetPixelAddress]
|
||||
underscored=True
|
||||
exclude=True
|
||||
[imaqReadCustomData]
|
||||
retsize=size
|
||||
retunowned=True
|
||||
[imaqWriteCustomData]
|
||||
size=data:size
|
||||
|
||||
; Display functions
|
||||
[imaqGetLastKey]
|
||||
nullok=keyPressed,windowNumber,modifiers
|
||||
[imaqGetSystemWindowHandle]
|
||||
exclude=True
|
||||
[imaqGetWindowCenterPos]
|
||||
outparams=centerPosition
|
||||
|
||||
; Image Manipulation functions
|
||||
[imaqCast]
|
||||
nullok=lookup
|
||||
exclude=True
|
||||
[imaqFlatten]
|
||||
retsize=size
|
||||
[imaqRotate2]
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqShift]
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqUnflatten]
|
||||
size=data:size
|
||||
|
||||
; File I/O functions
|
||||
[imaqGetAVIInfo]
|
||||
outparams=info
|
||||
[imaqGetFileInfo]
|
||||
nullok=calibrationUnit,calibrationX,calibrationY,width,height,imageType
|
||||
[imaqGetFilterNames]
|
||||
retarraysize=numFilters
|
||||
[imaqLoadImagePopup]
|
||||
retarraysize=numPaths
|
||||
[imaqReadAVIFrame]
|
||||
size=data:dataSize
|
||||
# unclear whether dataSize is input or output parameter
|
||||
exclude=True
|
||||
[imaqReadFile]
|
||||
;nullok=colorTable,numColors
|
||||
;arraysize=colorTable:numColors
|
||||
[imaqWriteAVIFrame]
|
||||
size=data:dataLength
|
||||
[imaqWriteBMPFile]
|
||||
nullok=colorTable
|
||||
defaults=colorTable:null
|
||||
[imaqWriteFile]
|
||||
nullok=colorTable
|
||||
defaults=colorTable:null
|
||||
[imaqWriteJPEGFile]
|
||||
nullok=colorTable
|
||||
defaults=colorTable:null
|
||||
inparams=colorTable
|
||||
[imaqWritePNGFile2]
|
||||
nullok=colorTable
|
||||
defaults=colorTable:null
|
||||
[imaqWriteTIFFFile]
|
||||
nullok=options,colorTable
|
||||
defaults=options:null,colorTable:null
|
||||
|
||||
; Analytic Geometry functions
|
||||
[imaqBuildCoordinateSystem]
|
||||
outparams=system
|
||||
[imaqFitCircle2]
|
||||
arraysize=points:numPoints
|
||||
[imaqFitEllipse2]
|
||||
arraysize=points:numPoints
|
||||
[imaqFitLine]
|
||||
arraysize=points:numPoints
|
||||
[imaqGetBisectingLine]
|
||||
outparams=bisectStart,bisectEnd
|
||||
[imaqGetIntersection]
|
||||
outparams=intersection
|
||||
[imaqGetMidLine]
|
||||
outparams=midLineStart,midLineEnd
|
||||
[imaqGetPerpendicularLine]
|
||||
outparams=perpLineStart,perpLineEnd
|
||||
[imaqGetPointsOnContour]
|
||||
retarraysize=numSegments
|
||||
[imaqGetPointsOnLine]
|
||||
retarraysize=numPoints
|
||||
[imaqInterpolatePoints]
|
||||
retarraysize=interpCount
|
||||
arraysize=points:numPoints
|
||||
|
||||
; Clipboard functions
|
||||
[imaqClipboardToImage]
|
||||
nullok=palette
|
||||
[imaqImageToClipboard]
|
||||
nullok=palette
|
||||
|
||||
; Image Management functions
|
||||
[imaqCreateImage]
|
||||
defaults=borderSize:0
|
||||
[imaqImageToArray]
|
||||
nullok=columns,rows
|
||||
underscored=True
|
||||
exclude=True
|
||||
|
||||
; Color Processing functions
|
||||
[imaqChangeColorSpace2]
|
||||
# TODO because of Color2
|
||||
exclude=True
|
||||
[imaqColorBCGTransform]
|
||||
nullok=redOptions,greenOptions,blueOptions,mask
|
||||
[imaqColorHistogram2]
|
||||
nullok=mask
|
||||
[imaqColorLookup]
|
||||
nullok=mask,plane1,plane2,plane3
|
||||
exclude=True
|
||||
[imaqColorThreshold]
|
||||
nullok=plane1Range,plane2Range,plane3Range
|
||||
|
||||
; Transform functions
|
||||
[imaqBCGTransform]
|
||||
nullok=mask
|
||||
[imaqEqualize]
|
||||
nullok=mask
|
||||
[imaqInverse]
|
||||
nullok=mask
|
||||
[imaqMathTransform]
|
||||
nullok=mask
|
||||
[imaqLookup2]
|
||||
nullok=mask
|
||||
exclude=True
|
||||
|
||||
; Window Management functions
|
||||
[imaqGetMousePos]
|
||||
nullok=position,windowNumber
|
||||
[imaqGetWindowBackground]
|
||||
outparams=backgroundColor
|
||||
[imaqGetWindowDisplayMapping]
|
||||
outparams=mapping
|
||||
[imaqGetWindowGrid]
|
||||
nullok=xResolution,yResolution
|
||||
[imaqGetWindowPos]
|
||||
outparams=position
|
||||
[imaqGetWindowSize]
|
||||
nullok=width,height
|
||||
[imaqSetWindowPalette]
|
||||
arraysize=palette:numColors
|
||||
nullok=palette
|
||||
|
||||
; Utilities functions
|
||||
; Many Make* functions are faster in native Python
|
||||
[imaqGetKernel]
|
||||
exclude=True
|
||||
[imaqMakeAnnulus]
|
||||
exclude=True
|
||||
[imaqMakePoint]
|
||||
exclude=True
|
||||
[imaqMakePointFloat]
|
||||
exclude=True
|
||||
[imaqMakeRect]
|
||||
exclude=True
|
||||
[imaqMakeRectFromRotatedRect]
|
||||
exclude=True
|
||||
[imaqMakeRotatedRect]
|
||||
exclude=True
|
||||
[imaqMakeRotatedRectFromRect]
|
||||
exclude=True
|
||||
[imaqMulticoreOptions]
|
||||
underscored=True
|
||||
|
||||
; Tool Window functions
|
||||
[imaqGetLastEvent]
|
||||
nullok=windowNumber,tool,rect
|
||||
outparams=type,tool,rect
|
||||
[imaqGetToolWindowHandle]
|
||||
exclude=True
|
||||
[imaqGetToolWindowPos]
|
||||
outparams=position
|
||||
[imaqSetEventCallback]
|
||||
exclude=True
|
||||
[imaqSetupToolWindow]
|
||||
nullok=options
|
||||
|
||||
; Meter functions
|
||||
[imaqReadMeter]
|
||||
outparams=endOfNeedle
|
||||
|
||||
; Calibration functions
|
||||
[imaqCorrectCalibratedImage]
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqTransformPixelToRealWorld]
|
||||
arraysize=pixelCoordinates:numCoordinates
|
||||
[imaqTransformRealWorldToPixel]
|
||||
arraysize=realWorldCoordinates:numCoordinates
|
||||
|
||||
; Pixel Manipulation functions
|
||||
[imaqArrayToComplexPlane]
|
||||
exclude=True
|
||||
[imaqComplexPlaneToArray]
|
||||
nullok=columns,rows
|
||||
underscored=True
|
||||
exclude=True
|
||||
[imaqExtractColorPlanes]
|
||||
nullok=plane1,plane2,plane3
|
||||
[imaqFillImage]
|
||||
nullok=mask
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqGetLine]
|
||||
nullok=numPoints
|
||||
underscored=True
|
||||
exclude=True
|
||||
[imaqGetPixel]
|
||||
outparams=value
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqReplaceColorPlanes]
|
||||
nullok=plane1,plane2,plane3
|
||||
[imaqSetLine]
|
||||
underscored=True
|
||||
exclude=True
|
||||
[imaqSetPixel]
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
|
||||
; Color Matching functions
|
||||
[imaqLearnColor]
|
||||
nullok=roi
|
||||
[imaqMatchColor]
|
||||
retarraysize=numScores
|
||||
nullok=roi
|
||||
|
||||
; Barcode I/O functions
|
||||
[imaqGradeDataMatrixBarcodeAIM]
|
||||
outparams=report
|
||||
[imaqReadBarcode]
|
||||
nullok=roi
|
||||
[imaqReadPDF417Barcode]
|
||||
retarraysize=numBarcodes
|
||||
[imaqReadQRCode]
|
||||
defaults=reserved:IMAQ_QR_NO_GRADING
|
||||
|
||||
; LCD functions
|
||||
[imaqFindLCDSegments]
|
||||
nullok=options
|
||||
[imaqReadLCD]
|
||||
nullok=options
|
||||
|
||||
; Shape Matching functions
|
||||
[imaqMatchShape]
|
||||
retarraysize=numMatches
|
||||
|
||||
; Contours functions
|
||||
[imaqAddClosedContour]
|
||||
arraysize=points:numPoints
|
||||
[imaqAddOpenContour]
|
||||
arraysize=points:numPoints
|
||||
[imaqGetContourColor]
|
||||
outparams=contourColor
|
||||
|
||||
; Regions of Interest functions
|
||||
[imaqGetROIBoundingBox]
|
||||
outparams=boundingBox
|
||||
[imaqGetROIColor]
|
||||
outparams=roiColor
|
||||
[imaqSetWindowROI]
|
||||
nullok=roi
|
||||
|
||||
; Image Analysis functions
|
||||
[imaqExtractCurves]
|
||||
retarraysize=numCurves
|
||||
[imaqHistogram]
|
||||
nullok=mask
|
||||
[imaqQuantify]
|
||||
nullok=mask
|
||||
|
||||
; Error Management functions
|
||||
[imaqClearError]
|
||||
exclude=True
|
||||
[imaqGetErrorText]
|
||||
exclude=True
|
||||
[imaqGetLastError]
|
||||
exclude=True
|
||||
[imaqGetLastErrorFunc]
|
||||
exclude=True
|
||||
[imaqSetError]
|
||||
nullok=function
|
||||
exclude=True
|
||||
|
||||
; Threshold functions
|
||||
[imaqMultithreshold]
|
||||
arraysize=ranges:numRanges
|
||||
|
||||
; Memory Management functions
|
||||
[imaqDispose]
|
||||
# This is done as a full-custom function
|
||||
exclude=True
|
||||
|
||||
; Pattern Matching functions
|
||||
[imaqDetectCircles]
|
||||
retarraysize=numMatchesReturned
|
||||
[imaqDetectEllipses]
|
||||
retarraysize=numMatchesReturned
|
||||
[imaqDetectLines]
|
||||
retarraysize=numMatchesReturned
|
||||
[imaqDetectRectangles]
|
||||
retarraysize=numMatchesReturned
|
||||
[imaqGetGeometricFeaturesFromCurves]
|
||||
retarraysize=numFeatures
|
||||
arraysize=curves:numCurves,featureTypes:numFeatureTypes
|
||||
[imaqGetGeometricTemplateFeatureInfo]
|
||||
retarraysize=numFeatures
|
||||
[imaqLearnMultipleGeometricPatterns]
|
||||
arraysize=patterns:numberOfPatterns
|
||||
exclude=True
|
||||
[imaqMatchColorPattern]
|
||||
retarraysize=numMatches
|
||||
[imaqMatchGeometricPattern2]
|
||||
retarraysize=numMatches
|
||||
[imaqMatchMultipleGeometricPatterns]
|
||||
retarraysize=numMatches
|
||||
[imaqReadMultipleGeometricPatternFile]
|
||||
underscored=True
|
||||
[imaqRefineMatches]
|
||||
retarraysize=numCandidatesOut
|
||||
arraysize=candidatesIn:numCandidatesIn
|
||||
[imaqMatchGeometricPattern3]
|
||||
retarraysize=numMatches
|
||||
[imaqMatchPattern3]
|
||||
retarraysize=numMatches
|
||||
nullok=options
|
||||
|
||||
; Overlay functions
|
||||
[imaqGetOverlayProperties]
|
||||
outparams=transformBehaviors
|
||||
[imaqMergeOverlay]
|
||||
arraysize=palette:numColors
|
||||
[imaqOverlayBitmap]
|
||||
underscored=True
|
||||
[imaqOverlayClosedContour]
|
||||
arraysize=points:numPoints
|
||||
[imaqOverlayOpenContour]
|
||||
arraysize=points:numPoints
|
||||
[imaqOverlayPoints]
|
||||
arraysize=points:numPoints,colors:numColors
|
||||
|
||||
; OCR functions
|
||||
[imaqVerifyPatterns]
|
||||
arraysize=expectedPatterns:patternCount
|
||||
retarraysize=numScores
|
||||
[imaqVerifyText]
|
||||
retarraysize=numScores
|
||||
|
||||
; Geometric Matching functions
|
||||
[imaqContourClassifyCurvature]
|
||||
arraysize=curvatureClasses:numCurvatureClasses
|
||||
[imaqContourClassifyDistances]
|
||||
arraysize=distanceRanges:numDistanceRanges
|
||||
[imaqContourSetupMatchPattern]
|
||||
arraysize=rangeSettings:numRangeSettings
|
||||
[imaqContourAdvancedSetupMatchPattern]
|
||||
arraysize=geometricOptions:numGeometricOptions
|
||||
|
||||
; Morphology Reconstruction functions
|
||||
[imaqGrayMorphologyReconstruct]
|
||||
arraysize=points:numOfPoints
|
||||
[imaqMorphologyReconstruct]
|
||||
arraysize=points:numOfPoints
|
||||
|
||||
; Texture functions
|
||||
[imaqClassificationTextureDefectOptions]
|
||||
exclude=True
|
||||
[imaqCooccurrenceMatrix]
|
||||
exclude=True
|
||||
[imaqExtractTextureFeatures]
|
||||
inparams=waveletBands
|
||||
exclude=True
|
||||
[imaqExtractWaveletBands]
|
||||
inparams=waveletBands
|
||||
exclude=True
|
||||
|
||||
; Regions of Interest Manipulation functions
|
||||
[imaqMaskToROI]
|
||||
nullok=withinLimit
|
||||
[imaqROIToMask]
|
||||
nullok=imageModel,inSpace
|
||||
[imaqLabelToROI]
|
||||
arraysize=labelsIn:numLabelsIn
|
||||
|
||||
; Morphology functions
|
||||
[imaqGrayMorphology]
|
||||
nullok=structuringElement
|
||||
|
||||
; Classification functions
|
||||
[imaqAddClassifierSample]
|
||||
arraysize=featureVector:vectorSize
|
||||
[imaqAdvanceClassify]
|
||||
arraysize=featureVector:vectorSize
|
||||
[imaqClassify]
|
||||
arraysize=featureVector:vectorSize
|
||||
[imaqGetColorClassifierOptions]
|
||||
outparams=options
|
||||
[imaqGetNearestNeighborOptions]
|
||||
outparams=options
|
||||
;[imaqReadClassifierFile]
|
||||
;[imaqWriteClassifierFile]
|
||||
|
||||
; Obsolete functions
|
||||
[imaqWritePNGFile]
|
||||
nullok=colorTable
|
||||
defaults=colorTable:null
|
||||
[imaqRotate]
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqSelectParticles]
|
||||
retarraysize=selectedCount
|
||||
[imaqGetParticleInfo]
|
||||
retarraysize=reportCount
|
||||
[imaqEdgeTool]
|
||||
retarraysize=numEdges
|
||||
[imaqCircles]
|
||||
retarraysize=numCircles
|
||||
[imaqFitEllipse]
|
||||
arraysize=points:numPoints
|
||||
outparams=ellipse
|
||||
[imaqFitCircle]
|
||||
arraysize=points:numPoints
|
||||
outparams=circle
|
||||
[imaqChangeColorSpace]
|
||||
# TODO because of Color
|
||||
exclude=True
|
||||
[imaqMatchPattern]
|
||||
retarraysize=numMatches
|
||||
nullok=options
|
||||
[imaqLineGaugeTool]
|
||||
nullok=reference
|
||||
[imaqBestCircle]
|
||||
arraysize=points:numPoints
|
||||
outparams=center
|
||||
[imaqCoordinateReference]
|
||||
outparams=origin
|
||||
[imaqSetWindowOverlay]
|
||||
nullok=overlay
|
||||
[imaqGetCalibrationInfo]
|
||||
outparams=unit,xDistance,yDistance
|
||||
nullok=unit,xDistance,yDistance
|
||||
[imaqGetParticleClassifierOptions]
|
||||
outparams=preprocessingOptions,options
|
||||
[imaqConvolve]
|
||||
nullok=mask
|
||||
inparams=kernel
|
||||
exclude=True
|
||||
[imaqDivideConstant]
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqLookup]
|
||||
nullok=mask
|
||||
exclude=True
|
||||
[imaqMatchPattern2]
|
||||
retarraysize=numMatches
|
||||
nullok=options
|
||||
[imaqMaxConstant]
|
||||
# TODO because of PixelValue
|
||||
exclude=True
|
||||
[imaqParticleFilter2]
|
||||
arraysize=criteria:criteriaCount
|
||||
[imaqEdgeTool2]
|
||||
retarraysize=numEdges
|
||||
[imaqReadDataMatrixBarcode]
|
||||
retarraysize=numBarcodes
|
||||
[imaqMatchGeometricPattern]
|
||||
retarraysize=numMatches
|
||||
[imaqColorHistogram]
|
||||
nullok=mask
|
||||
[Priv_ReadJPEGString_C]
|
||||
arraysize=string:stringLength
|
||||
inparams=image,string
|
||||
|
||||
; block comment exclusion list
|
||||
[Block Comment]
|
||||
exclude=
|
||||
Includes
|
||||
Control Defines
|
||||
Macros
|
||||
This accomplishes said task.
|
||||
If using Visual C++, force startup & shutdown code to run.
|
||||
Error Management functions
|
||||
Callback Function Type
|
||||
Backwards Compatibility
|
||||
Error Codes
|
||||
@@ -1,242 +0,0 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import re
|
||||
import traceback
|
||||
|
||||
__all__ = ["define_after_struct", "defined", "forward_structs", "opaque_structs", "enums",
|
||||
"structs", "prescan_file", "parse_file", "number_re", "constant_re"]
|
||||
|
||||
# parser regular expressions
|
||||
number_re = re.compile(r'-?[0-9]+')
|
||||
constant_re = re.compile(r'[A-Z0-9_]+')
|
||||
define_re = re.compile(r'^#define\s+(?P<name>(IMAQ|ERR)[A-Z0-9_]+)\s+(?P<value>.*)')
|
||||
enum_re = re.compile(r'^typedef\s+enum\s+(?P<name>[A-Za-z0-9]+)_enum\s*{')
|
||||
enum_value_re = re.compile(r'^\s*(?P<name>[A-Za-z0-9_]+)\s*(=\s*(?P<value>-?[0-9A-Fx]+))?\s*,?')
|
||||
struct_re = re.compile(r'^typedef\s+struct\s+(?P<name>[A-Za-z0-9]+)_struct\s*{')
|
||||
union_re = re.compile(r'^typedef\s+union\s+(?P<name>[A-Za-z0-9]+)_union\s*{')
|
||||
func_pointer_re = re.compile(
|
||||
r'\s*(?P<restype>[A-Za-z0-9_*]+)\s*\(\s*[A-Za-z0-9_]*\s*[*]\s*(?P<name>[A-Za-z0-9_]+)\s*\)\s*\((?P<params>[^)]*)\)')
|
||||
static_const_re = re.compile(
|
||||
r'^static\s+const\s+(?P<type>[A-Za-z0-9_]+)\s+(?P<name>[A-Za-z0-9_]+)\s*=\s*(?P<value>[^;]+);')
|
||||
function_re = re.compile(
|
||||
r'^((IMAQ|NI)_FUNC\s+)?(?P<restype>(const\s+)?[A-Za-z0-9_*]+)\s+((IMAQ_STDCALL|NI_FUNC[C]?)\s+)?(?P<name>[A-Za-z0-9_]+)\s*\((?P<params>[^)]*)\);')
|
||||
|
||||
# defines deferred until after structures
|
||||
define_after_struct = []
|
||||
defined = set()
|
||||
forward_structs = set()
|
||||
opaque_structs = set()
|
||||
enums = set()
|
||||
structs = set()
|
||||
|
||||
|
||||
def parse_cdecl(decl):
|
||||
decl = " ".join(decl.split())
|
||||
ctype, sep, name = decl.rpartition(' ')
|
||||
# look for array[]
|
||||
name, bracket, arr = name.partition('[')
|
||||
if arr:
|
||||
arr = arr[:-1]
|
||||
else:
|
||||
arr = None
|
||||
return name, ctype, arr
|
||||
|
||||
|
||||
def split_comment(line):
|
||||
if line.startswith('/*'):
|
||||
return "", ""
|
||||
parts = line.split('//', 1)
|
||||
code = parts[0].strip()
|
||||
comment = parts[1].strip() if len(parts) > 1 else None
|
||||
return code, comment
|
||||
|
||||
|
||||
def prescan_file(f):
|
||||
for line in f:
|
||||
code, comment = split_comment(line)
|
||||
if not code and not comment:
|
||||
continue
|
||||
|
||||
# typedef struct {
|
||||
m = struct_re.match(code)
|
||||
if m is not None:
|
||||
structs.add(m.group('name'))
|
||||
continue
|
||||
|
||||
# other typedef
|
||||
if code.startswith("typedef"):
|
||||
if '(' in code:
|
||||
continue
|
||||
name, typedef, arr = parse_cdecl(code[8:-1])
|
||||
if typedef.startswith("struct"):
|
||||
forward_structs.add(name)
|
||||
continue
|
||||
|
||||
opaque_structs.update(forward_structs - structs)
|
||||
|
||||
|
||||
def parse_file(emit, f, block_comment_exclude):
|
||||
in_block_comment = False
|
||||
cur_block = ""
|
||||
in_enum = None
|
||||
in_struct = None
|
||||
in_union = None
|
||||
|
||||
for lineno, line in enumerate(f):
|
||||
code, comment = split_comment(line)
|
||||
if not code and not comment:
|
||||
continue
|
||||
# print(comment)
|
||||
|
||||
# in block comment
|
||||
if in_block_comment:
|
||||
if not code and comment is not None and comment[0] == '=':
|
||||
# closing block comment; emit if not excluded
|
||||
if cur_block not in block_comment_exclude:
|
||||
try:
|
||||
emit.block_comment(cur_block)
|
||||
except Exception as e:
|
||||
print("%d: exception in block_comment():\n%s" % (
|
||||
lineno + 1, traceback.format_exc()))
|
||||
in_block_comment = False
|
||||
# emit "after struct" constants in Globals
|
||||
if cur_block == "Globals":
|
||||
for dname, dtext in define_after_struct:
|
||||
try:
|
||||
emit.text(dtext)
|
||||
except Exception as e:
|
||||
print("%d: exception in text():\n%s" % (
|
||||
lineno + 1, traceback.format_exc()))
|
||||
defined.add(dname)
|
||||
continue
|
||||
if not code and comment is not None:
|
||||
# remember current block
|
||||
cur_block = comment
|
||||
continue
|
||||
|
||||
# inside enum
|
||||
if in_enum is not None:
|
||||
if code[0] == '}':
|
||||
# closing
|
||||
try:
|
||||
emit.enum(*in_enum)
|
||||
except Exception as e:
|
||||
print("%d: exception in enum():\n%s" % (lineno + 1, traceback.format_exc()))
|
||||
in_enum = None
|
||||
continue
|
||||
m = enum_value_re.match(code)
|
||||
if m is not None:
|
||||
in_enum[1].append((m.group('name'), m.group('value'), comment))
|
||||
continue
|
||||
|
||||
# inside struct/union
|
||||
if in_struct is not None or in_union is not None:
|
||||
if code[0] == '}':
|
||||
# closing
|
||||
if in_struct is not None:
|
||||
try:
|
||||
emit.struct(*in_struct)
|
||||
except Exception as e:
|
||||
print("%d: exception in struct(\"%s\"):\n%s" % (
|
||||
lineno + 1, in_struct[0], traceback.format_exc()))
|
||||
in_struct = None
|
||||
if in_union is not None:
|
||||
try:
|
||||
emit.union(*in_union)
|
||||
except Exception as e:
|
||||
print("%d: exception in union(\"%s\"):\n%s" % (
|
||||
lineno + 1, in_union[0], traceback.format_exc()))
|
||||
in_union = None
|
||||
continue
|
||||
name, ctype, arr = parse_cdecl(code[:-1])
|
||||
# add to fields
|
||||
if in_struct is not None:
|
||||
in_struct[1].append((name, ctype, arr, comment))
|
||||
if in_union is not None:
|
||||
in_union[1].append((name, ctype, arr, comment))
|
||||
continue
|
||||
|
||||
# block comment
|
||||
if not code and comment is not None and comment[0] == '=':
|
||||
in_block_comment = True
|
||||
|
||||
# #define
|
||||
m = define_re.match(code)
|
||||
if m is not None:
|
||||
try:
|
||||
emit.define(m.group('name'), m.group('value').strip(), comment)
|
||||
except Exception as e:
|
||||
print("%d: exception in define():\n%s" % (lineno + 1, traceback.format_exc()))
|
||||
continue
|
||||
|
||||
# typedef enum {
|
||||
m = enum_re.match(code)
|
||||
if m is not None:
|
||||
in_enum = (m.group('name'), [])
|
||||
continue
|
||||
|
||||
# typedef struct {
|
||||
m = struct_re.match(code)
|
||||
if m is not None:
|
||||
in_struct = (m.group('name'), [])
|
||||
continue
|
||||
|
||||
# typedef union {
|
||||
m = union_re.match(code)
|
||||
if m is not None:
|
||||
in_union = (m.group('name'), [])
|
||||
continue
|
||||
|
||||
# other typedef
|
||||
if code.startswith("typedef"):
|
||||
# typedef function?
|
||||
m = func_pointer_re.match(code[8:-1])
|
||||
if m is not None:
|
||||
params = [parse_cdecl(param.strip()) for param in
|
||||
m.group('params').strip().split(',') if param.strip()]
|
||||
try:
|
||||
emit.typedef_function(m.group('name'), m.group('restype'), params)
|
||||
except Exception as e:
|
||||
print("%d: exception in typedef_function():\n%s" % (
|
||||
lineno + 1, traceback.format_exc()))
|
||||
continue
|
||||
if '(' in code:
|
||||
print("Invalid typedef: %s" % code)
|
||||
continue
|
||||
emit.typedef(*parse_cdecl(code[8:-1]))
|
||||
continue
|
||||
|
||||
# function
|
||||
m = function_re.match(code)
|
||||
if m is not None:
|
||||
params = [parse_cdecl(param.strip()) for param in m.group('params').strip().split(',')
|
||||
if param.strip()]
|
||||
try:
|
||||
emit.function(m.group('name'), m.group('restype'), params)
|
||||
except Exception as e:
|
||||
print("%d: exception in function(\"%s\"):\n%s" % (
|
||||
lineno + 1, m.group('name'), traceback.format_exc()))
|
||||
continue
|
||||
|
||||
# static const
|
||||
m = static_const_re.match(code)
|
||||
if m is not None:
|
||||
value = m.group('value')
|
||||
if value[0] == '{':
|
||||
value = [v.strip() for v in value[1:-1].strip().split(',') if v.strip()]
|
||||
try:
|
||||
emit.static_const(m.group('name'), m.group('type'), value)
|
||||
except Exception as e:
|
||||
print("%d: exception in static_const():\n%s" % (lineno + 1, traceback.format_exc()))
|
||||
continue
|
||||
|
||||
if not code or code[0] == '#':
|
||||
continue
|
||||
|
||||
if not code or code[0] == '#':
|
||||
continue
|
||||
|
||||
if code == 'extern "C" {' or code == "}":
|
||||
continue
|
||||
|
||||
print("%d: Unrecognized: %s" % (lineno + 1, code))
|
||||
Reference in New Issue
Block a user