OceanDirectPython  3.1.1
OceanDirect Python API
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Python.oceandirect.OceanDirectAPI.OceanDirectAPI Class Reference

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...
 
None set_multicast_msg_send_retry (self, int retryCount)
 Set the number of times to send multicast message for dynamic probing. More...
 
None set_multicast_msg_response_read_delay (self, int delayMs)
 Set the delay between reading multicast response. More...
 
None set_multicast_msg_response_read_retry (self, int retryCount)
 Set the number of times to read multicast message response. More...
 
'Spectrometeropen_device (self, int device_id)
 Attach to a device discovered by probe_devices or get_device_ids. More...
 
'Spectrometerget_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...
 
'Spectrometerfrom_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
 

Detailed Description

Definition at line 29 of file OceanDirectAPI.py.

Constructor & Destructor Documentation

◆ __init__()

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.

Member Function Documentation

◆ __getattr__()

def Python.oceandirect.OceanDirectAPI.OceanDirectAPI.__getattr__ (   self,
  name 
)

Definition at line 74 of file OceanDirectAPI.py.

◆ add_network_device() [1/2]

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.

Parameters
ipAddressThe ip address as string (ex: "10.20.30.100" ) of the device to be opened.
deviceTypeThe device type could be OceanFX or OceanHDX. This is case sensitive.
Returns
The device id.
See also
open_device()

Definition at line 260 of file OceanDirectAPI.py.

◆ add_network_device() [2/2]

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.

Parameters
ipAddressStrThe ip address of the device to be opened.
deviceTypeStrThe device type could be OceanFX or OceanHDX. This is case sensitive.

Definition at line 164 of file OceanDirectAPI.py.

◆ add_rs232_device()

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.

Parameters
device_typeThe name of a type of device. This can be one of the following: QE-PRO, STS.
bus_pathThe 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,
baudThe baud rate. See device manual for supported baud rate.

Definition at line 367 of file OceanDirectAPI.py.

◆ close_device()

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.

Parameters
device_idThe id of the device to be closed.
See also
open_device()

Definition at line 184 of file OceanDirectAPI.py.

◆ decode_error()

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.

◆ find_devices()

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.

See also
find_usb_devices()
open_device()
Returns
Number of devices found.

Definition at line 209 of file OceanDirectAPI.py.

◆ find_usb_devices()

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.

See also
find_devices()
open_device()
Returns
Number of devices found.

Definition at line 243 of file OceanDirectAPI.py.

◆ from_serial_number()

'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.

Parameters
serial_numThe device serial number.
Returns
The spectrometer object if found, None otherwise.

Definition at line 346 of file OceanDirectAPI.py.

◆ get_api_version_numbers()

tuple[int, int, int] Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_api_version_numbers (   self)

Return OceanDirect api version information.

Returns
An integer tuple of major, minor, and point value.

Definition at line 95 of file OceanDirectAPI.py.

◆ get_device()

'Spectrometer' Python.oceandirect.OceanDirectAPI.OceanDirectAPI.get_device (   self,
int  device_id 
)

Definition at line 158 of file OceanDirectAPI.py.

◆ get_device_ids()

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.

Returns
List of device id's.

Definition at line 305 of file OceanDirectAPI.py.

◆ get_network_device_ids()

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.

Returns
List of network device id's.

Definition at line 327 of file OceanDirectAPI.py.

◆ get_number_devices()

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.

Returns
The number of connected(discovered) devices.

Definition at line 291 of file OceanDirectAPI.py.

◆ get_serial_number()

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.

Parameters
dev_idThe id of a device.
Returns
The device serial number if found, None otherwise.

Definition at line 385 of file OceanDirectAPI.py.

◆ list_all_devices()

None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.list_all_devices (   self)

Lists defined details of all active devices.

Definition at line 196 of file OceanDirectAPI.py.

◆ open_device()

'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.

Parameters
device_idThe device id.
Returns
The device object.
See also
find_devices()
find_usb_devices()
add_network_device()

Definition at line 135 of file OceanDirectAPI.py.

◆ set_multicast_msg_response_read_delay()

None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.set_multicast_msg_response_read_delay (   self,
int  delayMs 
)

Set the delay between reading multicast response.

This must be called before probing network devices.

See also
find_devices()
Parameters
delayMsThe delay in milliseconds before next read.

Definition at line 117 of file OceanDirectAPI.py.

◆ set_multicast_msg_response_read_retry()

None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.set_multicast_msg_response_read_retry (   self,
int  retryCount 
)

Set the number of times to read multicast message response.

This must be called before probing network devices.

See also
find_devices()
Parameters
retryCountThe number of times to try reading multicast response messages.

Definition at line 126 of file OceanDirectAPI.py.

◆ set_multicast_msg_send_retry()

None Python.oceandirect.OceanDirectAPI.OceanDirectAPI.set_multicast_msg_send_retry (   self,
int  retryCount 
)

Set the number of times to send multicast message for dynamic probing.

This must be called before probing network devices.

See also
find_devices()
Parameters
retryCountThe number of times to send messages.

Definition at line 108 of file OceanDirectAPI.py.

◆ shutdown()

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 203 of file OceanDirectAPI.py.

Member Data Documentation

◆ device_ids

Python.oceandirect.OceanDirectAPI.OceanDirectAPI.device_ids

Definition at line 319 of file OceanDirectAPI.py.

◆ instance

Python.oceandirect.OceanDirectAPI.OceanDirectAPI.instance
static

Definition at line 64 of file OceanDirectAPI.py.

◆ num_devices

Python.oceandirect.OceanDirectAPI.OceanDirectAPI.num_devices

Definition at line 298 of file OceanDirectAPI.py.

◆ tcpip_devices

Python.oceandirect.OceanDirectAPI.OceanDirectAPI.tcpip_devices

Definition at line 220 of file OceanDirectAPI.py.

◆ usb_devices

Python.oceandirect.OceanDirectAPI.OceanDirectAPI.usb_devices

Definition at line 227 of file OceanDirectAPI.py.