AxsunOCTControl_LW 2.0.0
A light-weight & cross-platform alternative to the .NET-based AxsunOCTControl.dll.
|
This library and API is a Light-Weight "LW" alternative to AxsunOCTControl.dll and is designed for cross-platform compatibility including Windows, macOS, and Linux. It is based on the C++ standard library, boost::asio, and libusb, instead of the C# / Microsoft .NET framework required by AxsunOCTControl.dll.
Supported communication interfaces include USB (Laser Engine & EDAQ), Ethernet network (EDAQ), and serial/RS-232 (Laser Engine). AxsunOCTControl_LW provides complete user-mode functionality like AxsunOCTControl.dll, but does not provide all functionality required for "Axsun-internal" tasks such as engineering, manufacturing, and field service debugging/upgrade.
Use this AxsunOCTControl_LW library if you are a) creating an application for a non-Windows platform or b) coding in a language other than C# and would like to avoid accessing AxsunOCTControl.dll through COM assembly registration. Use AxsunOCTControl.dll if you are creating a .NET Framework application in C# (or in an alternative language which supports straightforward binding of .NET Framework assemblies) on a Windows 7 or Windows 10 platform.
Naming Conventions: All C function names in this library begin with "ax__". All enumerated typedefs in this library begin with "Ax__".
Error Handling: Functions usually return an error code as defined in the AxErr enum. Check that returned values indicate NO_AxERROR after function calls.
Thread Safety: All communication interface resources are protected from concurrent access within the same process, and opening USB or Network interfaces across different AxsunOCTControl_LW (or AxsunOCTControl) processes is explicitly refused. As of version 1.7.0, it is no longer required to design client applications to prevent concurrent library function calls when communicating with connected devices. Therefore, it is safe to communicate with connected devices from within client-supplied callbacks (i.e. invoked in background threads). Only the following functions cannot safely be invoked within a callback: axCloseAxsunOCTControl().
Project Configuration: Include the AxsunOCTControl_LW_C.h header file in your C/C++ project and link to AxsunOCTControl_LW.dll (or libaxsunoctcontrol_lw.so or libAxsunOCTControl_LW.dylib on Linux or macOS).
On Windows OS, you must also link to the include library AxsunOCTControl_LW.lib.
Library Usage: Follow these three basic steps to use the library in your client application.
NOTE: A C++ usage example is provided in AxsunOCTControl_LW_ExampleConsoleApp.cpp. A Python usage example is provided in AxsunOCTControl_LW_Python_example.py. A C# usage example is provided in AxsunOCTControl_LW_ExampleConsoleApp.cs.
1) Open a new AxsunOCTControl_LW context using axOpenAxsunOCTControl():
AxErr returnValue = axOpenAxsunOCTControl(1); // the "1" argument automatically opens USB and Ethernet interfaces
2) Call functions from this library as desired within your application workflow. The last argument in most function calls identifies the device index to be addressed (which_device
, which_laser
, or which_DAQ
). Most system configurations have only one device and this argument will = 0. Only for system configurations that include more than one device need be concerned with non-zero values of this which_
argument. E.g.:
returnValue = axSetFPGARegister(24, // regnum: set FPGA register 24 0x7000, // regval: to a value of 0x7000 0); // which_DAQ: on the 1st connected DAQ (index #0) returnValue = axSetLaserEmission(1, // emission_state: on 0); // which_laser: on the 1st connected Laser (index #0) returnValue = axDeviceType(&dev_type, // pointer to receive device type 1); // which_device: on the 2nd connected Device (index #1, could be Laser or DAQ)
3) Call axCloseAxsunOCTControl() to release resources prior to quitting:
returnValue = axCloseAxsunOCTControl();