3 Created on Wed Jan 9 16:23:44 2019
4 @author: Ocean Insight Inc.
8 from typing
import List
9 from ctypes
import cdll, c_int, c_ushort, c_uint, c_long, create_string_buffer, c_ulong, c_ubyte, c_double, c_float, c_longlong, POINTER, byref
10 from enum
import Enum,auto
11 from oceandirect.sdk_properties
import oceandirect_dll
12 from oceandirect.od_logger
import od_logger
18 An error code and error message object wrapper.
21 def __init__(self, errorCode: int, errorMsg: str):
22 super(OceanDirectError, self).
__init__(errorMsg)
33 self.
oceandirectoceandirect = cdll.LoadLibrary(oceandirect_dll)
41 Closes all open devices and the odapi singleton.
46 except Exception
as e:
47 exe_msg = traceback.format_exc()
48 sdk_data_json = json.dumps(exe_msg)
49 logger.error(sdk_data_json)
53 Closes all opened devices.
60 Release any remaining used resources before shutting down the program.
68 Loads and initializes the OceanDirect dll and initializes internal variables.
71 if not OceanDirectAPI.instance:
75 return getattr(self.
instanceinstance, name)
79 OceanDirectAPI returns an error code if something goes wrong. This function will decode
80 that error to a readable string.
81 @param errno: The error code generated by OceanDirect api.
83 @param caller: The caller which produces the error code. Use for debugging purposes only.
87 error_str_len = self.oceandirect.odapi_get_error_string_length(errno)
88 errstr_cp = create_string_buffer(b
'\000'*error_str_len)
89 self.oceandirect.odapi_get_error_string(errno, errstr_cp, error_str_len)
90 errstr = (
"%s errcode(%d): %s" % (caller, errno, errstr_cp.value.decode()))
98 Return OceanDirect api version information.
99 @return An integer tuple of major, minor, and point value.
106 self.oceandirect.odapi_get_api_version_numbers.argtypes = [POINTER(c_uint), POINTER(c_uint), POINTER(c_uint)]
107 self.oceandirect.odapi_get_api_version_numbers(byref(major), byref(minor), byref(point) )
109 return (major.value, minor.value, point.value)
113 Attach to a device discovered by probe_devices or get_device_ids. It also saves it to a map
114 keyed off of the device id. After the device is closed the device_id becomes invalid. You need to
115 call either find_devices()/find_usb_devices()/add_network_device() and get_device_ids() in order
116 to have a valid id before reopening the device again. For a network connected device this function
117 may return an error code if the device is not yet ready to accept incoming connection or the device is
118 unreachable. Note that this should only be done by one thread at a time. For multithreaded
119 application this function must be synchronized.
120 @param[in] device_id The device id.
121 @return The device object.
123 @see find_usb_devices()
124 @see add_network_device()
126 if device_id
in self.open_devices:
127 device = self.open_devices[device_id]
131 self.open_devices[device_id] = device
135 if device_id
in self.open_devices:
136 return self.open_devices[device_id]
142 Manually create an instance of the network attached device and then open it using
143 the openDevice() function. It is the responsiblitiy of the user to ensure that
144 the device exist and configured properly. Note that this should only be done by one thread
145 at a time. For multithreaded application this function must be synchronized.
146 @param[in] ipAddressStr The ip address of the device to be opened.
147 @param[in] deviceTypeStr The device type could be OceanFX or OceanHDX. This is case sensitive.
150 if not ipAddressStr
or not deviceTypeStr:
151 error_msg = self.
decode_errordecode_error(15,
"add_network_device")
154 err_cp = (c_long * 1)(0)
155 self.oceandirect.odapi_add_network_devices(ipAddressStr.encode(
'utf-8'), deviceTypeStr.encode(
'utf-8'), err_cp)
158 error_msg = self.
decode_errordecode_error(err_cp[0],
"add_network_device")
163 Detach from the device indicated by device_id. This persists the device for later use. The device_id becomes
164 invalid after closing the device. Note that this should only be done by one thread at a time.
165 For multithreaded application this function must be synchronized.
166 @param[in] device_id The id of the device to be closed.
170 if device_id
in self.open_devices:
171 device = self.open_devices[device_id]
172 device.close_device()
176 Lists defined details of all active devices.
178 for dev
in self.open_devices:
179 self.open_devices[dev].details()
183 Closes the connection to OceanDirectAPI. This is the last to be called before the program terminates.
185 self.oceandirect.odapi_shutdown()
189 Finds all available Ocean devices by scanning on USB for devices with Ocean drivers, finding
190 devices that respond to UDP multicast (FX and HDX), and also returning IDs for any TCP-enabled
191 devices that have been manually specified using addTCPDeviceLocation(). Note that this should
192 only be done by one thread at a time. For multithreaded application this function must be synchronized.
193 @return Number of devices found.
198 self.
tcpip_devicestcpip_devices = self.oceandirect.odapi_detect_network_devices()
199 except Exception
as e:
200 exe_msg = traceback.format_exc()
201 sdk_data_json = json.dumps(exe_msg)
202 logger.error(sdk_data_json)
205 self.
usb_devicesusb_devices = self.oceandirect.odapi_probe_devices()
206 except Exception
as e:
207 exe_msg = traceback.format_exc()
208 sdk_data_json = json.dumps(exe_msg)
209 logger.error(sdk_data_json)
211 totalDevicesFound = 0
213 totalDevicesFound = self.oceandirect.odapi_get_number_of_device_ids()
214 except OceanDirectError
as err:
215 exe_msg = traceback.format_exc()
216 sdk_data_json = json.dumps(exe_msg)
217 logger.error(sdk_data_json)
219 return totalDevicesFound
223 Finds all available Ocean devices by scanning on USB for devices with Ocean drivers. Note that
224 this should only be done by one thread at a time. For multithreaded application this function
225 must be synchronized.
226 @return Number of devices found.
231 self.
usb_devicesusb_devices = self.oceandirect.odapi_probe_devices()
232 except Exception
as e:
233 exe_msg = traceback.format_exc()
234 sdk_data_json = json.dumps(exe_msg)
235 logger.error(sdk_data_json)
240 Manually create an instance of the network attached device and then open it using the openDevice() function. It
241 is the responsiblitiy of the user to ensure that the device exist and configured properly. Note that this
242 should only be done by one thread at a time.
243 @param[in] ipAddress The ip address as string (ex: "10.20.30.100" ) of the device to be opened.
244 @param[in] deviceType The device type could be OceanFX or OceanHDX. This is case sensitive.
245 @return The device id.
250 err_cp = (c_long * 1)(0)
252 if not ipAddress
or not deviceType:
254 error_msg = self.
decode_errordecode_error(15,
"add_network_device")
258 deviceId = self.oceandirect.odapi_add_network_devices(ipAddress.encode(
'utf-8'), deviceType.encode(
'utf-8'), err_cp)
259 except Exception
as e:
260 exe_msg = traceback.format_exc()
261 sdk_data_json = json.dumps(exe_msg)
262 logger.error(sdk_data_json)
265 error_msg = self.
decode_errordecode_error(err_cp[0],
"add_network_device")
272 Returns the number of devices available. Note that this should only be done by
273 one thread at a time.
274 @return The number of connected(discovered) devices.
278 self.
num_devicesnum_devices = self.oceandirect.odapi_get_number_of_device_ids()
279 except Exception
as e:
280 exe_msg = traceback.format_exc()
281 sdk_data_json = json.dumps(exe_msg)
282 logger.error(sdk_data_json)
288 Return a list of device ids from devices that were both probe or manually added. Note that
289 this should only be done by one thread at a time. For multithreaded application this
290 function must be synchronized.
291 @return List of device id's.
296 ids_cp = (c_long * num_ids)()
297 err_cp = (c_long * 1)()
298 n = self.oceandirect.odapi_get_device_ids(ids_cp, err_cp)
305 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_device_ids")
312 Return a list of network device ids from devices that were probe. Note that
313 this should only be done by one thread at a time. For multithreaded application
314 this function must be synchronized.
315 @return List of network device id's.
320 ids_cp = (c_long * num_ids)()
321 err_cp = (c_long * 1)()
322 n = self.oceandirect.odapi_get_network_device_ids(ids_cp, err_cp)
326 networkIds.append(int(ids_cp[i]))
328 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_network_device_ids")
335 Return a spectrometer object associated with device id. User should not call this function. This function is
336 used internally in OceanDirect.
337 @param[in] serial_num The device serial number.
338 @return The spectrometer object if found, None otherwise.
345 for dev_id
in devids:
347 od_status = dev.status
351 if (od_status ==
'closed'):
357 Adds a device connected via RS 232 to the device list. Untested.
358 @param[in] device_type The name of a type of device. This can be one of the following: QE-PRO, STS.
359 @param[in] bus_path The location of the device on the RS232 bus. This will be a platform-specific
360 location. Under Windows, this may be COM1, COM2, etc. Under Linux, this might
361 be /dev/ttyS0, /dev/ttyS1,
362 @param[in] baud The baud rate. See device manual for supported baud rate.
365 dev_type_cp = create_string_buffer(str.encode(device_type), len(device_type))
366 bus_path_cp = create_string_buffer(str.encode(bus_path), len(bus_path))
367 added = self.oceandirect.odapi_add_RS232_device_location(dev_type_cp, bus_path_cp, baud)
370 error_msg = self.
decode_errordecode_error(added,
"add_rs232_device")
372 logger.info(
"Add for %s at bus path %s result %d" % (device_type, bus_path, added))
376 Gets the serial number of a specified device. This is used internally to find the desired device.
377 @param[in] dev_id The id of a device.
378 @return The device serial number if found, None otherwise.
382 if dev_id
in self.open_devices:
383 serial_number = self.open_devices[dev_id].serial_number
384 if serial_number
is None:
385 serial_cp = create_string_buffer(b
'\000'*32)
386 err_cp = (c_long * 1)()
387 self.oceandirect.odapi_get_serial_number(dev_id, err_cp, serial_cp, 32)
389 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_serial_number")
391 serial_number = serial_cp.value
397 An enumerated class for feature id. Use the method "is_feature_id()" and the id's below to check
398 if a feature is supported by the device or not.
400 Do not change the values and order below without synchronizing the changes from the C files.
403 SPECTROMETER = auto()
404 THERMOELECTRIC = auto()
405 IRRADIANCE_CAL = auto()
408 WAVELENGTH_CAL = auto()
409 NONLINEARITY_CAL = auto()
410 STRAYLIGHT_CAL = auto()
411 RAW_BUS_ACCESS = auto()
412 CONTINUOUS_STROBE = auto()
413 LIGHT_SOURCE = auto()
415 OPTICAL_BENCH = auto()
419 ACQUISITION_DELAY = auto()
420 PIXEL_BINNING = auto()
422 SINGLE_STROBE = auto()
423 QUERY_STATUS = auto()
424 BACK_TO_BACK = auto()
425 LED_ACTIVITY = auto()
429 IPV4_ADDRESS = auto()
431 AUTO_NULLING = auto()
433 DEVICE_INFORMATION = auto()
434 DEVICE_ALIAS = auto()
436 SPECTRUM_ACQUISITION_CONTROL = auto()
437 NETWORK_CONFIGURATION = auto()
440 HIGH_GAIN_MODE = auto()
444 if not isinstance(obj, FeatureID):
445 raise TypeError(
'not a FeatureID enumeration')
446 return c_int32(obj.value)
451 Class that models the individual spectrometer. Should be created by OceanDirectAPI instance. This
452 has an inner class called "Advanced" that contains functions to access other features of the device.
477 Read the device serial number.
478 @return The serial number.
481 serial_cp = create_string_buffer(b
'\000'*32)
482 err_cp = (c_long * 1)(0)
483 self.
oceandirectoceandirect.odapi_get_serial_number(self.
device_iddevice_id, err_cp, serial_cp, 32)
486 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_serial_number")
494 Read the device type.
495 @return The device type.
498 device_type = create_string_buffer(b
'\000' * 32)
499 err_cp = (c_long * 1)(0)
500 self.
oceandirectoceandirect.odapi_get_device_type(self.
device_iddevice_id, err_cp, device_type, 32)
503 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_device_type")
506 return device_type.value.decode()
510 Read the correct spectrometer model name assigned.
511 @return The device model name.
514 model_cp = create_string_buffer(b
'\000'*32)
515 err_cp = (c_long * 1)(0)
516 self.
oceandirectoceandirect.odapi_get_device_name(self.
device_iddevice_id, err_cp, model_cp, 32)
519 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_model")
522 self.
model_namemodel_name = model_cp.value.decode()
527 Decodes the error string returned from device calls.
528 @param[in] errno The error code.
529 @param[in] caller The method name that calls this function.
530 @return The string description of the error code.
533 error_str_len = self.
oceandirectoceandirect.odapi_get_error_string_length(errno)
534 errstr_cp = create_string_buffer(b
'\000'*error_str_len)
535 self.
oceandirectoceandirect.odapi_get_error_string(errno, errstr_cp, error_str_len)
537 return errstr_cp.value.decode()
541 Open the current device associated with this spectrometer object.
544 err_cp = (c_long * 1)(0)
549 error_msg = self.
decode_errordecode_error(err_cp[0],
"open_device")
552 self.
statusstatus =
'open'
553 err_cp = (c_long * 1)(0)
556 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_formatted_spectrum_length")
564 Detaches the device to free it up for other users. This function must be called when you're done using the device.
567 err_cp = (c_long * 1)(0)
568 if self.
statusstatus ==
'open':
571 error_msg = self.
decode_errordecode_error(err_cp[0],
"close_device")
573 self.
statusstatus =
'closed'
577 Determine if nonlinearity correction should be used in calculations. Typically should be set to true.
578 @param[in] nonlinearity_flag True to enable nonlinearity correction otherwise it's False.
582 if nonlinearity_flag:
589 Sets the number of spectra to average.
590 @param[in] newScanToAverage The number of spectra to average.
593 err_cp = (c_long * 1)(0)
594 self.
oceandirectoceandirect.odapi_set_scans_to_average(self.
device_iddevice_id, err_cp, newScanToAverage)
597 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_scans_to_average")
602 Gets the number of spectra to average.
603 @return The number of spectra to average.
606 err_cp = (c_long * 1)(0)
607 scanToAverage = self.
oceandirectoceandirect.odapi_get_scans_to_average(self.
device_iddevice_id, err_cp)
610 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_scans_to_average")
617 Sets the boxcar width to average the spectral data.
618 @param[in] newBoxcarWidth The boxcar width.
621 err_cp = (c_long * 1)(0)
622 self.
oceandirectoceandirect.odapi_set_boxcar_width(self.
device_iddevice_id, err_cp, newBoxcarWidth)
625 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_boxcar_width")
630 Read the current boxcar width setting.
631 @return The boxcar width.
634 err_cp = (c_long * 1)(0)
635 boxcarWidth = self.
oceandirectoceandirect.odapi_get_boxcar_width(self.
device_iddevice_id, err_cp)
638 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_boxcar_width")
645 Returns the maximum pixel value the detector can read.
646 @return The maximum intensity.
649 self.
oceandirectoceandirect.odapi_get_maximum_intensity.restype = c_double
650 err_cp = (c_long * 1)(0)
651 max_intensity = self.
oceandirectoceandirect.odapi_get_maximum_intensity(self.
device_iddevice_id, err_cp)
654 error_msg = self.
decode_errordecode_error(err_cp[0],
"max_intensity")
660 Return a formatted spectrum.
661 @return The formatted spectrum.
665 err_cp = (c_long * 1)(0)
668 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_formatted_spectrum")
678 Return the formatted spectra length.
679 @return The spectra length.
686 This computes the wavelengths for the spectrometer and fills in the
687 provided array (up to the given length) with those values.
688 @return The wavelength values for the device in a python list.
693 err_cp = (c_long * 1)(0)
697 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_wavelengths")
705 Returns the minimum allowable integration time on the device.
706 @return The minimum integration time.
709 err_cp = (c_long * 1)(0)
710 int_time_min = self.
oceandirectoceandirect.odapi_get_minimum_integration_time_micros(self.
device_iddevice_id, err_cp)
713 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_minimum_integration_time")
720 Returns the maximum allowable integration time on the device.
721 @return The maximum integration time.
724 err_cp = (c_long * 1)(0)
725 int_time_max = self.
oceandirectoceandirect.odapi_get_maximum_integration_time_micros(self.
device_iddevice_id, err_cp)
728 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_maximum_integration_time")
735 This function returns the smallest integration time setting, in microseconds, that is valid for the spectrometer.
736 NOTE: some devices that make use of onboard functionality to perform averaging have
737 a different, larger, minimum integration time for acquisition when averaging is enabled.
738 Refer to the documentation for your spectrometer to see if this is the case.
739 The minimum integration time when averaging is enabled can be determined
740 using odapi_get_minimum_averaging_integration_time_micros.
741 @return The minimum averaging integration time.
744 err_cp = (c_long * 1)(0)
745 int_time_min = self.
oceandirectoceandirect.odapi_get_minimum_averaging_integration_time_micros(self.
device_iddevice_id, err_cp)
748 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_minimum_averaging_integration_time")
754 Sets the integration time on the device. This should be verified to be within range prior
755 to calling this function.
756 @param[in] int_time The new integration time in microseconds. See device manual for supported integration increment.
760 err_cp = (c_long * 1)(0)
761 error_msg = self.
oceandirectoceandirect.odapi_set_integration_time_micros(self.
device_iddevice_id, err_cp, c_ulong(int_time))
764 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_integration_time")
769 Returns the current integration time on the device.
770 @return The integration time in microsecond.
773 err_cp = (c_long * 1)(0)
774 int_time = self.
oceandirectoceandirect.odapi_get_integration_time_micros(self.
device_iddevice_id, err_cp)
777 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_integration_time")
784 Returns the integration time increment on the device.
785 @return The integration time increment in microsecond.
788 err_cp = (c_long * 1)(0)
789 int_time = self.
oceandirectoceandirect.odapi_get_integration_time_increment_micros(self.
device_iddevice_id, err_cp)
792 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_integration_time_increment")
799 Set the device trigger mode.
800 @param[in] mode Trigger mode. See device manual for the supported trigger mode.
803 err_cp = (c_long * 1)(0)
807 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_trigger_mode")
812 Returns the current trigger mode from the device. If this function is not
813 supported by the device then an exception will be thrown.
814 @return The trigger mode.
817 err_cp = (c_long * 1)(0)
818 trigger = self.
oceandirectoceandirect.odapi_adv_get_trigger_mode(self.
device_iddevice_id, err_cp)
821 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_trigger_mode")
828 Given an approximate wavelength, finds the closest wavelength and returns the index (pixel number) of that
829 wavelength, and the exact wavelength as an ordered pair
830 @param[in] wavelength A double value containing a best guess or approximate (this should be within bounds
831 of the entire wavelength array or an error is generated).
832 @return A pair value (tuple) of index (pixel) and wavelength value.
835 new_wl = (c_double * 1)(0)
836 err_cp = (c_long * 1)(0)
837 index = self.
oceandirectoceandirect.odapi_get_index_at_wavelength(self.
device_iddevice_id, err_cp, new_wl, c_double(wavelength))
840 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_index_at_wavelength")
842 return index, new_wl[0]
846 Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices (pixel numbers) of those
847 wavelengths, and the exact wavelength as an ordered pair of lists
848 @param[in] wavelengths List of approximate wavelengths.
849 @return A pair value (tuple) of list(indices) and list(actual_wavelengths).
852 length = len(wavelengths)
853 c_indices = (c_int * wavelengthCount)()
854 c_wavelength = (c_double * wavelengthCount)(*wavelengths)
856 err_cp = (c_long * 1)(0)
857 indexCount = self.
oceandirectoceandirect.odapi_get_indices_at_wavelengths(self.
device_iddevice_id, err_cp, c_indices, length, c_wavelength, length)
860 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_indices_at_wavelengths")
864 return list(c_indices[:indexCount]), list(c_wavelength[:indexCount])
868 Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices
869 (pixel numbers) of those wavelengths, and the exact wavelength as an ordered pair of lists.
870 @param[in] lo Wavelength lower limit.
871 @param[in] hi Wavelength upper limit.
872 @param[in] length The number of wavelengths to return.
873 @return A pair value (tuple) of list(indices) and list(actual_wavelengths)
877 c_indices = (c_int * wavelengthCount)()
878 c_wavelength = (c_double * wavelengthCount)()
879 err_cp = (c_long * 1)(0)
880 wavelengthFoundCount = self.
oceandirectoceandirect.odapi_get_indices_at_wavelength_range(self.
device_iddevice_id, err_cp, c_indices, wavelengthCount,
881 c_wavelength, wavelengthCount, c_double(lo), c_double(hi))
884 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_indices_at_wavelength_range")
887 if wavelengthFoundCount == 0:
888 return list(), list()
889 elif wavelengthFoundCount < length:
890 return list(c_indices[:wavelengthFoundCount]), list(c_wavelength[:wavelengthFoundCount])
892 return list(c_indices[:length]), list(c_wavelength[:length])
896 This returns the number of pixels that are electrically active but optically
897 masked (a.k.a. electric dark pixels). Note that not all detectors have optically masked pixels;
898 in that case, this function will return zero.
899 @return The number of electric dark pixels on the spectrometer.
902 err_cp = (c_long * 1)(0)
906 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_number_electric_dark_pixels")
913 This returns array (up to the given length) with the indices of the pixels that are electrically active
914 but optically masked (a.k.a. electric dark pixels). Note that not all detectors have optically
915 masked pixels; in that case, this function will return zero.
916 @return A list of pixels that are electric dark on that spectrometer.
922 err_cp = (c_long * 1)(0)
926 error_msg = self.
decode_errordecode_error(err_cp[0],
"electric_dark_pixel_count")
934 Prints the defined set of details about the device.
937 logger.info(
"Device ID : %d status %s" % (self.
device_iddevice_id, self.
statusstatus))
939 logger.info(
"Model : %s" % self.
get_modelget_model())
944 Check if the given feature ID is supported by the device or not.
945 @param[in] featureID An id from FeatureID enum.
946 @return True if the feature is supported otherwise it's false.
948 err_cp = (c_long * 1)(0)
949 feature_supported =self.
oceandirectoceandirect.odapi_is_feature_enabled(self.
device_iddevice_id, err_cp, featureID.value)
952 error_msg = self.
decode_errordecode_error(err_cp[0],
"is_feature_id_enabled")
955 return bool(c_ubyte(feature_supported))
959 Set the acquisition delay in microseconds. This may also be referred to as the
960 trigger delay. In any event, it is the time between some event (such as a request
961 for data, or an external trigger pulse) and when data acquisition begins.
962 @param[in] delayMicrosecond The new delay to use in microseconds.
965 err_cp = (c_long * 1)(0)
966 self.
oceandirectoceandirect.odapi_set_acquisition_delay_microseconds(self.
device_iddevice_id, err_cp, c_ulong(delayMicrosecond))
969 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_acquisition_delay_microseconds")
974 Get the acquisition delay in microseconds. This may also be referred to as the
975 trigger delay. In any event, it is the time between some event (such as a request
976 for data, or an external trigger pulse) and when data acquisition begins.
977 Note that not all devices support reading this value back. In these cases, the
978 returned value will be the last value sent to odapi_adv_set_acquisition_delay_microseconds().
979 If no value has been set and the value cannot be read back, this function will
981 @return The acquisition delay in microseconds.
984 err_cp = (c_long * 1)(0)
985 delay_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_microseconds(self.
device_iddevice_id, err_cp)
988 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_microseconds")
990 return delay_microsecond
994 Get the allowed step size for the acquisition delay in microseconds.
995 @return The acquisition delay step size in microseconds.
998 err_cp = (c_long * 1)(0)
999 delay_increment_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_increment_microseconds(self.
device_iddevice_id, err_cp)
1002 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_increment_microseconds")
1004 return delay_increment_microsecond
1008 Get the maximum allowed acquisition delay in microseconds.
1009 @return The maximum acquisition delay in microseconds.
1012 err_cp = (c_long * 1)(0)
1013 delay_maximum_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_maximum_microseconds(self.
device_iddevice_id, err_cp)
1016 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_maximum_microseconds")
1018 return delay_maximum_microsecond
1022 Get the minimum allowed acquisition delay in microseconds.
1023 @return The minimum acquisition delay in microseconds.
1026 err_cp = (c_long * 1)(0)
1027 delay_minimum_microsecond = self.
oceandirectoceandirect.odapi_get_acquisition_delay_minimum_microseconds(self.
device_iddevice_id, err_cp)
1030 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_acquisition_delay_minimum_microseconds")
1032 return delay_minimum_microsecond
1036 Store a dark spectrum for use in subsequent corrections i.e. dark correction and nonlinearity correction.
1037 @see getStoredDarkSpectrum.
1038 @param darkSpectrum[in] the buffer that contains the dark spectrum to be stored.
1041 if len(darkSpectrum) == 0:
1043 error_msg = self.
decode_errordecode_error(10,
"set_stored_dark_spectrum")
1046 err_cp = (c_long * 1)(0)
1047 double_array_count = len(darkSpectrum)
1048 double_array = (c_double * double_array_count)(0)
1049 for x
in range(double_array_count):
1050 double_array[x] = darkSpectrum[x]
1052 self.
oceandirectoceandirect.odapi_set_stored_dark_spectrum(self.
device_iddevice_id, err_cp, double_array, double_array_count)
1055 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_stored_dark_spectrum")
1060 Retrieve a previously stored dark spectrum for use in subsequent corrections i.e. dark correction and nonlinearity correction.
1061 @see setStoredDarkSpectrum.
1062 @return The dark spectrum.
1066 err_cp = (c_long * 1)(0)
1069 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_stored_dark_spectrum")
1071 return list(double_array)
1075 Acquire a spectrum and use the supplied dark spectrum to perform a dark correction then return the dark corrected spectrum.
1076 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used for the dark correction.
1077 @return The dark corrected spectrum.
1080 if len(darkSpectrum) == 0:
1082 error_msg = self.
decode_errordecode_error(10,
"get_dark_corrected_spectrum1")
1086 dark_spectrum_array_count = len(darkSpectrum)
1087 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1088 err_cp = (c_long * 1)(0)
1089 for x
in range(dark_spectrum_array_count):
1090 dark_spectrum_array[x] = darkSpectrum[x]
1092 self.
oceandirectoceandirect.odapi_get_dark_corrected_spectrum1(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1095 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_dark_corrected_spectrum1")
1097 return list(corrected_spectrum_array)
1101 Dark correct a previously acquired illuminated spectrum and using a stored dark spectrum.
1102 @see setStoredDarkSpectrum
1103 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1104 @return The dark corrected spectrum.
1107 if len(illuminatedSpectrum) == 0:
1109 error_msg = self.
decode_errordecode_error(10,
"dark_correct_spectrum1")
1113 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1114 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1115 err_cp = (c_long * 1)(0)
1116 for x
in range(illuminated_spectrum_array_count):
1117 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1119 self.
oceandirectoceandirect.odapi_dark_correct_spectrum1(self.
device_iddevice_id, err_cp, illuminated_spectrum_array, illuminated_spectrum_array_count,
1122 error_msg = self.
decode_errordecode_error(err_cp[0],
"dark_correct_spectrum1")
1124 return list(corrected_spectrum_array)
1128 Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction then return the dark corrected spectrum.
1129 @see setStoredDarkSpectrum.
1130 @return The dark corrected spectrum.
1134 err_cp = (c_long * 1)(0)
1137 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_dark_corrected_spectrum2")
1139 return list(corrected_spectrum_array)
1143 Dark correct a previously acquired illuminated spectrum and using a previously acquired dark spectrum.
1144 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used for the dark correction.
1145 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1146 @return The dark corrected spectrum.
1149 if len(darkSpectrum) == 0
or len(illuminatedSpectrum) == 0:
1151 error_msg = self.
decode_errordecode_error(10,
"dark_correct_spectrum2")
1155 dark_spectrum_array_count = len(darkSpectrum)
1156 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1157 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1158 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1159 err_cp = (c_long * 1)(0)
1160 for x
in range(dark_spectrum_array_count):
1161 dark_spectrum_array[x] = darkSpectrum[x]
1163 for x
in range(illuminated_spectrum_array_count):
1164 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1166 self.
oceandirectoceandirect.odapi_dark_correct_spectrum2(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1167 illuminated_spectrum_array, illuminated_spectrum_array_count,
1170 error_msg = self.
decode_errordecode_error(err_cp[0],
"dark_correct_spectrum2")
1172 return list(corrected_spectrum_array)
1176 Acquire a spectrum and use the supplied dark spectrum to perform a dark correction
1177 followed by the nonlinearity correction then return the nonlinearity corrected spectrum.
1178 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used for the dark correction.
1179 @return The nonlinearity corrected spectrum.
1182 if len(darkSpectrum) == 0:
1184 error_msg = self.
decode_errordecode_error(10,
"get_nonlinearity_corrected_spectrum1")
1188 dark_spectrum_array_count = len(darkSpectrum)
1189 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1190 err_cp = (c_long * 1)(0)
1191 for x
in range(dark_spectrum_array_count):
1192 dark_spectrum_array[x] = darkSpectrum[x]
1194 self.
oceandirectoceandirect.odapi_get_nonlinearity_corrected_spectrum1(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1197 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_nonlinearity_corrected_spectrum1")
1199 return list(corrected_spectrum_array)
1203 Nonlinearity correct a previously acquired illuminated spectrum using a stored dark spectrum.
1204 This function performs a dark correction using a previously stored dark spectrum prior to performing the nonlinearity correction.
1205 @see setStoredDarkSpectrum
1206 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1207 @return The nonlinearity corrected spectrum.
1209 if len(illuminatedSpectrum) == 0:
1211 error_msg = self.
decode_errordecode_error(10,
"nonlinearity_correct_spectrum1")
1215 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1216 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1217 err_cp = (c_long * 1)(0)
1218 for x
in range(illuminated_spectrum_array_count):
1219 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1221 self.
oceandirectoceandirect.odapi_nonlinearity_correct_spectrum1(self.
device_iddevice_id, err_cp, illuminated_spectrum_array, illuminated_spectrum_array_count,
1224 error_msg = self.
decode_errordecode_error(err_cp[0],
"nonlinearity_correct_spectrum1")
1226 return list(corrected_spectrum_array)
1230 Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction
1231 followed by a nonlinearity correction then return the nonlinearity corrected spectrum.
1232 @see setStoredDarkSpectrum.
1233 @return The nonlinearity corrected spectrum.
1237 err_cp = (c_long * 1)(0)
1241 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_nonlinearity_corrected_spectrum2")
1243 return list(corrected_spectrum_array)
1247 Nonlinearity correct a previously acquired illuminated spectrum after dark correction using a previously acquired dark spectrum.
1248 @param darkSpectrum[in] the buffer that contains the dark spectrum to be used prior to the nonlinearity correction.
1249 @param illuminatedSpectrum[in] the buffer that contains the illuminated spectrum to be corrected.
1250 @return The nonlinearity corrected spectrum.
1252 if len(darkSpectrum) == 0
or len(illuminatedSpectrum) == 0:
1254 error_msg = self.
decode_errordecode_error(10,
"nonlinearity_correct_spectrum2")
1258 dark_spectrum_array_count = len(darkSpectrum)
1259 dark_spectrum_array = (c_double * dark_spectrum_array_count)()
1260 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1261 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1262 err_cp = (c_long * 1)(0)
1264 for x
in range(dark_spectrum_array_count):
1265 dark_spectrum_array[x] = darkSpectrum[x]
1267 for x
in range(illuminated_spectrum_array_count):
1268 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1270 self.
oceandirectoceandirect.odapi_nonlinearity_correct_spectrum2(self.
device_iddevice_id, err_cp, dark_spectrum_array, dark_spectrum_array_count,
1271 illuminated_spectrum_array, illuminated_spectrum_array_count,
1274 error_msg = self.
decode_errordecode_error(err_cp[0],
"nonlinearity_correct_spectrum2")
1276 return list(corrected_spectrum_array)
1280 Apply a boxcar correction on the given illuminated spectrum.
1281 @param illuminatedSpectrum[in] the spectrum that will be boxcar corrected.
1282 @param boxcarWidth[in] the boxcar width.
1283 @return The boxcar corrected spectrum.
1285 if len(illuminatedSpectrum) == 0:
1287 error_msg = self.
decode_errordecode_error(10,
"boxcar_correct_spectrum")
1290 illuminated_spectrum_array_count = len(illuminatedSpectrum)
1291 illuminated_spectrum_array = (c_double * illuminated_spectrum_array_count)()
1292 err_cp = (c_long * 1)(0)
1294 for x
in range(illuminated_spectrum_array_count):
1295 illuminated_spectrum_array[x] = illuminatedSpectrum[x]
1298 illuminated_spectrum_array, illuminated_spectrum_array_count,
1302 error_msg = self.
decode_errordecode_error(err_cp[0],
"boxcar_correct_spectrum")
1305 return list(illuminated_spectrum_array)
1309 Enable or disable an electric dark correction.
1310 @param[in] isEnabled True to enable electric dark correction otherwise it's False.
1313 err_cp = (c_long * 1)(0)
1314 self.
oceandirectoceandirect.odapi_apply_electric_dark_correction_usage(self.
device_iddevice_id, err_cp, isEnabled)
1317 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_electric_dark_correction_usage")
1322 Return electric dark correction usage.
1323 @return True if electric dark connection is applied otherwise it's False.
1326 err_cp = (c_long * 1)(0)
1327 correctionState = self.
oceandirectoceandirect.odapi_get_electric_dark_correction_usage(self.
device_iddevice_id, err_cp)
1330 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_electric_dark_correction_usage")
1333 return bool(c_ubyte(correctionState))
1337 Enable or disable nonlinearity correction.
1338 @param[in] isEnabled True to enable nonlinearity correction otherwise it's False.
1341 err_cp = (c_long * 1)(0)
1342 self.
oceandirectoceandirect.odapi_apply_nonlinearity_correct_usage(self.
device_iddevice_id, err_cp, isEnabled)
1345 error_msg = self.
decode_errordecode_error(err_cp[0],
"set_nonlinearity_correction_usage")
1350 Return nonlinearity correction usage.
1351 @return True if nonlinearity connection is applied otherwise it's False.
1354 err_cp = (c_long * 1)(0)
1355 correctionState = self.
oceandirectoceandirect.odapi_get_nonlinearity_correct_usage(self.
device_iddevice_id, err_cp)
1358 error_msg = self.
decode_errordecode_error(err_cp[0],
"get_nonlinearity_correction_usage")
1361 return bool(c_ubyte(correctionState))
1366 Subclass containing advanced features that may or may not be in the spectrometer. The spectrometer
1367 specification guide (manual) should be consulted prior to using any of these features.
1370 lamp_on = c_ubyte(1)
1371 lamp_off = c_ubyte(0)
1372 num_nonlinearity_coeffs = 8
1380 Enable or disable the lamp.
1381 @param[in] enable True to enable lamp, False otherwise.
1384 err_cp = (c_long * 1)(0)
1387 self.
devicedevice.oceandirect.odapi_adv_set_lamp_enable(self.
devicedevice.device_id, err_cp, self.
lamp_onlamp_on)
1389 self.
devicedevice.oceandirect.odapi_adv_set_lamp_enable(self.
devicedevice.device_id, err_cp, self.
lamp_offlamp_off)
1397 Return the lamp state.
1398 @return True if lamp is ON otherwise False.
1401 err_cp = (c_long * 1)(0)
1402 enabled = self.
devicedevice.oceandirect.odapi_adv_get_lamp_enable(self.
devicedevice.device_id, err_cp)
1407 return bool(c_ubyte(enabled))
1411 This function will open or close the shutter on the spectrometer.
1412 @param[in[ shutterState True will open the shutter. False will then close the shutter.
1414 err_cp = (c_long * 1)(0)
1415 enabled = self.
devicedevice.oceandirect.odapi_adv_set_shutter_open(self.
devicedevice.device_id, err_cp, c_ubyte(shutterState))
1423 This function returns the shutter state of the spectrometer.
1424 @return True if the shutter is opened otherwise returns False.
1426 err_cp = (c_long * 1)(0)
1427 shutterState = self.
devicedevice.oceandirect.odapi_adv_get_shutter_state(self.
devicedevice.device_id, err_cp)
1432 return bool(c_ubyte(shutterState))
1436 Read the wavelength coefficients from the device. This command is being used in OBP-2.0 enabled devices.
1437 If the device don't support this command then a non-zero error code will be returned.
1438 @return List of wavelength coefficient values.
1441 wl_c = (c_double * 20)()
1442 err_cp = (c_long * 1)(0)
1443 buffer_size = self.
devicedevice.oceandirect.odapi_get_wavelength_coeffs(self.
devicedevice.device_id, err_cp, wl_c, 20)
1445 logger.info(
"Buffer size returned: %d " % (buffer_size))
1450 return list(wl_c)[:buffer_size]
1454 Read the nonlinearity coefficients stored in the device. This command is being used in OBP-2.0 enabled devices.
1455 If the device don't support this command then a non-zero error code will be returned.
1456 @return A list of nonlinearity coefficients.
1460 nl_coeff = (c_double * num_coeffs)(0)
1461 err_cp = (c_long * 1)(0)
1462 self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs(self.
devicedevice.device_id, err_cp, nl_coeff, num_coeffs)
1468 return list(nl_coeff)
1472 Read the nonlinearity coefficients count from the device. This command is being used in legacy devices.
1473 If the device don't support this command then a non-zero error code will be returned.
1474 @return The nonlinearity coefficients count.
1477 err_cp = (c_long * 1)(0)
1478 nl_count = self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs_count1(self.
devicedevice.device_id, err_cp)
1481 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_nonlinearity_coeffs_count1")
1488 Read the nonlinearity coefficients count of a given position from the device. This command is being used in legacy devices.
1489 If the device don't support this command then a non-zero error code will be returned. Use the function
1490 "get_nonlinearity_coeffs_count1()" to get the correct range of the index value.
1491 @param[in] index A zero based value referring to the coefficient position.
1492 @return The nonlinearity coefficients.
1495 self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs1.restype = c_double
1497 err_cp = (c_long * 1)(0)
1498 nl_coefficient = self.
devicedevice.oceandirect.odapi_adv_get_nonlinearity_coeffs1(self.
devicedevice.device_id, err_cp, c_int(index))
1504 return nl_coefficient
1508 Returns the temperature reading (celsius) of a detector thermistor. This is equivalent to calling
1509 get_temperature(index) where the "index" is a detector thermistor index. If this function is not
1510 supported by the device then an exception will be thrown.
1511 @return The temperature in degrees celsius.
1514 self.
devicedevice.oceandirect.odapi_adv_tec_get_temperature_degrees_C.restype = c_double
1515 err_cp = (c_long * 1)(0)
1516 temp = self.
devicedevice.oceandirect.odapi_adv_tec_get_temperature_degrees_C(self.
devicedevice.device_id, err_cp)
1519 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_tec_temperature_degrees_C")
1525 Apply the setpoint temperature (Celsius) in the thermo-electric cooler. If this function is not
1526 supported by the device then an exception will be thrown.
1527 @param[in] temp_C The setpoint temperature in celsius.
1530 err_cp = (c_long * 1)(0)
1531 temp = self.
devicedevice.oceandirect.odapi_adv_tec_set_temperature_setpoint_degrees_C(self.
devicedevice.device_id, err_cp, c_double(temp_C))
1534 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_temperature_setpoint_degrees_C")
1540 Enable or disable the thermo-electric cooler attached to the detector. If this function is not
1541 supported by the device then an exception will be thrown.
1542 @param[in] coolerEnable True to enable the cooler, False otherwise.
1545 err_cp = (c_long * 1)(0)
1546 self.
devicedevice.oceandirect.odapi_adv_tec_set_enable(self.
devicedevice.device_id, err_cp, c_ubyte(coolerEnable))
1554 Read the state of the thermo-electric cooler whether it's enable or disable. If this function
1555 is not supported by the device then an exception will be thrown.
1556 @return True if the thermo-electric cooler is enabled, False otherwise.
1559 err_cp = (c_long * 1)(0)
1560 enabled = self.
devicedevice.oceandirect.odapi_adv_tec_get_enable(self.
devicedevice.device_id, err_cp)
1565 return bool(c_ubyte(enabled))
1569 Read the set point temperature of the thermo-electric cooler. If this function is not supported
1570 by the device then an exception will be thrown.
1571 @return The temperature value in celsius.
1574 self.
devicedevice.oceandirect.odapi_adv_tec_get_temperature_setpoint_degrees_C.restype = c_float
1575 err_cp = (c_long * 1)(0)
1576 temp = self.
devicedevice.oceandirect.odapi_adv_tec_get_temperature_setpoint_degrees_C(self.
devicedevice.device_id, err_cp)
1579 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_temperature_setpoint_degrees_C")
1585 Returns the state of thermo-electric cooler temperature on whether it reached the stable
1586 temperature or not. If this function is not supported by the device then an exception will be thrown.
1587 @return True if it's stable, False otherwise.
1590 err_cp = (c_long * 1)(0)
1591 enabled = self.
devicedevice.oceandirect.odapi_adv_tec_get_stable(self.
devicedevice.device_id, err_cp)
1596 return bool(c_ubyte(enabled))
1600 Returns the thermo-electric cooler fan state whether it's enabled or not. Few devices have cooler fan.
1601 If this function is not supported by the device then an exception will be thrown.
1602 @return True if the fan is enabled, False otherwise.
1605 err_cp = (c_long * 1)(0)
1606 enabled = self.
devicedevice.oceandirect.odapi_adv_tec_get_fan_enable(self.
devicedevice.device_id, err_cp)
1611 return bool(c_ubyte(enabled))
1615 Gets the number of light sources that are represented by the given featureID. Such
1616 light sources could be individual LEDs, light bulbs, lasers, etc. Each of these light
1617 sources may have different capabilities, such as programmable intensities and enables,
1618 which should be queried before they are used.
1619 @return The number of light sources (e.g. bulbs) in the indicated feature
1622 err_cp = (c_long * 1)(0)
1623 light_source_count = self.
devicedevice.oceandirect.odapi_adv_get_light_source_count(self.
devicedevice.device_id, err_cp)
1631 Queries whether the indicated light source within the given feature instance has a usable
1632 enable/disable control. If this returns False (meaning no enable available) then calling enable_light_source()
1633 or is_light_source_enabled() is likely to result in an error.
1634 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
1635 within the indicated feature instance to query
1636 @return False to indicate specified light source cannot be enabled/disabled. True to indicate specified
1637 light source can be enabled/disabled with enable_light_source()
1640 err_cp = (c_long * 1)(0)
1641 status = self.
devicedevice.oceandirect.odapi_adv_light_source_has_enable(self.
devicedevice.device_id, err_cp, light_source_index)
1650 Queries whether the indicated light source within the given feature instance is enabled (energized).
1651 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
1652 within the indicated feature instance to query.
1653 @return False to indicate specified light source is disabled (should emit no light). True to indicate
1654 specified light source is enabled (should emit light depending on configured intensity setting).
1657 err_cp = (c_long * 1)(0)
1658 status = self.
devicedevice.oceandirect.odapi_adv_light_source_is_enabled(self.
devicedevice.device_id, err_cp, light_source_index)
1667 Attempts to enable or disable the indicated light source within the given feature instance. Not
1668 all light sources have an enable/disable control, and this capability can be queried with has_light_source_enable().
1669 Note that an enabled light source should emit light according to its last (or default) intensity
1670 setting which might be the minimum; in this case, the light source might appear to remain off.
1671 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs) within
1672 the indicated feature instance to query.
1673 @param[in] enable Whether to enable the light source. A value of False will attempt to disable the
1674 light source, and any other value will enable it.
1677 err_cp = (c_long * 1)(0)
1680 self.
devicedevice.oceandirect.odapi_adv_light_source_set_enable(self.
devicedevice.device_id, err_cp, light_source_index, self.
lamp_onlamp_on)
1682 self.
devicedevice.oceandirect.odapi_adv_light_source_set_enable(self.
devicedevice.device_id, err_cp, light_source_index, self.
lamp_offlamp_off)
1690 Set the enable status of the single strobe signal. Note that on some
1691 devices the enable control is shared with other signals (e.g. lamp
1692 enable and continuous strobe) so this may have some side-effects and
1693 changing those features may affect the single strobe as well.
1694 @param[in] enable True to enable single strobe otherwise use False.
1697 err_cp = (c_long * 1)(0)
1700 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_onlamp_on)
1702 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_offlamp_off)
1710 Set the amount of time, in microseconds, that should elapse after a starting event before
1711 the single strobe should have a rising edge.
1712 @param[in] delayMicrosecond The delay, in microseconds, that the single strobe should wait before
1716 err_cp = (c_long * 1)(0)
1717 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_delay(self.
devicedevice.device_id, err_cp, c_ulong(delayMicrosecond))
1725 Set the amount of time, in microseconds, that the single strobe pulse should remain high after it begins.
1726 @param[in] widthMicrosecond The duration, in microseconds, of the single strobe pulse after
1727 the rising edge occurs. Once this duration elapses, a falling edge
1731 err_cp = (c_long * 1)(0)
1732 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_width(self.
devicedevice.device_id, err_cp, c_ulong(widthMicrosecond))
1740 Get the enable status of the single strobe signal. Note that on some
1741 devices the enable control is shared with other signals (e.g. lamp
1742 enable and continuous strobe) so this may have some side-effects and
1743 changing those features may affect the single strobe as well.
1744 @return True if single strobe is enabled otherwise it's False.
1747 err_cp = (c_long * 1)(0)
1748 enable = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_enable(self.
devicedevice.device_id, err_cp)
1753 return bool(c_ubyte(enable))
1757 Get the amount of time, in microseconds, that should elapse after
1758 a starting event before the single strobe should have a rising edge
1759 @return The delay in microseconds.
1762 err_cp = (c_long * 1)(0)
1763 delay_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay(self.
devicedevice.device_id, err_cp)
1768 return delay_microsecond
1772 Get the amount of time, in microseconds, that the single strobe pulse
1773 should remain high after it begins.
1774 @return The pulse width in microseconds.
1777 err_cp = (c_long * 1)(0)
1778 width_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width(self.
devicedevice.device_id, err_cp)
1783 return width_microsecond
1787 Gets the number of light sources that are represented by the given featureID. Such
1788 light sources could be individual LEDs, light bulbs, lasers, etc. Each of these light
1789 sources may have different capabilities, such as programmable intensities and enables,
1790 which should be queried before they are used.
1792 @return The number of light sources (e.g. bulbs) in the indicated feature
1795 err_cp = (c_long * 1)(0)
1796 light_source_count = self.
devicedevice.oceandirect.odapi_adv_get_light_source_count(self.
devicedevice.device_id, err_cp)
1801 return light_source_count
1805 Queries whether the indicated light source within the given feature instance has a usable
1806 enable/disable control. If this returns False (meaning no enable available) then calling enable_light_source()
1807 or is_light_source_enabled() is likely to result in an error.
1809 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
1810 within the indicated feature instance to query
1811 @return False to indicate specified light source cannot be enabled/disabled. True to indicate specified
1812 light source can be enabled/disabled with enable_light_source()
1815 err_cp = (c_long * 1)(0)
1816 status = self.
devicedevice.oceandirect.odapi_adv_light_source_has_enable(self.
devicedevice.device_id, err_cp, light_source_index)
1825 Queries whether the indicated light source within the given feature instance is enabled (energized).
1827 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs)
1828 within the indicated feature instance to query.
1829 @return False to indicate specified light source is disabled (should emit no light). True to indicate
1830 specified light source is enabled (should emit light depending on configured intensity setting).
1833 err_cp = (c_long * 1)(0)
1834 status = self.
devicedevice.oceandirect.odapi_adv_light_source_is_enabled(self.
devicedevice.device_id, err_cp, light_source_index)
1843 Attempts to enable or disable the indicated light source within the given feature instance. Not
1844 all light sources have an enable/disable control, and this capability can be queried with has_light_source_enable().
1845 Note that an enabled light source should emit light according to its last (or default) intensity
1846 setting which might be the minimum; in this case, the light source might appear to remain off.
1848 @param[in] light_source_index Which of potentially many light sources (LEDs, lasers, light bulbs) within
1849 the indicated feature instance to query.
1850 @param[in] enable Whether to enable the light source. A value of False will attempt to disable the
1851 light source, and any other value will enable it.
1854 err_cp = (c_long * 1)(0)
1857 self.
devicedevice.oceandirect.odapi_adv_light_source_set_enable(self.
devicedevice.device_id, err_cp, light_source_index, self.
lamp_onlamp_on)
1859 self.
devicedevice.oceandirect.odapi_adv_light_source_set_enable(self.
devicedevice.device_id, err_cp, light_source_index, self.
lamp_offlamp_off)
1867 Set the enable status of the single strobe signal. Note that on some
1868 devices the enable control is shared with other signals (e.g. lamp
1869 enable and continuous strobe) so this may have some side-effects and
1870 changing those features may affect the single strobe as well.
1872 @param[in] enable True to enable single strobe otherwise use False.
1875 err_cp = (c_long * 1)(0)
1878 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_onlamp_on)
1880 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_offlamp_off)
1888 Set the amount of time, in microseconds, that should elapse after a starting event before
1889 the single strobe should have a rising edge.
1891 @param[in] delayMicrosecond The delay, in microseconds, that the single strobe should wait before
1895 err_cp = (c_long * 1)(0)
1896 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_delay(self.
devicedevice.device_id, err_cp, c_ulong(delayMicrosecond))
1904 Set the amount of time, in microseconds, that the single strobe pulse should remain high after it begins.
1906 @param[in] widthMicrosecond The duration, in microseconds, of the single strobe pulse after
1907 the rising edge occurs. Once this duration elapses, a falling edge
1911 err_cp = (c_long * 1)(0)
1912 self.
devicedevice.oceandirect.odapi_adv_set_single_strobe_width(self.
devicedevice.device_id, err_cp, c_ulong(widthMicrosecond))
1920 Get the enable status of the single strobe signal. Note that on some
1921 devices the enable control is shared with other signals (e.g. lamp
1922 enable and continuous strobe) so this may have some side-effects and
1923 changing those features may affect the single strobe as well.
1925 @return True if single strobe is enabled otherwise it's False.
1928 err_cp = (c_long * 1)(0)
1929 enable = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_enable(self.
devicedevice.device_id, err_cp)
1934 return bool(c_ubyte(enable))
1938 Get the amount of time, in microseconds, that should elapse after
1939 a starting event before the single strobe should have a rising edge
1941 @return The delay in microseconds.
1944 err_cp = (c_long * 1)(0)
1945 delay_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay(self.
devicedevice.device_id, err_cp)
1950 return delay_microsecond
1954 Get the amount of time, in microseconds, that the single strobe pulse
1955 should remain high after it begins.
1957 @return The pulse width in microseconds.
1960 err_cp = (c_long * 1)(0)
1961 width_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width(self.
devicedevice.device_id, err_cp)
1966 return width_microsecond
1970 Get the minimum amount of time, in microseconds, that should elapse after
1971 a starting event before the single strobe should have a rising edge.
1973 @return The minimum delay in microseconds.
1976 err_cp = (c_long * 1)(0)
1977 minimum_microseconds = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay_minimum(self.
devicedevice.device_id, err_cp)
1980 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_delay_minimum")
1982 return minimum_microseconds
1986 Get the maximum amount of time, in microseconds, that should elapse after
1987 a starting event before the single strobe should have a rising edge.
1989 @return The maximum delay in microseconds.
1992 err_cp = (c_long * 1)(0)
1993 maximum_microseconds = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay_maximum(self.
devicedevice.device_id, err_cp)
1996 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_delay_maximum")
1998 return maximum_microseconds
2002 Gets the single strobe delay increment in microseconds.
2003 @return The delay increment.
2005 err_cp = (c_long * 1)(0)
2006 delay_increment = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_delay_increment(self.
devicedevice.device_id, err_cp)
2009 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_delay_increment")
2011 return delay_increment
2015 Get the minimum amount of time, in microseconds, that the single strobe pulse
2016 should remain high after it begins.
2017 @return The minimum width in microseconds.
2020 err_cp = (c_long * 1)(0)
2021 width_minimum = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width_minimum(self.
devicedevice.device_id, err_cp)
2024 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_width_minimum")
2026 return width_minimum
2030 Get the maximum amount of time, in microseconds, that the single strobe pulse
2031 should remain high after it begins.
2032 @return The maximum width in microseconds.
2034 err_cp = (c_long * 1)(0)
2035 width_maximum = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width_maximum(self.
devicedevice.device_id, err_cp)
2038 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_width_maximum")
2040 return width_maximum
2044 Get the single strobe width increment.
2045 @return The width increment.
2047 err_cp = (c_long * 1)(0)
2048 width_increment = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_width_increment(self.
devicedevice.device_id, err_cp)
2051 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_width_increment")
2053 return width_increment
2057 Gets the single strobe cycle maximum in microseconds.
2058 @return The maximum cycle value.
2061 err_cp = (c_long * 1)(0)
2062 cyle_maximum = self.
devicedevice.oceandirect.odapi_adv_get_single_strobe_cycle_maximum(self.
devicedevice.device_id, err_cp)
2065 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_single_strobe_cycle_maximum")
2071 Sets the continuous strobe period in microseconds.
2072 @param[in] period The new period of the continuous strobe measured in microseconds
2075 err_cp = (c_long * 1)(0)
2076 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_period_micros(self.
devicedevice.device_id, err_cp, period)
2079 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_continuous_strobe_period_micros")
2084 Sets the continuous strobe enable state on the device.
2085 @param[in] enable A boolean used for denoting the desired state (on/off) of the continuous
2086 strobe generator. If the value of enable is nonzero, then the continuous
2087 strobe will operate. If the value of enable is zero, then the continuous
2088 strobe will stop. Note that on some devices the continuous strobe enable
2089 is tied to other enables (such as lamp enable or single strobe enable)
2090 which may cause side effects.
2093 err_cp = (c_long * 1)(0)
2096 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_onlamp_on)
2098 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_enable(self.
devicedevice.device_id, err_cp, self.
lamp_offlamp_off)
2101 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_continuous_strobe_enable")
2106 Get the continuous strobe period in microseconds.
2107 @return the period in microseconds.
2110 err_cp = (c_long * 1)(0)
2111 period_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_micros(self.
devicedevice.device_id, err_cp)
2114 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period")
2116 return period_microsecond
2120 Gets the continuous strobe state (enabled or disabled) of the device.
2121 @return True if continuous strobe is enabled otherwise it's False.
2124 err_cp = (c_long * 1)(0)
2125 enable = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_enable(self.
devicedevice.device_id, err_cp)
2130 return bool(c_ubyte(enable))
2134 Gets the minimum continuous strobe period of the device in microseconds.
2135 @return The minimum strobe period in microseconds.
2138 err_cp = (c_long * 1)(0)
2139 minimum_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_minimum_micros(self.
devicedevice.device_id, err_cp)
2142 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period_minimum")
2144 return minimum_microsecond
2148 Gets the maximum continuous strobe period of the device in microseconds.
2149 @return The maximum strobe period in microseconds.
2152 err_cp = (c_long * 1)(0)
2153 maximum_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_maximum_micros(self.
devicedevice.device_id, err_cp)
2156 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period_maximum")
2158 return maximum_microsecond
2162 This function gets the current size of the strobe period increment of the device in microseconds.
2163 The increment is dependent on the strobe period. Small strobe periods i.e. less than about 1ms
2164 will have a small increment, typically 1 microsecond. Larger strobe periods will have larger
2165 increments, typically 1ms.
2166 @return The current strobe period increment in microseconds.
2169 err_cp = (c_long * 1)(0)
2170 increment_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_period_increment_micros(self.
devicedevice.device_id, err_cp)
2173 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_continuous_strobe_period_increment")
2175 return increment_microsecond
2179 Gets the strobe width of the device in microseconds.
2180 @return The current strobe width in microseconds.
2182 err_cp = (c_long * 1)(0)
2183 width_microsecond = self.
devicedevice.oceandirect.odapi_adv_get_continuous_strobe_width_micros(self.
devicedevice.device_id, err_cp)
2188 return width_microsecond
2192 Sets the continuous strobe width on the device.
2193 @param[in] widthMicrosecond The new width of the continuous strobe measured in microseconds.
2196 err_cp = (c_long * 1)(0)
2197 self.
devicedevice.oceandirect.odapi_adv_set_continuous_strobe_width_micros(self.
devicedevice.device_id, err_cp, c_ulong(widthMicrosecond))
2205 Clear the data buffer. An exception will be thrown if the command is not supported by the device.
2208 err_cp = (c_long * 1)(0)
2209 self.
devicedevice.oceandirect.odapi_adv_clear_data_buffer(self.
devicedevice.device_id, err_cp)
2217 Get the number of data elements currently in the buffer. An exception will be thrown if
2218 the command is not supported by the device.
2219 @return A count of how many items are available for retrieval from the buffer.
2222 err_cp = (c_long * 1)(0)
2223 number_of_elements = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_number_of_elements(self.
devicedevice.device_id, err_cp)
2226 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_data_buffer_number_of_elements")
2228 return number_of_elements
2232 Get the present limit of how many data elements will be retained by the buffer. This value can be
2233 changed with set_data_buffer_capacity(). An exception will be thrown if the command is
2234 not supported by the device.
2235 @return A count of how many items the buffer will store before data may be lost.
2238 err_cp = (c_long * 1)(0)
2239 maximum_buffer = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_capacity(self.
devicedevice.device_id, err_cp)
2244 return maximum_buffer
2248 Get the maximum possible configurable size for the data buffer. An exception will be thrown if
2249 the command is not supported by the device.
2250 @return The largest value that may be set with set_data_buffer_capacity().
2253 err_cp = (c_long * 1)(0)
2254 maximum_buffer_capacity = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_capacity_maximum(self.
devicedevice.device_id, err_cp)
2257 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_data_buffer_capacity_maximum")
2259 return maximum_buffer_capacity
2263 Get the minimum possible configurable size for the data buffer. An exception will be thrown if
2264 the command is not supported by the device.
2265 @return The smallest value that may be set with set_data_buffer_capacity().
2268 err_cp = (c_long * 1)(0)
2269 minimum_buffer_capacity = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_capacity_minimum(self.
devicedevice.device_id, err_cp)
2272 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_data_buffer_capacity_minimum")
2274 return minimum_buffer_capacity
2278 Set the number of data elements that the buffer should retain. This function must be used
2279 with "set_number_of_backtoback_scans()". An exception will be thrown if the command is
2280 not supported by the device.
2281 @param[in] capacity Limit on the number of data elements to store. This is bounded by what is returned
2282 by get_data_buffer_capacity_minimum() and get_data_buffer_capacity_maximum().
2285 err_cp = (c_long * 1)(0)
2286 self.
devicedevice.oceandirect.odapi_adv_set_data_buffer_capacity(self.
devicedevice.device_id, err_cp, capacity)
2294 Enable or disable data buffering. An exception will be thrown if the command is
2295 not supported by the device.
2296 @param[in] enable True enable the buffer. False disable the buffer.
2300 if enable ==
True or enable == 1:
2303 err_cp = (c_long * 1)(0)
2304 self.
devicedevice.oceandirect.odapi_adv_set_data_buffer_enable(self.
devicedevice.device_id, err_cp, flag)
2312 Reads the device data buffering enable state. An exception will be thrown if the command
2313 is not supported by the device.
2314 @return True if data buffering is enabled otherwise it's False.
2317 err_cp = (c_long * 1)(0)
2318 dataBufferState = self.
devicedevice.oceandirect.odapi_adv_get_data_buffer_enable(self.
devicedevice.device_id, err_cp)
2323 return bool(c_ubyte(dataBufferState))
2327 Abort spectra acquisition and put the device into an idle state. To resume spectra acquisition,
2328 you have to call acquire_spectra_to_buffer() first before calling the get spectra command. Very
2329 few devices supported this command.
2332 err_cp = (c_long * 1)(0)
2333 self.
devicedevice.oceandirect.odapi_adv_abort_acquisition(self.
devicedevice.device_id, err_cp)
2341 Start spectra acquisition. This would transition the device into a non-idle state. Very
2342 few devices supported this command. An exception will be thrown if the command is
2343 not supported by the device.
2346 err_cp = (c_long * 1)(0)
2347 self.
devicedevice.oceandirect.odapi_adv_acquire_spectra_to_buffer(self.
devicedevice.device_id, err_cp)
2355 Return device idle state. Very few devices supported this command. An exception will be thrown if
2356 the command is not supported by the device.
2357 @return True if the device is idle otherwise it's False.
2360 err_cp = (c_long * 1)(0)
2361 retval = self.
devicedevice.oceandirect.odapi_adv_get_device_idle_state(self.
devicedevice.device_id, err_cp)
2367 return bool(c_ubyte(retval))
2371 Get the number of back-to-back scans. See device manual if data buffering is supported.
2372 @return The back-to-back scan value.
2375 err_cp = (c_long * 1)(0)
2376 retval = self.
devicedevice.oceandirect.odapi_adv_get_number_of_backtoback_scans(self.
devicedevice.device_id, err_cp)
2379 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_number_of_backtoback_scans")
2386 Set the number of spectra that the device will capture per trigger event. This function requires
2387 data buffer to be enabled. See "set_data_buffer_enable()". See device manual if data buffering is supported.
2388 @param[in] numScans The back-to-back scan value.
2391 err_cp = (c_long * 1)(0)
2392 self.
devicedevice.oceandirect.odapi_adv_set_number_of_backtoback_scans(self.
devicedevice.device_id, err_cp, numScans)
2395 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_number_of_backtoback_scans")
2400 Returns spectra with metadata information. For older devices such as FX/HDX, read a maximum of 15
2401 spectra from the data buffer. This function requires that both back to back scans and data buffer
2402 be enabled. See "set_data_buffer_enable()" and "set_number_of_backtoback_scans()". For newer devices
2403 such as Ocean SR2, you can call this function right away. See device manual if this command is supported.
2404 @param[in] list_raw_spectra The spectra output buffer.
2405 @param[in] list_timestamp The timestamp output buffer of each spectra.
2406 @param[in] buffer_size The buffer array size (maximum is 15).
2407 @return The number of spectra read. It can be zero.
2410 buffer = (POINTER(c_double) * buffer_size)()
2411 for x
in range(buffer_size):
2412 buffer[x] = (c_double * self.
devicedevice.pixel_count_formatted)()
2414 timestamp = (c_longlong * buffer_size)(0)
2415 err_cp = (c_long * 1)(0)
2416 spectraCount = self.
devicedevice.oceandirect.odapi_get_raw_spectrum_with_metadata(self.
devicedevice.device_id, err_cp, buffer, buffer_size,
2417 self.
devicedevice.pixel_count_formatted, timestamp, buffer_size)
2420 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_raw_spectrum_with_metadata")
2423 for x
in range(spectraCount):
2424 spectra = [
None] * self.
devicedevice.pixel_count_formatted
2427 for y
in range(self.
devicedevice.pixel_count_formatted):
2428 spectra[y] = buffer[x][y]
2430 list_raw_spectra.append(spectra)
2432 list_timestamp.append(timestamp[x])
2438 This function returns the usb primary OUT endpoint for the type specified. If the type is not
2439 supported by the device, a zero is returned. 0 is normally the control endpoint. That
2440 value is not valid in this context.
2441 @return The usb endpoint address.
2444 err_cp = (c_long * 1)(0)
2445 usb_primary_endpoint_out = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_primary_out(self.
devicedevice.device_id, err_cp)
2448 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_usb_endpoint_primary_out")
2450 return int(usb_primary_endpoint_out)
2454 This function returns the usb primary IN endpoint for the type specified. If the type is not
2455 supported by the device, a zero is returned. 0 is normally the control endpoint. That
2456 value is not valid in this context.
2457 @return The usb endpoint address.
2460 err_cp = (c_long * 1)(0)
2461 usb_primary_endpoint_in = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_primary_in(self.
devicedevice.device_id, err_cp)
2466 return int(usb_primary_endpoint_in)
2470 This function returns the usb secondary OUT endpoint for the type specified. If the type is
2471 not supported by the device, a zero is returned. 0 is normally the control endpoint. That
2472 value is not valid in this context.
2473 @return The usb endpoint address.
2476 err_cp = (c_long * 1)(0)
2477 usb_secondary_endpoint_out = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_secondary_out(self.
devicedevice.device_id, err_cp)
2480 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_usb_endpoint_secondary_out")
2482 return int(usb_secondary_endpoint_out)
2486 This function returns the usb secondary IN endpoint for the type specified. If the type is
2487 not supported by the device, a zero is returned. 0 is normally the control endpoint. That
2488 value is not valid in this context.
2489 @return The usb endpoint address.
2492 err_cp = (c_long * 1)(0)
2494 usb_secondary_endpoint_in = self.
devicedevice.oceandirect.odapi_get_device_usb_endpoint_secondary_in(self.
devicedevice.device_id, err_cp)
2496 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_usb_endpoint_secondary_in")
2498 return int(usb_secondary_endpoint_in)
2502 Reads out the firmware revision from the device's internal memory if that feature is supported.
2503 @return The firmware revision.
2506 err_cp = (c_long * 1)(0)
2507 fw_revision_cp = create_string_buffer(b
'\000' * 100)
2508 bytesRead = self.
devicedevice.oceandirect.odapi_adv_get_revision_firmware(self.
devicedevice.device_id, err_cp, fw_revision_cp, 100)
2513 return fw_revision_cp.value.decode()
2517 Reads out the FPGA revision from the device's internal memory if that feature is supported.
2518 @return The fpga revision.
2521 err_cp = (c_long * 1)(0)
2522 fpga_revision_cp = create_string_buffer(b
'\000' * 100)
2523 bytesRead = self.
devicedevice.oceandirect.odapi_adv_get_revision_fpga(self.
devicedevice.device_id, err_cp, fpga_revision_cp, 100)
2528 return fpga_revision_cp.value.decode()
2532 Check to see if DHCP (client) is enabled on the specified interface. If DHCP is enabled then the
2533 device will be able to receive an IP address from a DHCP server in the network it is connected to. See
2534 device manual if TCP/IP connection is supported.
2535 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
2536 @return True if DHCP is enabled on the specified interface otherwise it's False.
2539 err_cp = (c_long * 1)(0)
2540 enable = self.
devicedevice.oceandirect.odapi_adv_ipv4_is_dhcp_enabled(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum))
2545 return bool(c_ubyte(enable))
2552 Turn the DHCP client on or off for the device on the specified interface. See device manual if TCP/IP
2553 connection is supported.
2554 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
2555 @param[in] enabled False turns the DHCP client off. True turns the DHCP client on.
2558 err_cp = (c_long * 1)(0)
2559 self.
devicedevice.oceandirect.odapi_adv_ipv4_set_dhcp_enable(self.
devicedevice.device_id, err_cp, ifNum, enabled)
2570 Get the number of IP addresses available on the specified interface. If DHCP is enabled on the
2571 specified interface then index 0 represents the DHCP address and the following addresses
2572 will be any static IP addresses. See device manual if TCP/IP connection is supported.
2573 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
2574 @return The number of IP addresses on the specified interface.
2577 err_cp = (c_long * 1)(0)
2578 numIpAddress = self.
devicedevice.oceandirect.odapi_adv_ipv4_get_number_of_ip_addresses(self.
devicedevice.device_id, err_cp, ifNum)
2581 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_get_number_of_ip_addresses")
2583 return numIpAddress;
2590 Get the assigned ip address provided by the index of a particular interface. See device manual if
2591 TCP/IP connection is supported.
2592 @param[in] ifNum The network interface. 0 for ethernet, 1 for wifi.
2593 @param[in] addressIndex The location of the ip address. Starts with 0.
2594 @return A tuple of ip address (4-byte) and network mask (int).
2596 err_cp = (c_long * 1)(0)
2597 netmask_cp = (c_uint * 1)(0)
2598 ip_address_cp = (c_ubyte * 4)(0)
2599 self.
devicedevice.oceandirect.odapi_adv_ipv4_read_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum), c_ubyte(addressIndex),
2600 ip_address_cp, 4, netmask_cp)
2603 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_get_number_of_ip_addresses")
2607 outNetmask = int(netmask_cp[0])
2608 for i
in range(len(ip_address_cp)):
2609 outIpAddress.append(int(ip_address_cp[i]))
2610 return (outIpAddress, outNetmask)
2617 Add a static IP address to the specified interface. The IP address is specified as 4 bytes in an
2618 array. The leading part of the IP address must contain the first element of the array, followed by the
2619 remaining parts in order to the last part of the IP address in the fourth element of the array. See
2620 device manual if TCP/IP connection is supported.
2621 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
2622 @param[in] ipAddress The static IP address to be added. This is 4-byte array data.
2623 @param[in] netmask An 8-bit network mask specifying the subnet of the network the device is on.
2626 err_cp = (c_long * 1)(0)
2628 if len(ipAddress) != 4:
2629 error_msg =
"ipv4_add_static_ip_address() error: ipAddress must be an array of 4 bytes long."
2632 ip_address_cp = (c_ubyte * 4)(0)
2634 ip_address_cp[i] = ipAddress[i]
2637 self.
devicedevice.oceandirect.odapi_adv_ipv4_add_static_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum), ip_address_cp, 4, c_uint(netmask))
2647 Delete a static IP address on the specified interface. See device manual if TCP/IP connection is supported.
2648 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
2649 @param[in] addressIndex The index of the address to be deleted.
2652 err_cp = (c_long * 1)(0)
2654 self.
devicedevice.oceandirect.odapi_adv_ipv4_delete_static_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum), c_ubyte(addressIndex))
2656 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_delete_static_ip_address")
2664 Set the default gateway IP address to the specified interface. See device manual if TCP/IP connection is supported.
2666 @param[in] ifNum The interface number: 0 for Ethernet, 1 for wi-fi.
2667 @param[in] addressIndex The index of the address to be deleted.
2668 @param[in] ipAddress The static IP address to be added. This is 4-byte array data.
2671 err_cp = (c_long * 1)(0)
2673 if len(ipAddress) != 4:
2674 error_msg =
"ipv4_set_default_gateway_ip_address() error: ipAddress must be an array of 4 bytes long."
2677 ip_address_cp = (c_ubyte * 4)(0)
2679 ip_address_cp[i] = ipAddress[i]
2682 self.
devicedevice.oceandirect.odapi_adv_ipv4_set_default_gateway_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum), ip_address_cp, 4)
2684 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_set_default_gateway_ip_address")
2692 Get the default gateway IP address to the specified interface. See device manual if TCP/IP connection is supported.
2694 @param[in] ifNum The network interface. 0 for ethernet, 1 for wifi.
2695 @return The ip address (4-byte).
2697 err_cp = (c_long * 1)(0)
2698 ip_address_cp = (c_ubyte * 4)(0)
2699 self.
devicedevice.oceandirect.odapi_adv_ipv4_get_default_gateway_ip_address(self.
devicedevice.device_id, err_cp, c_ubyte(ifNum),
2703 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"ipv4_get_default_gateway_ip_address")
2707 for i
in range(len(ip_address_cp)):
2708 outIpAddress.append(int(ip_address_cp[i]))
2717 @return The pin count.
2720 err_cp = (c_long * 1)(0)
2721 gpioPinCount = self.
devicedevice.oceandirect.odapi_adv_get_gpio_pin_count(self.
devicedevice.device_id, err_cp)
2731 Sets the GPIO bit direction to either output or input.
2732 @param[in] bit The bit position.
2733 @param[in] isOutput The bit value which could be true(output) or false(input).
2736 err_cp = (c_long * 1)(0)
2737 self.
devicedevice.oceandirect.odapi_adv_gpio_set_output_enable1(self.
devicedevice.device_id, err_cp, bit, isOutput)
2745 Get GPIO bit direction.
2746 @param[in] bit The bit position.
2747 @return The bit direction which could be True(out) or False(in)
2750 err_cp = (c_long * 1)(0)
2751 bitDirection = self.
devicedevice.oceandirect.odapi_adv_gpio_get_output_enable1(self.
devicedevice.device_id, err_cp, bit)
2757 return bool(c_ubyte(bitDirection))
2761 Set the direction (input/output) of the GPIO pins.
2762 @param[in] bitmask The bit mask specifying the pin directions i.e. the nth bit set to 1 sets the nth pin to output.
2765 err_cp = (c_long * 1)(0)
2766 self.
devicedevice.oceandirect.odapi_adv_gpio_set_output_enable2(self.
devicedevice.device_id, err_cp, c_int(bitmask))
2774 Get all GPIO bit direction.
2775 @return All bit (int) direction where each bit could be True(out) or False(in).
2778 err_cp = (c_long * 1)(0)
2779 allBitDirection = self.
devicedevice.oceandirect.odapi_adv_gpio_get_output_enable2(self.
devicedevice.device_id, err_cp)
2785 return allBitDirection
2789 Sets the GPIO bit value to either high or low.
2790 @param[in] bit The bit position.
2791 @param[in] isHigh The bit value which could be true(high) or false(low).
2794 err_cp = (c_long * 1)(0)
2795 self.
devicedevice.oceandirect.odapi_adv_gpio_set_value1(self.
devicedevice.device_id, err_cp, bit, isHigh)
2803 Get the GPIO bit value in whether it's high(true) or low(false).
2804 @param[in] bit The bit position.
2805 @return The bit value. True for high and False for low.
2808 err_cp = (c_long * 1)(0)
2809 bitValue = self.
devicedevice.oceandirect.odapi_adv_gpio_get_value1(self.
devicedevice.device_id, err_cp, bit)
2815 return bool(c_ubyte(bitValue))
2819 Set the logic value for all GPIO pins.
2820 @param[in] bitmask The bit mask specifying the logic level of each GPIO pin.
2823 err_cp = (c_long * 1)(0)
2824 self.
devicedevice.oceandirect.odapi_adv_gpio_set_value2(self.
devicedevice.device_id, err_cp, c_int(bitmask))
2832 Get all GPIO bit values.
2833 @return All bit value (int) where each bit could be True(high) or False(low).
2836 err_cp = (c_long * 1)(0)
2837 allBitValue = self.
devicedevice.oceandirect.odapi_adv_gpio_get_value2(self.
devicedevice.device_id, err_cp)
2847 Set the alternate functionality for the specified pins (bits). Not
2848 all spectrometers support this functionality.
2849 @deprecated This function is deprecated starting with release 2.1 and will be removed in the future release.
2850 @param[in] bit The GPIO bit or pin to set.
2851 @param[in] isAlternate Set true to enable the alternate functionality for the pin, false otherwise (pin is a GPIO pin).
2854 err_cp = (c_long * 1)(0)
2855 self.
devicedevice.oceandirect.odapi_adv_gpio_set_output_alternate1(self.
devicedevice.device_id, err_cp, bit, isAlternate)
2863 Set the alternate functionality for the specified pins (bits). Not
2864 all spectrometers support this functionality.
2865 @deprecated This function is deprecated starting with release 2.1 and will be removed in the future release.
2866 @param[in] bitmask The bits set to 1 to set enable the alternate functionality, 0 otherwise (pin is a GPIO pin).
2869 err_cp = (c_long * 1)(0)
2870 self.
devicedevice.oceandirect.odapi_adv_gpio_set_output_alternate2(self.
devicedevice.device_id, err_cp, c_int(bitmask))
2878 Get the setting for alternate functionality on the specified bit (pin). Not
2879 all spectrometers support this functionality.
2880 @deprecated This function is deprecated starting with release 2.1 and will be removed in the future release.
2881 @param[in] bit The GPIO bit or pin to set.
2882 @return The bit value. True if the pin is set to alternate functionality, false otherwise (pin is a GPIO pin).
2885 err_cp = (c_long * 1)(0)
2886 bitValue = self.
devicedevice.oceandirect.odapi_adv_gpio_get_output_alternate1(self.
devicedevice.device_id, err_cp, bit)
2892 return bool(c_ubyte(bitValue))
2896 Get the settings for alternate functionality on the GPIO pins. Not
2897 all spectrometers support this functionality.
2898 @deprecated This function is deprecated starting with release 2.1 and will be removed in the future release.
2899 @return A bitmask with value 1 where the corresponding pin is set to alternate functionality, 0 otherwise (pin is a GPIO pin).
2902 err_cp = (c_long * 1)(0)
2903 allBitValue = self.
devicedevice.oceandirect.odapi_adv_gpio_get_output_alternate2(self.
devicedevice.device_id, err_cp)
2913 Enable or disable device LED. If the device don't have an LED then an exception will be thrown.
2914 @param[in] isEnabled True to enable LED blinking otherwise it's False.
2917 err_cp = (c_long * 1)(0)
2918 self.
devicedevice.oceandirect.odapi_adv_set_led_enable(self.
devicedevice.device_id, err_cp, isEnabled)
2926 Get device LED state. If the device don't have an LED then an exception will be thrown.
2927 @return True if LED is enabled otherwise it's False.
2930 err_cp = (c_long * 1)(0)
2931 ledState = self.
devicedevice.oceandirect.odapi_adv_get_led_enable(self.
devicedevice.device_id, err_cp)
2937 return bool(c_ubyte(ledState))
2941 Get the original vendor id (VID) of the device.
2945 err_cp = (c_long * 1)(0)
2946 orig_vid = self.
devicedevice.oceandirect.odapi_adv_get_device_original_vid(self.
devicedevice.device_id, err_cp)
2956 Get the original product id (PID) of the device.
2960 err_cp = (c_long * 1)(0)
2961 orig_pid = self.
devicedevice.oceandirect.odapi_adv_get_device_original_pid(self.
devicedevice.device_id, err_cp)
2971 Get the current vendor id (VID) of the device.
2975 err_cp = (c_long * 1)(0)
2976 vid = self.
devicedevice.oceandirect.odapi_adv_get_device_vid(self.
devicedevice.device_id, err_cp)
2986 Get the current product id (PID) of the device.
2990 err_cp = (c_long * 1)(0)
2991 pid = self.
devicedevice.oceandirect.odapi_adv_get_device_pid(self.
devicedevice.device_id, err_cp)
3001 Get the original manufacturer string of the device.
3002 @return The manufacturer string.
3005 orig_manufacturer = create_string_buffer(b
'\000'*50)
3006 err_cp = (c_long * 1)(0)
3007 self.
devicedevice.oceandirect.odapi_adv_get_device_original_manufacturer_string(self.
devicedevice.device_id, err_cp, orig_manufacturer, 50)
3010 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_original_manufacturer_string")
3013 return orig_manufacturer.value.decode()
3017 Get the original model string of the device.
3018 @return The model string.
3021 orig_model = create_string_buffer(b
'\000'*50)
3022 err_cp = (c_long * 1)(0)
3023 self.
devicedevice.oceandirect.odapi_adv_get_device_original_model_string(self.
devicedevice.device_id, err_cp, orig_model, 50)
3026 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_original_model_string")
3029 return orig_model.value.decode()
3033 Get the current manufacturer string of the device.
3034 @return The manufacturer string.
3037 manufacturer = create_string_buffer(b
'\000'*50)
3038 err_cp = (c_long * 1)(0)
3039 self.
devicedevice.oceandirect.odapi_adv_get_device_manufacturer_string(self.
devicedevice.device_id, err_cp, manufacturer, 50)
3042 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_manufacturer_string")
3045 return manufacturer.value.decode()
3049 Get the current model string of the device.
3050 @return The model string.
3053 model = create_string_buffer(b
'\000'*50)
3054 err_cp = (c_long * 1)(0)
3055 self.
devicedevice.oceandirect.odapi_adv_get_device_model_string(self.
devicedevice.device_id, err_cp, model, 50)
3058 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_device_original_model_string")
3061 return model.value.decode()
3065 Set the current manufacturer string of the device.
3066 @param[in] manufacturer The new manufacturer string.
3069 if not manufacturer:
3072 err_cp = (c_long * 1)(0)
3073 self.
devicedevice.oceandirect.odapi_adv_set_device_manufacturer_string(self.
devicedevice.device_id, err_cp, manufacturer.encode(
'utf-8'), len(manufacturer))
3076 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_device_manufacturer_string")
3081 Set the current model string of the device.
3082 @param[in] model The new model string.
3088 err_cp = (c_long * 1)(0)
3089 self.
devicedevice.oceandirect.odapi_adv_set_device_model_string(self.
devicedevice.device_id, err_cp, model.encode(
'utf-8'), len(model))
3133 Read the device alias from the device. If this field in the device is not yet populated then a non-zero(6) code will be returned.
3134 @return The device alias.
3137 device_alias = create_string_buffer(b
'\000'*50)
3138 err_cp = (c_long * 1)(0)
3139 self.
devicedevice.oceandirect.odapi_adv_get_device_alias(self.
devicedevice.device_id, err_cp, device_alias, 50)
3145 return device_alias.value.decode()
3149 Set a new device alias to the device.
3150 @param[in] deviceAlias The device alias. If value is empty then an exception will be thrown.
3158 err_cp = (c_long * 1)(0)
3159 self.
devicedevice.oceandirect.odapi_adv_set_device_alias(self.
devicedevice.device_id, err_cp, deviceAlias.encode(
'utf-8'), len(deviceAlias))
3167 Restarts the device.
3170 err_cp = (c_long * 1)(0)
3171 self.
devicedevice.oceandirect.odapi_adv_reset_device(self.
devicedevice.device_id, err_cp)
3179 Read the user string from the device. If this field in the device is not yet populated then a
3180 non-zero(6) code will be returned. This is the command supported for the newer OBP2.0 enabled devices.
3181 @return The user string.
3184 user_string = create_string_buffer(b
'\000'*50)
3185 err_cp = (c_long * 1)(0)
3186 self.
devicedevice.oceandirect.odapi_get_user_string(self.
devicedevice.device_id, err_cp, user_string, 50)
3192 return user_string.value.decode()
3196 Set a new user string to the device. The maximum string length is 16. This is the command supported
3197 for the newer OBP2.0 enabled devices.
3198 @param[in] userString The user string. If value is empty then an exception will be thrown.
3206 err_cp = (c_long * 1)(0)
3207 self.
devicedevice.oceandirect.odapi_set_user_string(self.
devicedevice.device_id, err_cp, userString.encode(
'utf-8'), len(userString))
3215 Read the total user string count from the device. If the device don't support this command
3216 then a non-zero error code will be returned. This command is used by legacy devices.
3217 @return The string count.
3220 err_cp = (c_long * 1)(0)
3221 string_count = self.
devicedevice.oceandirect.odapi_get_user_string_count1(self.
devicedevice.device_id, err_cp)
3231 Read the user string from the device. If this field in the device is not yet populated then a
3232 non-zero(6) code will be returned. If the device don't support this command then a non-zero
3233 error code will be returned. This command is used by legacy devices.
3234 @return The user string.
3237 user_string = create_string_buffer(b
'\000'*50)
3238 err_cp = (c_long * 1)(0)
3239 self.
devicedevice.oceandirect.odapi_get_user_string1(self.
devicedevice.device_id, err_cp, c_int(index), user_string, 50)
3245 return user_string.value.decode()
3249 Write the user string to the device. The maximum string length is 16. If the device don't support this command
3250 then a non-zero error code will be returned. This command is used by legacy devices.
3251 @param[in] index The user string index. If index is less than 0 then an exception will be thrown.
3252 @param[in] userString The user string. If value is empty then an exception will be thrown.
3255 if index < 0
or not userString:
3260 err_cp = (c_long * 1)(0)
3261 self.
devicedevice.oceandirect.odapi_set_user_string1(self.
devicedevice.device_id, err_cp, c_int(index), userString.encode(
'utf-8'), len(userString))
3269 Read the maximum ADC counts.
3270 @return The ADC counts.
3273 err_cp = (c_long * 1)(0)
3274 adcCount = self.
devicedevice.oceandirect.odapi_adv_get_autonull_maximum_adc_count(self.
devicedevice.device_id, err_cp)
3277 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_autonull_maximum_adc_count")
3285 Read the baseline level.
3286 @return The baseline level.
3289 err_cp = (c_long * 1)(0)
3290 baseline = self.
devicedevice.oceandirect.odapi_adv_get_autonull_baseline_level(self.
devicedevice.device_id, err_cp)
3300 Read the saturation level. Most devices returns 65535.
3301 @return The saturation level.
3304 err_cp = (c_long * 1)(0)
3305 saturation = self.
devicedevice.oceandirect.odapi_adv_get_autonull_saturation_level(self.
devicedevice.device_id, err_cp)
3308 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_autonull_saturation_level")
3315 Read the device RS-232 baud rate. Not all devices supported this command.
3316 @return The baud rate.
3319 err_cp = (c_long * 1)(0)
3320 baud_rate = self.
devicedevice.oceandirect.odapi_adv_get_baud_rate(self.
devicedevice.device_id, err_cp)
3330 Set a new baud rate for the RS-232 port. Not all devices supported this command.
3331 @param[in] baudRate The baud rate value.
3334 err_cp = (c_long * 1)(0)
3335 self.
devicedevice.oceandirect.odapi_adv_set_baud_rate(self.
devicedevice.device_id, err_cp, c_int(baudRate))
3343 Save settings to flash. Not all devices supported this command.
3346 err_cp = (c_long * 1)(0)
3347 self.
devicedevice.oceandirect.odapi_adv_save_settings_to_flash(self.
devicedevice.device_id, err_cp)
3355 Read the active pixel range from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3356 If the device don't support this command then a non-zero error code will be returned.
3357 @return A list of active pixel range.
3360 range = (c_int * 10)(0)
3361 err_cp = (c_long * 1)(0)
3362 elementCopied = self.
devicedevice.oceandirect.odapi_get_active_pixel_range(self.
devicedevice.device_id, err_cp, range, 10)
3368 return list(range)[0:elementCopied]
3372 Read the optical dark pixel range from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3373 If the device don't support this command then a non-zero error code will be returned.
3374 @return A list of optical dark pixel range.
3377 range = (c_int * 10)(0)
3378 err_cp = (c_long * 1)(0)
3379 elementCopied = self.
devicedevice.oceandirect.odapi_get_optical_dark_pixel_range(self.
devicedevice.device_id, err_cp, range, 10)
3385 return list(range)[0:elementCopied]
3389 Read the transition pixel range from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3390 If the device don't support this command then a non-zero error code will be returned.
3391 @return A list of transition pixel range.
3394 range = (c_int * 10)(0)
3395 err_cp = (c_long * 1)(0)
3396 elementCopied = self.
devicedevice.oceandirect.odapi_get_transition_pixel_range(self.
devicedevice.device_id, err_cp, range, 10)
3402 return list(range)[0:elementCopied]
3406 Read bad pixel indices from the sensor pixel array. This command is being used in OBP-2.0 enabled devices.
3407 If the device don't support this command then a non-zero error code will be returned.
3408 @return A list of bad pixel indices.
3411 range = (c_int * 40)(0)
3412 err_cp = (c_long * 1)(0)
3413 elementCopied = self.
devicedevice.oceandirect.odapi_get_bad_pixel_indices(self.
devicedevice.device_id, err_cp, range, 40)
3419 return list(range)[0:elementCopied]
3423 Read the number of supported communication interface.
3424 @return The number of interface.
3426 err_cp = (c_long * 1)(0)
3427 if_count = self.
devicedevice.oceandirect.odapi_adv_network_conf_get_interface_count(self.
devicedevice.device_id, err_cp)
3437 Return the interface type of the given interface index.
3438 @param interfaceIndex[in] The interface to look at.
3439 @return The interface type which could be one 0(Loopback), 1(wired ethernet), 2 (WIFI), and 3 (USB - CDC Ethernet).
3441 err_cp = (c_long * 1)(0)
3442 if_type = self.
devicedevice.oceandirect.odapi_adv_network_conf_get_interface_type(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3455 Return true if the interface is enabled otherwise it's false.
3456 @param interfaceIndex[in] The interface to look at.
3457 @return True if the interface if enabled otherwise it's False.
3459 err_cp = (c_long * 1)(0)
3460 enabled = self.
devicedevice.oceandirect.odapi_adv_network_conf_get_interface_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3463 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_network_interface_status")
3466 return bool(c_ubyte(enabled))
3473 Enable or disable the interface.
3475 @param interfaceIndex[in] The interface that will be enabled or disabled.
3476 @param enable[in] True will enable the interface. False will disable it.
3478 err_cp = (c_long * 1)(0)
3481 self.
devicedevice.oceandirect.odapi_adv_network_conf_set_interface_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), c_ubyte(1))
3483 self.
devicedevice.oceandirect.odapi_adv_network_conf_set_interface_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), c_ubyte(0))
3486 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_network_interface_status")
3494 Save the network interface settings to the device.
3496 @param interfaceIndex[in] The interface to saved to.
3498 err_cp = (c_long * 1)(0)
3499 self.
devicedevice.oceandirect.odapi_adv_network_conf_save_interface_setting(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3502 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"save_network_interface_setting")
3510 Return the status on whether the gigabit ethernet is enabled or not.
3512 @param interfaceIndex[in] The ethernet interface to look at.
3513 @return The interface status.
3515 err_cp = (c_long * 1)(0)
3516 status = self.
devicedevice.oceandirect.odapi_adv_ethernet_get_gigabit_enable_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3519 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_ethernet_gigabit_enable_status")
3529 Enable or disable the gigabit ethernet the status.
3530 @param interfaceIndex[in] The ethernet interface to look at.
3531 @param enable True will enable gigabit ethernet.
3533 err_cp = (c_long * 1)(0)
3535 self.
devicedevice.oceandirect.odapi_adv_ethernet_set_gigabit_enable_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), 1)
3537 self.
devicedevice.oceandirect.odapi_adv_ethernet_set_gigabit_enable_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), 0)
3540 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_ethernet_gigabit_enable_status")
3548 Read the number of supported communication interface.
3550 @return The number of interface.
3552 err_cp = (c_long * 1)(0)
3553 if_count = self.
devicedevice.oceandirect.odapi_adv_network_conf_get_interface_count(self.
devicedevice.device_id, err_cp)
3563 Return the interface type of the given interface index.
3565 @param interfaceIndex[in] The interface to look at.
3566 @return The interface type which could be one 0(Loopback), 1(wired ethernet), 2 (WIFI), and 3 (USB - CDC Ethernet).
3568 err_cp = (c_long * 1)(0)
3569 if_type = self.
devicedevice.oceandirect.odapi_adv_network_conf_get_interface_type(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3582 Return true if the interface is enabled otherwise it's false.
3584 @param interfaceIndex[in] The interface to look at.
3585 @return True if the interface if enabled otherwise it's False.
3587 err_cp = (c_long * 1)(0)
3588 enabled = self.
devicedevice.oceandirect.odapi_adv_network_conf_get_interface_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3591 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_network_interface_status")
3594 return bool(c_ubyte(enabled))
3601 Enable or disable the interface.
3603 @param interfaceIndex[in] The interface that will be enabled or disabled.
3604 @param enable[in] True will enable the interface. False will disable it.
3606 err_cp = (c_long * 1)(0)
3609 self.
devicedevice.oceandirect.odapi_adv_network_conf_set_interface_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), c_ubyte(1))
3611 self.
devicedevice.oceandirect.odapi_adv_network_conf_set_interface_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), c_ubyte(0))
3614 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_network_interface_status")
3622 Save the network interface settings to the device.
3624 @param interfaceIndex[in] The interface to saved to.
3626 err_cp = (c_long * 1)(0)
3627 self.
devicedevice.oceandirect.odapi_adv_network_conf_save_interface_setting(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3630 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"save_network_interface_setting")
3638 Return the status on whether the gigabit ethernet is enabled or not.
3640 @param interfaceIndex[in] The ethernet interface to look at.
3641 @return The interface status.
3643 err_cp = (c_long * 1)(0)
3644 status = self.
devicedevice.oceandirect.odapi_adv_ethernet_get_gigabit_enable_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3647 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_ethernet_gigabit_enable_status")
3657 Enable or disable the gigabit ethernet the status.
3659 @param interfaceIndex[in] The ethernet interface to look at.
3660 @param enable True will enable gigabit ethernet.
3662 err_cp = (c_long * 1)(0)
3664 self.
devicedevice.oceandirect.odapi_adv_ethernet_set_gigabit_enable_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), 1)
3666 self.
devicedevice.oceandirect.odapi_adv_ethernet_set_gigabit_enable_status(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), 0)
3669 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_ethernet_gigabit_enable_status")
3678 Return true if the multicast group message is enabled otherwise it's false.
3680 @param interfaceIndex[in] The ethernet interface to look at.
3681 @return The multicast group enable status.
3683 err_cp = (c_long * 1)(0)
3684 status = self.
devicedevice.oceandirect.odapi_adv_network_conf_get_multicast_group_enabled(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex))
3697 Enable or disable the multicast message group.
3699 @param interfaceIndex[in] The ethernet interface to look at.
3700 @param enable True will enable multicast message group.
3702 err_cp = (c_long * 1)(0)
3704 self.
devicedevice.oceandirect.odapi_adv_network_conf_set_multicast_group_enabled(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), 1)
3706 self.
devicedevice.oceandirect.odapi_adv_network_conf_set_multicast_group_enabled(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), 0)
3718 Read the ethernet 6-byte mac address from the spectrometer.
3720 @param interfaceIndex[in] The ethernet interface to look at.
3721 @return The mac address.
3723 err_cp = (c_long * 1)(0)
3725 mac_address_cp = (c_ubyte * array_len)(0)
3727 self.
devicedevice.oceandirect.odapi_adv_ethernet_get_mac_address(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), mac_address_cp, array_len)
3734 for i
in range(array_len):
3735 value.append(int(mac_address_cp[i]))
3743 Writes a new ethernet 6-byte mac address into the spectrometer.
3745 @param interfaceIndex[in] The ethernet interface to look at.
3746 @param macAddress[in] The new mac address which is 6-byte long.
3749 err_cp = (c_long * 1)(0)
3750 array_len = len(macAddress)
3753 error_msg =
"set_ethernet_mac_address() error: macAddress must be an array of 6 bytes long."
3756 mac_address_cp = (c_ubyte * array_len)(0)
3757 for i
in range(array_len):
3758 mac_address_cp[i] = macAddress[i]
3760 self.
devicedevice.oceandirect.odapi_adv_ethernet_set_mac_address(self.
devicedevice.device_id, err_cp, c_uint(interfaceIndex), mac_address_cp, array_len)
3771 Read the IP address mode from the OBP2 device.
3772 @return True if the ip address was statically assigned. False if the ip address was generated via DHCP.
3774 err_cp = (c_long * 1)(0)
3775 status = self.
devicedevice.oceandirect.odapi_adv_get_ip_address_assigned_mode(self.
devicedevice.device_id, err_cp)
3778 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_ip_address_assigned_mode")
3781 return bool(c_ubyte(status))
3785 Set the IP address mode to the OBP2 device.
3786 @param useStaticIP[in] True will use statically assigned IP address. False will use DHCP server for ip assignment.
3788 err_cp = (c_long * 1)(0)
3790 self.
devicedevice.oceandirect.odapi_adv_set_ip_address_assigned_mode(self.
devicedevice.device_id, err_cp, 1)
3792 self.
devicedevice.oceandirect.odapi_adv_set_ip_address_assigned_mode(self.
devicedevice.device_id, err_cp, 0)
3795 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_ip_address_assigned_mode")
3800 Read the network configuration parameters from an OBP2 enabled device. This function
3801 will return a tuple of 6 objects in this order:
3802 address mode - True if it's using static IP address otherwise its False.
3803 list[int] - the static IP address.
3804 list[int] - the subnet mask.
3805 list[int] - the default gateway IP address.
3806 list[int] - the DNS server IP address.
3807 @return A tuple of 5 object objects.
3809 err_cp = (c_long * 1)(0)
3810 outManualAssignment_cp = c_ubyte(0)
3811 ipv4_address_array_len = 4
3812 subnet_mask_array_len = 4
3813 default_gateway_array_len = 4
3814 dns_server_array_len = 4
3815 ipv4_address_cp = (c_ubyte * ipv4_address_array_len)(0)
3816 subnet_mask_cp = (c_ubyte * subnet_mask_array_len)(0)
3817 default_gateway_cp = (c_ubyte * default_gateway_array_len)(0)
3818 dns_server_cp = (c_ubyte * dns_server_array_len)(0)
3820 self.
devicedevice.oceandirect.odapi_adv_get_network_configuration(self.
devicedevice.device_id, err_cp,
3821 byref(outManualAssignment_cp),
3822 ipv4_address_cp, ipv4_address_array_len,
3823 subnet_mask_cp, subnet_mask_array_len,
3824 default_gateway_cp, default_gateway_array_len,
3825 dns_server_cp, dns_server_array_len)
3833 default_gateway = []
3835 for i
in range(ipv4_address_array_len):
3836 ipv4_address.append(int(ipv4_address_cp[i]))
3837 subnet_mask.append(int(subnet_mask_cp[i]))
3838 default_gateway.append(int(default_gateway_cp[i]))
3839 dns_server.append(int(dns_server_cp[i]))
3841 return (bool(outManualAssignment_cp), ipv4_address, subnet_mask, default_gateway, dns_server)
3845 defaultGateway: list[int], dnsServer: list[int]) ->
None:
3847 Write the network configuration parameters (static ip address) on OBP2 enabled device.
3849 @param ipv4Address[in] The static IP address.
3850 @param subnetMask[in] The subnet mask.
3851 @param defaultGateway[in] The default gateway IP address.
3852 @param dnsServer[in] The DNS server IP address.
3854 err_cp = (c_long * 1)(0)
3855 ipv4Address_array_len = len(ipv4Address)
3856 subnetMask_array_len = len(subnetMask)
3857 defaultGateway_array_len = len(defaultGateway)
3858 dnsServer_array_len = len(dnsServer)
3860 if ipv4Address_array_len != 4
or subnetMask_array_len != 4
or defaultGateway_array_len != 4
or dnsServer_array_len != 4:
3861 error_msg =
"set_manual_network_configuration() error: an array must of 4 bytes long."
3864 ipv4Address_cp = (c_ubyte * ipv4Address_array_len)(0)
3865 subnetMask_cp = (c_ubyte * subnetMask_array_len)(0)
3866 defaultGateway_cp = (c_ubyte * defaultGateway_array_len)(0)
3867 dnsServer_cp = (c_ubyte * dnsServer_array_len)(0)
3868 for i
in range(ipv4Address_array_len):
3869 ipv4Address_cp[i] = ipv4Address[i]
3870 subnetMask_cp[i] = subnetMask[i]
3871 defaultGateway_cp[i] = defaultGateway[i]
3872 dnsServer_cp[i] = dnsServer[i]
3874 self.
devicedevice.oceandirect.odapi_adv_set_manual_network_configuration(self.
devicedevice.device_id, err_cp,
3875 ipv4Address_cp, ipv4Address_array_len,
3876 subnetMask_cp, subnetMask_array_len,
3877 defaultGateway_cp, defaultGateway_array_len,
3878 dnsServer_cp, dnsServer_array_len)
3881 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"set_manual_network_configuration")
3886 Read the network configuration parameters (static ip address) from an OBP2 enabled device. This
3887 function will return a tuple of 4 objects in this order:
3888 list[int] - the static IP address.
3889 list[int] - the subnet mask.
3890 list[int] - the default gateway IP address.
3891 list[int] - the DNS server IP address.
3892 @return A tuple of 4 object objects.
3894 err_cp = (c_long * 1)(0)
3895 ipv4_address_array_len = 4
3896 subnet_mask_array_len = 4
3897 default_gateway_array_len = 4
3898 dns_server_array_len = 4
3899 ipv4_address_cp = (c_ubyte * ipv4_address_array_len)(0)
3900 subnet_mask_cp = (c_ubyte * subnet_mask_array_len)(0)
3901 default_gateway_cp = (c_ubyte * default_gateway_array_len)(0)
3902 dns_server_cp = (c_ubyte * dns_server_array_len)(0)
3904 self.
devicedevice.oceandirect.odapi_adv_get_manual_network_configuration(self.
devicedevice.device_id, err_cp,
3905 ipv4_address_cp, ipv4_address_array_len,
3906 subnet_mask_cp, subnet_mask_array_len,
3907 default_gateway_cp, default_gateway_array_len,
3908 dns_server_cp, dns_server_array_len)
3911 error_msg = self.
devicedevice.
decode_error(err_cp[0],
"get_manual_network_configuration")
3916 default_gateway = []
3918 for i
in range(ipv4_address_array_len):
3919 ipv4_address.append(int(ipv4_address_cp[i]))
3920 subnet_mask.append(int(subnet_mask_cp[i]))
3921 default_gateway.append(int(default_gateway_cp[i]))
3922 dns_server.append(int(dns_server_cp[i]))
3924 return (ipv4_address, subnet_mask, default_gateway, dns_server)
An enumerated class for feature id.
None close_all_devices(self)
'Spectrometer' get_device(self, int device_id)
'Spectrometer' open_device(self, int device_id)
Attach to a device discovered by probe_devices or get_device_ids.
str decode_error(self, int errno, str caller)
str get_serial_number(self, int dev_id)
Gets the serial number of a specified device.
None add_network_device(self, str ipAddressStr, str deviceTypeStr)
Manually create an instance of the network attached device and then open it using the openDevice() fu...
None shutdown(self)
Closes the connection to OceanDirectAPI.
tuple[int, int, int] get_api_version_numbers(self)
Return OceanDirect api version information.
int find_usb_devices(self)
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers.
int find_devices(self)
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers,...
None close_device(self, int device_id)
Detach from the device indicated by device_id.
def __getattr__(self, name)
'Spectrometer' from_serial_number(self, str serial_num)
Return a spectrometer object associated with device id.
None add_rs232_device(self, str device_type, str bus_path, int baud)
Adds a device connected via RS 232 to the device list.
list[int] get_network_device_ids(self)
Return a list of network device ids from devices that were probe.
list[int] get_device_ids(self)
Return a list of device ids from devices that were both probe or manually added.
int get_number_devices(self)
Returns the number of devices available.
None list_all_devices(self)
Lists defined details of all active devices.
An error code and error message object wrapper.
tuple[int, str] get_error_details(self)
def __init__(self, int errorCode, str errorMsg)
Subclass containing advanced features that may or may not be in the spectrometer.
None get_shutter_state(self)
This function returns the shutter state of the spectrometer.
None set_multicast_group_enabled2(self, bool enable)
int get_autonull_saturation_level(self)
Read the saturation level.
int get_continuous_strobe_period_maximum(self)
Gets the maximum continuous strobe period of the device in microseconds.
int get_usb_endpoint_secondary_in(self)
This function returns the usb secondary IN endpoint for the type specified.
int ipv4_get_number_of_ip_addresses(self, int ifNum)
Get the number of IP addresses available on the specified interface.
None gpio_set_output_enable1(self, int bit, bool isOutput)
Sets the GPIO bit direction to either output or input.
int get_device_original_vid(self)
Get the original vendor id (VID) of the device.
None set_single_strobe_enable(self, bool enable)
Set the enable status of the single strobe signal.
int get_data_buffer_capacity_maximum(self)
Get the maximum possible configurable size for the data buffer.
str get_revision_firmware(self)
Reads out the firmware revision from the device's internal memory if that feature is supported.
int get_single_strobe_delay_increment(self)
Gets the single strobe delay increment in microseconds.
int get_single_strobe_delay_minimum(self)
Get the minimum amount of time, in microseconds, that should elapse after a starting event before the...
None ipv4_add_static_ip_address2(self, list[int] ipAddress, int netmask)
int get_single_strobe_width_increment(self)
Get the single strobe width increment.
None set_user_string2(self, int index, str userString)
Write the user string to the device.
list[int] get_active_pixel_range(self)
Read the active pixel range from the sensor pixel array.
int get_device_pid(self)
Get the current product id (PID) of the device.
float get_tec_temperature_degrees_C(self)
Returns the temperature reading (celsius) of a detector thermistor.
str get_user_string(self)
Read the user string from the device.
int get_single_strobe_width_maximum(self)
Get the maximum amount of time, in microseconds, that the single strobe pulse should remain high afte...
int get_device_vid(self)
Get the current vendor id (VID) of the device.
str get_device_alias(self)
Read the device alias from the device.
None save_settings_to_flash(self)
Save settings to flash.
None set_data_buffer_enable(self, bool enable)
Enable or disable data buffering.
int get_data_buffer_number_of_elements(self)
Get the number of data elements currently in the buffer.
int get_baud_rate(self)
Read the device RS-232 baud rate.
int get_usb_endpoint_secondary_out(self)
This function returns the usb secondary OUT endpoint for the type specified.
None set_continuous_strobe_width(self, int widthMicrosecond)
Sets the continuous strobe width on the device.
None set_ip_address_assigned_mode(self, bool useStaticIP)
Set the IP address mode to the OBP2 device.
int gpio_get_output_enable2(self)
Get all GPIO bit direction.
int get_light_source_count(self)
Gets the number of light sources that are represented by the given featureID.
int get_single_strobe_delay(self)
Get the amount of time, in microseconds, that should elapse after a starting event before the single ...
None set_ethernet_gigabit_enable_status(self, int interfaceIndex, bool enable)
Enable or disable the gigabit ethernet the status.
int get_autonull_baseline_level(self)
Read the baseline level.
bool gpio_get_output_alternate1(self, int bit)
Get the setting for alternate functionality on the specified bit (pin).
str get_device_original_manufacturer_string(self)
Get the original manufacturer string of the device.
list[int] get_ethernet_mac_address(self, int interfaceIndex)
Read the ethernet 6-byte mac address from the spectrometer.
list[float] get_nonlinearity_coeffs(self)
Read the nonlinearity coefficients stored in the device.
int get_continuous_strobe_period_minimum(self)
Gets the minimum continuous strobe period of the device in microseconds.
int get_single_strobe_cycle_maximum(self)
Gets the single strobe cycle maximum in microseconds.
None gpio_set_value2(self, int bitmask)
Set the logic value for all GPIO pins.
def __init__(self, 'Spectrometer' device)
None set_enable_lamp(self, bool enable)
Enable or disable the lamp.
int get_data_buffer_capacity(self)
Get the present limit of how many data elements will be retained by the buffer.
int get_user_string_count2(self)
Read the total user string count from the device.
list[int] ipv4_get_default_gateway_ip_address2(self)
int get_number_of_backtoback_scans(self)
Get the number of back-to-back scans.
float get_nonlinearity_coeffs1(self, int index)
Read the nonlinearity coefficients count of a given position from the device.
None save_network_interface_setting2(self)
None gpio_set_value1(self, int bit, bool isHigh)
Sets the GPIO bit value to either high or low.
None set_device_model_string(self, str model)
Set the current model string of the device.
int get_usb_endpoint_primary_in(self)
This function returns the usb primary IN endpoint for the type specified.
None set_single_strobe_delay(self, int delayMicrosecond)
Set the amount of time, in microseconds, that should elapse after a starting event before the single ...
None ipv4_add_static_ip_address(self, int ifNum, list[int] ipAddress, int netmask)
Add a static IP address to the specified interface.
str get_user_string2(self, int index)
Read the user string from the device.
None reset_device(self)
Restarts the device.
list[int] get_optical_dark_pixel_range(self)
Read the optical dark pixel range from the sensor pixel array.
None ipv4_set_dhcp_enable2(self, bool enabled)
None ipv4_delete_static_ip_address(self, int ifNum, int addressIndex)
Delete a static IP address on the specified interface.
None set_network_interface_status2(self, bool enable)
int get_data_buffer_capacity_minimum(self)
Get the minimum possible configurable size for the data buffer.
bool get_led_enable(self)
Get device LED state.
int gpio_get_value2(self)
Get all GPIO bit values.
bool get_multicast_group_enabled2(self)
None enable_light_source(self, int light_source_index, bool enable)
Attempts to enable or disable the indicated light source within the given feature instance.
bool get_ethernet_gigabit_enable_status(self, int interfaceIndex)
Return the status on whether the gigabit ethernet is enabled or not.
None abort_acquisition(self)
Abort spectra acquisition and put the device into an idle state.
int get_device_original_pid(self)
Get the original product id (PID) of the device.
int get_network_interface_type2(self)
str get_revision_fpga(self)
Reads out the FPGA revision from the device's internal memory if that feature is supported.
None set_single_strobe_width(self, int widthMicrosecond)
Set the amount of time, in microseconds, that the single strobe pulse should remain high after it beg...
int get_continuous_strobe_period(self)
Get the continuous strobe period in microseconds.
None set_tec_enable(self, bool coolerEnable)
Enable or disable the thermo-electric cooler attached to the detector.
bool get_continuous_strobe_enable(self)
Gets the continuous strobe state (enabled or disabled) of the device.
None gpio_set_output_alternate2(self, int bitmask)
Set the alternate functionality for the specified pins (bits).
None ipv4_delete_static_ip_address2(self, int addressIndex)
None set_continuous_strobe_enable(self, bool enable)
Sets the continuous strobe enable state on the device.
list[int] ipv4_get_default_gateway_ip_address(self, int ifNum)
Get the default gateway IP address to the specified interface.
None ipv4_set_default_gateway_ip_address(self, int ifNum, list[int] ipAddress)
Set the default gateway IP address to the specified interface.
tuple[list[int], int] ipv4_read_ip_address(self, int ifNum, int addressIndex)
Get the assigned ip address provided by the index of a particular interface.
None set_ethernet_mac_address2(self, list[int] macAddress)
None set_number_of_backtoback_scans(self, int numScans)
Set the number of spectra that the device will capture per trigger event.
bool get_device_idle_state(self)
Return device idle state.
bool gpio_get_value1(self, int bit)
Get the GPIO bit value in whether it's high(true) or low(false).
None set_ethernet_mac_address(self, int interfaceIndex, list[int] macAddress)
Writes a new ethernet 6-byte mac address into the spectrometer.
int get_continuous_strobe_period_increment(self)
This function gets the current size of the strobe period increment of the device in microseconds.
bool get_ethernet_gigabit_enable_status2(self)
bool get_enable_lamp(self)
Return the lamp state.
int gpio_get_output_alternate2(self)
Get the settings for alternate functionality on the GPIO pins.
bool ipv4_is_dhcp_enabled2(self)
None gpio_set_output_alternate1(self, int bit, bool isAlternate)
Set the alternate functionality for the specified pins (bits).
int get_usb_endpoint_primary_out(self)
This function returns the usb primary OUT endpoint for the type specified.
None clear_data_buffer(self)
Clear the data buffer.
str get_device_manufacturer_string(self)
Get the current manufacturer string of the device.
None set_ethernet_gigabit_enable_status2(self, bool enable)
bool get_ip_address_assigned_mode(self)
Read the IP address mode from the OBP2 device.
None gpio_set_output_enable2(self, int bitmask)
Set the direction (input/output) of the GPIO pins.
int get_continuous_strobe_width(self)
Gets the strobe width of the device in microseconds.
None acquire_spectra_to_buffer(self)
Start spectra acquisition.
None set_manual_network_configuration(self, list[int] ipv4Address, list[int] subnetMask, list[int] defaultGateway, list[int] dnsServer)
Write the network configuration parameters (static ip address) on OBP2 enabled device.
None set_data_buffer_capacity(self, int capacity)
Set the number of data elements that the buffer should retain.
tuple[list[int], int] ipv4_read_ip_address2(self, int addressIndex)
bool get_data_buffer_enable(self)
Reads the device data buffering enable state.
tuple[list[int], list[int], list[int], list[int]] get_manual_network_configuration(self)
Read the network configuration parameters (static ip address) from an OBP2 enabled device.
list[int] get_bad_pixel_indices(self)
Read bad pixel indices from the sensor pixel array.
bool get_single_strobe_enable(self)
Get the enable status of the single strobe signal.
bool has_light_source_enable(self, int light_source_index)
Queries whether the indicated light source within the given feature instance has a usable enable/disa...
None set_network_interface_status(self, int interfaceIndex, bool enable)
Enable or disable the interface.
None set_shutter_open(self, bool shutterState)
This function will open or close the shutter on the spectrometer.
bool get_network_interface_status2(self)
int get_single_strobe_width(self)
Get the amount of time, in microseconds, that the single strobe pulse should remain high after it beg...
None set_device_alias(self, str deviceAlias)
Set a new device alias to the device.
tuple[bool, list[int], list[int], list[int], list[int]] get_network_configuration(self)
Read the network configuration parameters from an OBP2 enabled device.
bool get_tec_stable(self)
Returns the state of thermo-electric cooler temperature on whether it reached the stable temperature ...
None set_continuous_strobe_period(self, int period)
Sets the continuous strobe period in microseconds.
None ipv4_set_dhcp_enable(self, int ifNum, bool enabled)
Turn the DHCP client on or off for the device on the specified interface.
bool get_tec_enable(self)
Read the state of the thermo-electric cooler whether it's enable or disable.
int get_gpio_pin_count(self)
Get GPIO pin count.
int get_network_interface_type(self, int interfaceIndex)
Return the interface type of the given interface index.
int get_single_strobe_width_minimum(self)
Get the minimum amount of time, in microseconds, that the single strobe pulse should remain high afte...
bool get_tec_fan_enable(self)
Returns the thermo-electric cooler fan state whether it's enabled or not.
list[int] get_ethernet_mac_address2(self)
int get_nonlinearity_coeffs_count1(self)
Read the nonlinearity coefficients count from the device.
str get_device_model_string(self)
Get the current model string of the device.
int get_single_strobe_delay_maximum(self)
Get the maximum amount of time, in microseconds, that should elapse after a starting event before the...
float get_temperature_setpoint_degrees_C(self)
Read the set point temperature of the thermo-electric cooler.
int get_autonull_maximum_adc_count(self)
Read the maximum ADC counts.
bool ipv4_is_dhcp_enabled(self, int ifNum)
Check to see if DHCP (client) is enabled on the specified interface.
None set_device_manufacturer_string(self, str manufacturer)
Set the current manufacturer string of the device.
None set_baud_rate(self, int baudRate)
Set a new baud rate for the RS-232 port.
None set_user_string(self, str userString)
Set a new user string to the device.
None set_multicast_group_enabled(self, int interfaceIndex, bool enable)
Enable or disable the multicast message group.
bool get_network_interface_status(self, int interfaceIndex)
Return true if the interface is enabled otherwise it's false.
bool get_multicast_group_enabled(self, int interfaceIndex)
Return true if the multicast group message is enabled otherwise it's false.
str get_device_original_model_string(self)
Get the original model string of the device.
int get_raw_spectrum_with_metadata(self, list[list[float]] list_raw_spectra, list[int] list_timestamp, int buffer_size)
Returns spectra with metadata information.
bool gpio_get_output_enable1(self, int bit)
Get GPIO bit direction.
int ipv4_get_number_of_ip_addresses2(self)
list[int] get_transition_pixel_range(self)
Read the transition pixel range from the sensor pixel array.
None set_led_enable(self, bool isEnabled)
Enable or disable device LED.
int get_network_interface_count(self)
Read the number of supported communication interface.
None set_temperature_setpoint_degrees_C(self, float temp_C)
Apply the setpoint temperature (Celsius) in the thermo-electric cooler.
int num_nonlinearity_coeffs
None ipv4_set_default_gateway_ip_address2(self, list[int] ipAddress)
None save_network_interface_setting(self, int interfaceIndex)
Save the network interface settings to the device.
bool is_light_source_enabled(self, int light_source_index)
Queries whether the indicated light source within the given feature instance is enabled (energized).
list[float] get_wavelength_coeffs(self)
Read the wavelength coefficients from the device.
Class that models the individual spectrometer.
int get_acquisition_delay(self)
Get the acquisition delay in microseconds.
list[float] nonlinearity_correct_spectrum2(self, list[float] darkSpectrum, list[float] illuminatedSpectrum)
Nonlinearity correct a previously acquired illuminated spectrum after dark correction using a previou...
None open_device(self)
Open the current device associated with this spectrometer object.
int get_integration_time(self)
Returns the current integration time on the device.
tuple[int, float] get_index_at_wavelength(self, float wavelength)
Given an approximate wavelength, finds the closest wavelength and returns the index (pixel number) of...
str get_model(self)
Read the correct spectrometer model name assigned.
int get_acquisition_delay_minimum(self)
Get the minimum allowed acquisition delay in microseconds.
list[float] nonlinearity_correct_spectrum1(self, list[float] illuminatedSpectrum)
Nonlinearity correct a previously acquired illuminated spectrum using a stored dark spectrum.
int get_number_electric_dark_pixels(self)
This returns the number of pixels that are electrically active but optically masked (a....
list[float] boxcar_correct_spectrum(self, list[float] illuminatedSpectrum, int boxcarWidth)
Apply a boxcar correction on the given illuminated spectrum.
None set_electric_dark_correction_usage(self, bool isEnabled)
Enable or disable an electric dark correction.
None set_integration_time(self, int int_time)
Sets the integration time on the device.
list[float] get_formatted_spectrum(self)
Return a formatted spectrum.
int get_acquisition_delay_maximum(self)
Get the maximum allowed acquisition delay in microseconds.
list[float] get_stored_dark_spectrum(self)
Retrieve a previously stored dark spectrum for use in subsequent corrections i.e.
bool is_feature_id_enabled(self, FeatureID featureID)
Check if the given feature ID is supported by the device or not.
None details(self)
Prints the defined set of details about the device.
list[float] get_wavelengths(self)
This computes the wavelengths for the spectrometer and fills in the provided array (up to the given l...
list[float] dark_correct_spectrum1(self, list[float] illuminatedSpectrum)
Dark correct a previously acquired illuminated spectrum and using a stored dark spectrum.
int get_minimum_averaging_integration_time(self)
This function returns the smallest integration time setting, in microseconds, that is valid for the s...
int get_integration_time_increment(self)
Returns the integration time increment on the device.
tuple[list[int], list[float]] get_indices_at_wavelengths(self, list[float] wavelengths)
Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices (pixel...
int get_max_intensity(self)
Returns the maximum pixel value the detector can read.
None set_scans_to_average(self, int newScanToAverage)
Sets the number of spectra to average.
list[float] get_nonlinearity_corrected_spectrum1(self, list[float] darkSpectrum)
Acquire a spectrum and use the supplied dark spectrum to perform a dark correction followed by the no...
str decode_error(self, int errno, str caller)
Decodes the error string returned from device calls.
list[float] get_dark_corrected_spectrum2(self)
Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction then retu...
list[float] dark_correct_spectrum2(self, list[float] darkSpectrum, list[float] illuminatedSpectrum)
Dark correct a previously acquired illuminated spectrum and using a previously acquired dark spectrum...
bool get_nonlinearity_correction_usage(self)
Return nonlinearity correction usage.
int get_scans_to_average(self)
Gets the number of spectra to average.
def __init__(self, int dev_id, oceandirect)
None set_stored_dark_spectrum(self, list[float] darkSpectrum)
Store a dark spectrum for use in subsequent corrections i.e.
tuple[list[int], list[float]] get_indices_at_wavelength_range(self, float lo, float hi, int length)
Given a list of approximate wavelengths, finds the closest wavelengths and returns the indices (pixel...
None set_trigger_mode(self, int mode)
Set the device trigger mode.
None set_nonlinearity_correction_usage(self, bool isEnabled)
Enable or disable nonlinearity correction.
int get_device_type(self)
Read the device type.
None use_nonlinearity(self, bool nonlinearity_flag)
Determine if nonlinearity correction should be used in calculations.
int get_maximum_integration_time(self)
Returns the maximum allowable integration time on the device.
list[int] get_electric_dark_pixel_indices(self)
This returns array (up to the given length) with the indices of the pixels that are electrically acti...
None set_boxcar_width(self, int newBoxcarWidth)
Sets the boxcar width to average the spectral data.
None set_acquisition_delay(self, int delayMicrosecond)
Set the acquisition delay in microseconds.
int get_acquisition_delay_increment(self)
Get the allowed step size for the acquisition delay in microseconds.
int get_formatted_spectrum_length(self)
Return the formatted spectra length.
str get_serial_number(self)
Read the device serial number.
None close_device(self)
Detaches the device to free it up for other users.
int get_boxcar_width(self)
Read the current boxcar width setting.
None get_trigger_mode(self)
Returns the current trigger mode from the device.
list[float] get_nonlinearity_corrected_spectrum2(self)
Acquire a spectrum and use the previously stored dark spectrum to perform a dark correction followed ...
bool get_electric_dark_correction_usage(self)
Return electric dark correction usage.
int get_minimum_integration_time(self)
Returns the minimum allowable integration time on the device.
list[float] get_dark_corrected_spectrum1(self, list[float] darkSpectrum)
Acquire a spectrum and use the supplied dark spectrum to perform a dark correction then return the da...