SeaBreeze Manual Core
SeaBreeze Manual Core
1 Introduction
SeaBreeze is a simplified device driver intended for use with Ocean Optics spectrometers
and other devices. This document describes SeaBreeze and compares it to other Ocean
Optics device drivers. Note that SeaBreeze is not a spectral math library and provides
only limited spectral correction or manipulation. SeaBreeze is intended for use by
experienced C/C++ programmers and may not be suitable for all audiences. It is
provided as a starting point for developers that would otherwise have to create an
equivalent device interface themselves because OmniDriver is too large or complex for
their application. SeaBreeze does not support every Ocean Optics device, feature, or
target platform at this time, but it is extensible so other developers can add required
enhancements themselves.
This archive is provided as-is, without any warranty, express or implied. Use the
enclosed files at your own risk. Ocean Optics is not obliged to provide any support for
these files or any notification of defects. These files are not licensed for further
redistribution, but resulting or derived compiled products or libraries may be freely
distributed. Some included files (in the windows-support directory) are copyrighted
by and licensed from Microsoft (as part of redistribution of the DDK) and can be
redistributed according to Microsoft’s license. Any use of the files in this archive implies
understanding of and agreement with these terms.
The remainder of this document is organized as follows. Section 2 presents the design
goals for SeaBreeze and an overview of the software architecture that was created to meet
these requirements. Section 3 provides a comparison of SeaBreeze to OmniDriver.
Section 4 describes how to use the SeaBreeze distribution. Section 5 discusses known
limitations.
4.1 Linux
SeaBreeze requires the libusb library to be installed on the development system,
including the header files (e.g. usb.h). Most modern Linux distributions provide a
suitable version of this library. A typical compiler toolchain (g++, ld, ar, make) is
required. Running make in the top-level directory should be sufficient to build
libseabreeze.so which can then be linked against by a user application. The top-
level Makefile can be modified to disable debugging symbols and enable optimization
(e.g. remove the –ggdb3 flag and add –O2 from the CFLAGS). This should be done
prior to redistribution of the compiled library as it will improve performance and reduce
its size. Note that the Makefile does not always detect when dependencies have
changed, to it may be necessary to delete libseabreeze.so prior to running make
each time to ensure a proper result.
The windows-support directory contains .INF files for each of the supported Ocean
Optics devices (and some that are not), and “CoInstaller” bundles for 32-bit and 64-bit
systems. These files are required when first connecting the spectrometer to the system.
The recommended way to install the driver is to get to the Windows Device Manager and
to reinstall or update the driver. If the user browses to this windows-support
directory to find the .INF file, then the rest of the files should be found automatically.
Note that if existing Ocean Optics driver files (e.g. ooiusb.inf and ezusb.sys) are
found on the system, there may be a conflict. Windows seems to give these older drivers
priority, so it may be necessary to remove (or rename) them completely prior to using the
included drivers. The enclosed drivers should appear with “(WinUSB)” in the name
when presented by the device manager, which should help to identify them.
To develop with SeaBreeze in Windows, the latest Windows DDK is required. This can
be downloaded for free from Microsoft (once an account is created) and is provided with
an MSDN subscription. The DDK version used to develop Windows support for
SeaBreeze was 6001.18001. To set up a Visual Studio project to use this DDK, it is
necessary to specify the following include directories within the DDK installation:
inc\ddk
inc\api
The following external library (.lib) files must also be specified:
winusb.lib
setupapi.lib
The library directory must also be specified. The correct setting depends on the build
target. For 32-bit targets, these are probably located in the following directory relative to
the DDK:
lib\wxp\i386
For 64-bit targets, these are probably located in the following directory relative to the
DDK:
lib\wlh\amd64
Note that some files provided with the SeaBreeze distribution are intended for Linux and
will not compile with Visual Studio. In particular, the NativeUSB.c file in
src\native\usb\linux should not be included in any Visual Studio project as
many of its included header files (e.g. usb.h) are not available in Windows. Further,
the test program test\seabreeze_test_linux.c contains Linux-only code and
will not compile under Visual Studio.
4.3 MacOSX
SeaBreeze communicates with USB devices in OSX through the IOKit framework. As a
result, no extra system files are necessary. The OSX driver has been tested using Snow
Leopard but it should work for any version of OSX (Intel or PPC). No steps have been
taken to make a universal binary out of the dynamic library yet, so any attempt to make a
single executable that will work in both Intel and PPC, 32-bit and 64-bit may require
some changes to the compiler and linker settings.
To build SeaBreeze for OSX, it is sufficient to run make in the top-level directory of the
source tree provided that gcc has been installed and is in the path. It should be possible
to compile this in XCode, but no project for XCode is provided. Linux and OSX both
use the same Makefiles to build SeaBreeze, and make will determine what to do for
each. As with the Linux build (see Section 4.1 above), it may be desirable to remove
debugging (-ggdb3 flag) and add optimization (-O2 flag) to CFLAGS prior to a release.
Additional operating systems can be supported provided that native interfaces for the
required communication buses are created. The existing native interfaces can be found in
the native directories in the top-level src and include directories.
4.4 Organization
The source code for SeaBreeze is laid out as follows. There are two top-level directories,
include and src, that both have the same organization (shown below). Header (.h)
files are located in the include directory tree, and all other files (e.g. .cpp) are located
in the src tree. Within these directories, files are organized as follows:
api (simplified interface for applications to use)
common (base classes, macros, and general definitions)
o buses (abstract definitions of the bus layer)
o devices (abstract definitions of the device layer)
o exceptions (C++ exception types that may be thrown)
o features (abstract definitions of the feature layer)
o protocols (abstract definitions of the protocol layer)
native (bus interface implementations for target platforms)
vendors (device-specific definitions)
o OceanOptics (definitions for Ocean Optics devices)
… (classes derived from those in common)
5 Limitations
SeaBreeze is a relatively new project and it may contain coding errors. Source code is
provided so that any such errors can quickly be resolved by the developer. Device and
feature support is also limited. The following Ocean Optics USB spectrometers are
supported by SeaBreeze at present:
HR2000, HR2000+, HR4000, USB2000, USB2000+, USB4000, Maya2000,
MayaPro2000, QE65000, NIRQuest 256, NIRQuest 512, STS
For these devices, SeaBreeze can do the following:
Set integration time
Acquire and decode a spectrum
Set strobe/lamp enable state
Read EEPROM slots, including serial number
Compute wavelengths for spectrometer pixels based on calibration stored in
EEPROM
Enable/disable thermoelectric cooler on equipped spectrometers, set target
temperature, read current detector temperature in degrees Celsius, and read out
the default settings for these parameters
Set trigger mode
For some spectrometers, read an irradiance calibration from the device
At present, SeaBreeze does not perform any spectral corrections, such as electric dark
correction, boxcar smoothing, multi-scan averaging, linearity correction, or stray light
correction. Since source code is provided, required functionality can be added as needed.
Sample code that will do linearity and electric dark correction is provided in the test
directory, but is above the level of the API.