using System;
using System.Text;
using System.Runtime.InteropServices;
{
public class AOCLW
{
{
NONE = 0,
}
public enum AxDeviceType
{
UNDEFINED = 0,
}
{
NO_AxERROR = 0,
UNKNOWN_ERROR = -10004,
INVALID_ARGUMENTS = -10007,
CAPABILITY_NOT_SUPPORTED = -10009,
UNDEFINED_BOARD_TYPE = -10013,
CAPTURE_SESSION_NOT_SETUP = -5000,
CAPTURE_SESSION_ALREADY_DESTROYED = -5001,
CAPTURE_INTERFACE_SETUP_FAILURE = -5002,
CAPTURE_SESSION_HANDLE_INVALID = -5003,
CALLBACK_NOT_REGISTERED = -5004,
BUFFER_UNINITIALIZED = -5020,
BUFFER_ALLOCATION_FAILURE = -5021,
BUFFER_IS_EMPTY = -5022,
BUFFER_BYTE_ALLIGNMENT_ERROR = -5023,
DATA_RATE_MEASUREMENT_FAILURE = -5024,
BUFFER_TOO_SMALL = -5025,
BUFFER_BUSY = -5026,
FILE_INCORRECT_TYPE = -5040,
FILE_IDENTIFIER_NOT_READ = -5041,
FILE_OPEN_FAILURE = -5042,
FILE_CREATION_FAILURE = -5043,
FILE_WRITING_FAILURE = -5044,
FILE_PATHNAME_TOO_LONG = -5045,
NOT_ALLOWED_WHILE_IMAGING = -5046,
DATA_TYPE_NOT_SUPPORTED = -5047,
FILE_READING_FAILURE = -5048,
JPEG_LOAD_LIBRARY_FAILED = -5050,
JPEG_LOAD_FUNCTION_FAILED = -5051,
JPEG_INIT_FAILED = -5052,
JPEG_DECOMPRESSION_ERROR = -5053,
JPEG_COMPRESSION_ERROR = -5054,
BMP_WRITING_FAILURE = -5055,
OPENCV_LOAD_LIBRARY_FAILED = -5056,
IMAGE_EXPORT_RESOURCES_MISSING = -5057,
DAQMX_LOAD_LIBRARY_FAILED = -9000,
DAQMX_LOAD_FUNCTION_FAILED = -9001,
DAQMX_GET_INFO_FAILED = -9002,
DAQMX_RESET_FAILED = -9003,
DAQMX_TASK_CREATION_FAILED = -9004,
DAQMX_CONFIGURATION_FAILED = -9005,
DAQMX_INVALID_SCAN_PARAMS = -9006,
DAQMX_MAX_VOLTAGE_EXCEEDED = -9007,
DAQMX_COMMAND_DEPRECATED = -9009,
DAQMX_BURST_RASTER_NOT_SETUP = -9010,
DAQMX_COMMAND_NOT_RECOGNIZED = -9011,
DAQMX_WAIT_TIMEOUT = -9012,
DAQMX_MUTEX_TIMEOUT = -9013,
DAQMX_UNSUPPORTED_DEVICE = -9014,
DAQMX_DEVICE_NOT_FOUND = -9015,
DAQMX_ALREADY_DESTROYED = -9016,
RENDER_MODULE_HANDLE_UNAVAILABLE = -8000,
RENDER_WINDOW_CLASS_REGISTRATION_FAILED = -8001,
RENDER_WINDOW_CREATION_FAILED = -8002,
RENDER_DEVICE_CONTEXT_CREATION_FAILED = -8003,
RENDER_PIXEL_SETUP_FAILED = -8004,
RENDER_CONTEXT_CREATION_FAILED = -8005,
RENDER_GLEW_INIT_FAILED = -8006,
RENDER_CONTEXT_CURRENT_FAILURE = -8007,
RENDER_OPENGL_VERSION_UNSUPPORTED = -8008,
RENDER_SHADER_PROGRAM_FAILED = -8009,
RENDER_WAITING_FOR_THREAD = -8010,
RENDER_THREAD_NOT_RESPONDING = -8011,
RENDER_OPENGL_FUNCTION_ERROR = -8012,
RENDER_FUNCTIONS_NOT_SETUP = -8013,
RENDER_WINDOW_MOVE_FAILED = -8014,
RENDER_WINDOW_STYLE_FAILED = -8015,
RENDER_WINDOW_NOT_SETUP = -8016,
PCAP_LOAD_LIBRARY_FAILED = -7000,
PCAP_LOAD_FUNCTION_FAILED = -7001,
PCAP_NO_DEVICES_FOUND = -7002,
PCAP_INTERNAL_ERROR = -7003,
PCAP_DEVICE_OPEN_FAILURE = -7004,
PCAP_DEVICE_SETUP_FAILURE = -7005,
PCIE_LOAD_LIBRARY_FAILED = -7020,
PCIE_LOAD_FUNCTION_FAILED = -7021,
PCIE_INTERFACE_NOT_SETUP = -7022,
PCIE_DEVICE_SETUP_FAILURE = -7023,
PCIE_DRIVER_SETUP_FAILURE = -7024,
PCIE_DAQ_NOT_INSTALLED = -7025,
PCIE_DAQ_INFO_UNAVAILABLE = -7026,
PCIE_DEVICE_OPEN_FAILURE = -7027,
PCIE_BUFFER_LOCK_FAILURE = -7028,
PCIE_WRITE_REGISTER_FAILURE = -7029,
PCIE_READ_REGISTER_FAILURE = -7030,
PCIE_SYNC_IO_FAILURE = -7031,
PCIE_INTERRUPT_ENABLE_FAILURE = -7032,
AQDAQ_LOAD_LIBRARY_FAILED = -7033,
AQDAQ_LOAD_FUNCTION_FAILED = -7034,
AQDAQ_FUNCTION_ERROR = -7035,
AQDAQ_NO_IMAGE_AVAILABLE = -7036,
PCIE_FLASH_RESET_FAILED = -7037,
PCIE_FLASH_READ_FAILED = -7038,
PCIE_FLASH_WRITE_FAILED = -7039,
PCIE_FLASH_VERIFY_FAILED = -7040,
PCIE_FLASH_STATUS_INVALID = -7041,
PCIE_FLASH_ERASE_FAILED = -7042,
DATA_INDEX_INVALID = -9991,
DATA_NOT_COMPRESSED = -9992,
DATA_TYPE_OR_LENGTH_CHANGED = -9993,
DATA_ALLOCATION_TOO_SMALL = -9994,
DATA_INCOMPLETE_OR_MISSING = -9996,
DATA_RETURNED_IN_PREVIOUS_REQUEST = -9997,
DATA_NOT_FOUND_IN_BUFFER = -9999,
UNINITIALIZED = -10001,
CANCELLED_BY_USER = -10002,
COMMAND_NOT_IMPLEMENTED = -10003,
ALREADY_INITIALIZED = -10005,
INSUFFICIENT_ALLOCATION = -10006,
DATA_VALIDATION_FAILED = -10008,
COMMUNICATION_ERROR = -10010,
LASER_SWEEPING_ALREADY_STOPPED = -40,
COMMAND_NOT_RECOGNIZED = -55,
USB_CHECKSUM_ERROR = -104,
PAYLOAD_CHECKSUM_ERROR = -108,
CANNOT_START_TEC_IN_ERROR = -126,
INVALID_CONFIG_PARAMS = -138,
CONFIG_NOT_SETUP = -140,
USB_READ_ERROR = -1000,
USB_WRITE_ERROR = -1001,
NO_DEVICE_PRESENT = -1002,
TCP_READ_ERROR = -1020,
TCP_WRITE_ERROR = -1021,
TCP_CONNECT_ERROR = -1022,
SERIAL_READ_ERROR = -1025,
SERIAL_WRITE_ERROR = -10250,
DATA_SIZE_TOO_BIG = -1029,
HOSTSIDE_USB_ERROR = -1033,
USB_COMMUNICATION_ERROR = -1038,
MUTEX_TIMEOUT = -1039,
DAC_TABLE_NOT_LOADED = -1048,
USB_LOAD_LIBRARY_FAILED = -10011,
USB_LOAD_FUNCTION_FAILED = -10012
}
private const string CONTROL_LW = "AxsunOCTControl_LW.dll";
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axOpenAxsunOCTControl(uint open_all_interfaces);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axCloseAxsunOCTControl();
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axUSBInterfaceOpen(uint interface_status);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axNetworkInterfaceOpen(uint interface_status);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axLibraryVersion(out uint major, out uint minor, out uint patch, out uint build);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern uint axCountConnectedDevices();
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern void axGetErrorExplained(int error, StringBuilder message);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axSetLaserEmission(uint emission_state, uint which_laser);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axSetDriveConfiguration(uint which_config, uint which_laser);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axGetDriveConfiguration(out uint which_config, uint which_laser);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axGetLaserErrorState(out uint error_bitfield, uint which_laser);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axFirmwareVersion(out uint major, out uint minor, out uint patch, uint which_device);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axFPGAVersion(out uint major, out uint minor, out uint patch, out uint build, uint which_device);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axDeviceType(out AxDeviceType device_type, uint which_device);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axSerialNumber(StringBuilder serial_number, uint which_device);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
public delegate void OCTDeviceConnectOrDisconnectHandler();
public event OCTDeviceConnectOrDisconnectHandler OCTDeviceConnectOrDisconnectEvent;
public delegate void ConnectCallbackFunctionType(IntPtr user_data);
[DllImport(CONTROL_LW, CallingConvention = CallingConvention.Cdecl)]
private static extern AxErr axRegisterConnectCallback(ConnectCallbackFunctionType callback_function, IntPtr userData);
private void CallbackPassthru(IntPtr _)
{
OCTDeviceConnectOrDisconnectEvent?.Invoke();
}
public class AxException : System.Exception
{
public AxException(
AxErr error_code)
{
err_ = error_code;
msg_ = GetErrorString(error_code);
}
public string msg_;
}
public AOCLW(bool open_interfaces)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
~AOCLW()
{
}
public AxErr GetSystemType(out AxDeviceType device_type, uint which_device)
{
}
public AxDeviceType GetSystemType(uint which_device)
{
var retval =
axDeviceType(out AxDeviceType device_type, which_device);
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
return device_type;
}
public void StartUSBControlInterface()
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public void StopUSBControlInterface()
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public void StartNetworkControlInterface()
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public void StopNetworkControlInterface()
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public void GetNumericalControlVersion(out uint major, out uint minor, out uint patch, out uint build)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public string GetControlVersion()
{
axLibraryVersion(out uint major, out uint minor, out uint patch, out uint build);
return major.ToString() + "." + minor.ToString() + "." + patch.ToString() + "." + build.ToString();
}
public uint GetNumberOfOCTDevicesPresent()
{
}
public string GetSerialNum(uint which_device)
{
var serial_string = new StringBuilder(40);
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
return serial_string.ToString();
}
public string GetFirmwareVersion(uint which_device)
{
var retval =
axFirmwareVersion(out uint major, out uint minor, out uint patch, which_device);
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
return major.ToString() + "." + minor.ToString() + "." + patch.ToString();
}
public string GetFPGAVersion(uint which_device)
{
var retval =
axFPGAVersion(out uint major, out uint minor, out uint patch, out uint build, which_device);
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
return major.ToString() + "." + minor.ToString() + "." + patch.ToString() + "." + build.ToString();
}
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
return connection_type;
}
public void StartScan(uint which_laser)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public void StopScan(uint which_laser)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public void SwitchConfiguration(uint config_number, uint which_laser)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
public uint GetConfiguration(uint which_laser)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
return config_number;
}
public uint GetLaserErrors(uint which_laser)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
return error_bitfield;
}
public static string GetErrorString(
AxErr error_code)
{
var error_message = new StringBuilder(256);
return error_message.ToString();
}
public void RegisterConnectCallback(ConnectCallbackFunctionType callback_function)
{
if (retval !=
AxErr.NO_AxERROR)
throw new AxException(retval);
}
}
}
AxErr
Error codes returned from AxsunOCTCapture or AxsunOCTControl_LW functions. Use axGetErrorString() in ...
Definition AxsunCommonEnums.h:40
AxErr __cdecl axGetLaserErrorState(uint32_t *error_bitfield, uint32_t which_laser)
Gets the current error state of a Laser device.
AxConnectionType
Connection types (interfaces) supported by AxsunOCTControl_LW.
Definition AxsunOCTControl_LW_C.h:93
@ RS232_PASSTHROUGH
Definition AxsunOCTControl_LW_C.h:96
@ RS232
Definition AxsunOCTControl_LW_C.h:97
@ USB
Definition AxsunOCTControl_LW_C.h:95
@ ETHERNET
Definition AxsunOCTControl_LW_C.h:98
@ LASER
Definition AxsunOCTControl_LW_C.h:108
@ CLDAQ
Definition AxsunOCTControl_LW_C.h:109
@ AZMYTH_LASER
Definition AxsunOCTControl_LW_C.h:111
@ EDAQ
Definition AxsunOCTControl_LW_C.h:110
AxErr __cdecl axOpenAxsunOCTControl(uint32_t open_all_interfaces)
Opens the AxsunOCTControl_LW session.
AxErr __cdecl axDeviceType(AxDevType *device_type, uint32_t which_device)
Gets the device type (e.g. Laser, EDAQ).
uint32_t __cdecl axCountConnectedDevices()
Counts the number of devices successfully connected and enumerated by AxsunOCTControl_LW.
void __cdecl axGetErrorExplained(AxErr errornum, char *error_string)
Gets a string which explains an error code in a more verbose fashion.
AxErr __cdecl axNetworkInterfaceOpen(uint32_t interface_status)
Opens, resets, or closes the Ethernet network interface.
AxErr __cdecl axCloseAxsunOCTControl()
Closes an AxsunOCTControl_LW session previously opened with axOpenAxsunOCTControl().
AxErr __cdecl axSerialNumber(char *serial_number, uint32_t which_device)
Gets the device serial number string.
AxErr __cdecl axSetLaserEmission(uint32_t emission_state, uint32_t which_laser)
Enables or disables swept laser emission.
AxErr __cdecl axSetDriveConfiguration(uint32_t which_config, uint32_t which_laser)
Selects a pre-programmed laser drive configuration.
AxErr __cdecl axUSBInterfaceOpen(uint32_t interface_status)
Opens, resets, or closes the USB interface.
AxErr __cdecl axConnectionType(AxConnectionType *connection_type, uint32_t which_device)
Gets the device connection interface (e.g. USB, Ethernet, RS-232).
AxErr __cdecl axLibraryVersion(uint32_t *major, uint32_t *minor, uint32_t *patch, uint32_t *build)
Gets the AxsunOCTControl_LW library version as numeric elements.
AxErr __cdecl axFPGAVersion(uint32_t *major, uint32_t *minor, uint32_t *patch, uint32_t *build, uint32_t which_device)
Gets the device FPGA version.
AxErr __cdecl axGetDriveConfiguration(uint32_t *current_configuration, uint32_t which_laser)
Gets the currently selected drive configuration.
AxErr __cdecl axRegisterConnectCallback(AxConnectCallbackFunctionC_t callback_function, void *userData)
Registers a callback function to be executed following a device connection or disconnection event.
AxErr __cdecl axFirmwareVersion(uint32_t *major, uint32_t *minor, uint32_t *patch, uint32_t which_device)
Gets the device firmware version.