AxsunOCTControl_LW  1.0.0.0
A light-weight & cross-platform alternative to the .NET-based AxsunOCTControl.dll.
AxsunOCTControl_LW Documentation

Background

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 an application in C# (or in an alternative language which supports straightforward binding of .NET assemblies) on a Windows 7 or Windows 10 platform.


C API Usage Guidelines

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: The AxsunOCTControl_LW library is thread-safe insofar as shared resources are protected from concurrent access within the same process. As such, functions may return AxErr::MUTEX_TIMEOUT if device communication is attempted concurrently from different threads. Design your client application to call library functions from a single thread. Some information retrieval functions are designed for use in the connect/disconnect callback function which is executed in a background thread:

Project Configuration: Include the AxsunOCTControl_LW_C.h header file in your project and link to AxsunOCTControl_LW.dll (or libaxsunoctcontrollw.so or libAxsunOCTControl_LW.dylib on Linux or macOS). On Windows, you must also link to the include library AxsunOCTControl_LW.lib.

Library Usage: Follow three basic steps to use the library in your C client application. (A C++ usage example is provided in AxsunOCTControl_LW_Test.cpp)

1) Open a new AxsunOCTControl context using axOpenAxsunOCTControl():

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();