PythonOceanDirect
2.4.0
OceanDirect Python API
|
Classes | |
class | __OceanDirectSingleton |
Public Member Functions | |
def | __init__ (self) |
def | __getattr__ (self, name) |
str | decode_error (self, int errno, str caller) |
tuple[int, int, int] | get_api_version_numbers (self) |
Return OceanDirect api version information. More... | |
'Spectrometer' | open_device (self, int device_id) |
Attach to a device discovered by probe_devices or get_device_ids. More... | |
'Spectrometer' | get_device (self, int device_id) |
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() function. More... | |
None | close_device (self, int device_id) |
Detach from the device indicated by device_id. More... | |
None | list_all_devices (self) |
Lists defined details of all active devices. More... | |
None | shutdown (self) |
Closes the connection to OceanDirectAPI. More... | |
int | find_devices (self) |
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers, finding devices that respond to UDP multicast (FX and HDX), and also returning IDs for any TCP-enabled devices that have been manually specified using addTCPDeviceLocation(). More... | |
int | find_usb_devices (self) |
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers. More... | |
int | add_network_device (self, str ipAddress, str deviceType) |
Manually create an instance of the network attached device and then open it using the openDevice() function. More... | |
int | get_number_devices (self) |
Returns the number of devices available. More... | |
list[int] | get_device_ids (self) |
Return a list of device ids from devices that were both probe or manually added. More... | |
list[int] | get_network_device_ids (self) |
Return a list of network device ids from devices that were probe. More... | |
'Spectrometer' | from_serial_number (self, str serial_num) |
Return a spectrometer object associated with device id. More... | |
None | add_rs232_device (self, str device_type, str bus_path, int baud) |
Adds a device connected via RS 232 to the device list. More... | |
str | get_serial_number (self, int dev_id) |
Gets the serial number of a specified device. More... | |
Public Attributes | |
tcpip_devices | |
usb_devices | |
num_devices | |
device_ids | |
Static Public Attributes | |
instance | |
Definition at line 29 of file OceanDirectAPI.py.
def Python.oceandirect.OceanDirectAPI.OceanDirectAPI.__init__ | ( | self | ) |
Loads and initializes the OceanDirect dll and initializes internal variables.
Definition at line 66 of file OceanDirectAPI.py.
def Python.oceandirect.OceanDirectAPI.OceanDirectAPI.__getattr__ | ( | self, | |
name | |||
) |
Definition at line 74 of file OceanDirectAPI.py.
int Python.oceandirect.OceanDirectAPI.OceanDirectAPI.add_network_device | ( | self, | |
str | ipAddress, | ||
str | deviceType | ||
) |
Manually create an instance of the network attached device and then open it using the openDevice() function.
It is the responsiblitiy of the user to ensure that the device exist and configured properly. Note that this should only be done by one thread at a time.
[in] | ipAddress | The ip address as string (ex: "10.20.30.100" ) of the device to be opened. |
[in] | deviceType | The device type could be OceanFX or OceanHDX. This is case sensitive. |
Definition at line 238 of file OceanDirectAPI.py.
None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.add_network_device | ( | self, | |
str | ipAddressStr, | ||
str | deviceTypeStr | ||
) |
Manually create an instance of the network attached device and then open it using the openDevice() function.
It is the responsiblitiy of the user to ensure that the device exist and configured properly. Note that this should only be done by one thread at a time. For multithreaded application this function must be synchronized.
[in] | ipAddressStr | The ip address of the device to be opened. |
[in] | deviceTypeStr | The device type could be OceanFX or OceanHDX. This is case sensitive. |
Definition at line 140 of file OceanDirectAPI.py.
None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.add_rs232_device | ( | self, | |
str | device_type, | ||
str | bus_path, | ||
int | baud | ||
) |
Adds a device connected via RS 232 to the device list.
Untested.
[in] | device_type | The name of a type of device. This can be one of the following: QE-PRO, STS. |
[in] | bus_path | The location of the device on the RS232 bus. This will be a platform-specific location. Under Windows, this may be COM1, COM2, etc. Under Linux, this might be /dev/ttyS0, /dev/ttyS1, |
[in] | baud | The baud rate. See device manual for supported baud rate. |
Definition at line 355 of file OceanDirectAPI.py.
None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.close_device | ( | self, | |
int | device_id | ||
) |
Detach from the device indicated by device_id.
This persists the device for later use. The device_id becomes invalid after closing the device. Note that this should only be done by one thread at a time. For multithreaded application this function must be synchronized.
[in] | device_id | The id of the device to be closed. |
Definition at line 161 of file OceanDirectAPI.py.
str Python.oceandirect.OceanDirectAPI.OceanDirectAPI.decode_error | ( | self, | |
int | errno, | ||
str | caller | ||
) |
OceanDirectAPI returns an error code if something goes wrong. This function will decode that error to a readable string. @param errno: The error code generated by OceanDirect api. :type errno: int @param caller: The caller which produces the error code. Use for debugging purposes only. :type caller: str
Definition at line 77 of file OceanDirectAPI.py.
int Python.oceandirect.OceanDirectAPI.OceanDirectAPI.find_devices | ( | self | ) |
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers, finding devices that respond to UDP multicast (FX and HDX), and also returning IDs for any TCP-enabled devices that have been manually specified using addTCPDeviceLocation().
Note that this should only be done by one thread at a time. For multithreaded application this function must be synchronized.
Definition at line 187 of file OceanDirectAPI.py.
int Python.oceandirect.OceanDirectAPI.OceanDirectAPI.find_usb_devices | ( | self | ) |
Finds all available Ocean devices by scanning on USB for devices with Ocean drivers.
Note that this should only be done by one thread at a time. For multithreaded application this function must be synchronized.
Definition at line 221 of file OceanDirectAPI.py.
'Spectrometer' Python.oceandirect.OceanDirectAPI.OceanDirectAPI.from_serial_number | ( | self, | |
str | serial_num | ||
) |
Return a spectrometer object associated with device id.
User should not call this function. This function is used internally in OceanDirect.
[in] | serial_num | The device serial number. |
Definition at line 333 of file OceanDirectAPI.py.
tuple[int, int, int] Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_api_version_numbers | ( | self | ) |
Return OceanDirect api version information.
Definition at line 96 of file OceanDirectAPI.py.
'Spectrometer' Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_device | ( | self, | |
int | device_id | ||
) |
Definition at line 134 of file OceanDirectAPI.py.
list[int] Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_device_ids | ( | self | ) |
Return a list of device ids from devices that were both probe or manually added.
Note that this should only be done by one thread at a time. For multithreaded application this function must be synchronized.
Definition at line 286 of file OceanDirectAPI.py.
list[int] Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_network_device_ids | ( | self | ) |
Return a list of network device ids from devices that were probe.
Note that this should only be done by one thread at a time. For multithreaded application this function must be synchronized.
Definition at line 310 of file OceanDirectAPI.py.
int Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_number_devices | ( | self | ) |
Returns the number of devices available.
Note that this should only be done by one thread at a time.
Definition at line 270 of file OceanDirectAPI.py.
str Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_serial_number | ( | self, | |
int | dev_id | ||
) |
Gets the serial number of a specified device.
This is used internally to find the desired device.
[in] | dev_id | The id of a device. |
Definition at line 374 of file OceanDirectAPI.py.
None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.list_all_devices | ( | self | ) |
Lists defined details of all active devices.
Definition at line 174 of file OceanDirectAPI.py.
'Spectrometer' Python.oceandirect.OceanDirectAPI.OceanDirectAPI.open_device | ( | self, | |
int | device_id | ||
) |
Attach to a device discovered by probe_devices or get_device_ids.
It also saves it to a map keyed off of the device id. After the device is closed the device_id becomes invalid. You need to call either find_devices()/find_usb_devices()/add_network_device() and get_device_ids() in order to have a valid id before reopening the device again. For a network connected device this function may return an error code if the device is not yet ready to accept incoming connection or the device is unreachable. Note that this should only be done by one thread at a time. For multithreaded application this function must be synchronized.
[in] | device_id | The device id. |
Definition at line 111 of file OceanDirectAPI.py.
None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.shutdown | ( | self | ) |
Closes the connection to OceanDirectAPI.
This is the last to be called before the program terminates.
Definition at line 181 of file OceanDirectAPI.py.
Python.oceandirect.OceanDirectAPI.OceanDirectAPI.device_ids |
Definition at line 301 of file OceanDirectAPI.py.
|
static |
Definition at line 64 of file OceanDirectAPI.py.
Python.oceandirect.OceanDirectAPI.OceanDirectAPI.num_devices |
Definition at line 278 of file OceanDirectAPI.py.
Python.oceandirect.OceanDirectAPI.OceanDirectAPI.tcpip_devices |
Definition at line 198 of file OceanDirectAPI.py.
Python.oceandirect.OceanDirectAPI.OceanDirectAPI.usb_devices |
Definition at line 205 of file OceanDirectAPI.py.