Unit OP510MDLL

Uses
Classes, Interfaces, Objects and Records
Variables

Description

OP508/OP510 DLL Functions

Overview

Functions and Procedures

function OP510_CloseDriver: integer; stdcall;
function OP510_GetDLLRev: integer; stdcall;
function OP510_GetDLLStatus: integer; stdcall;
function OP510_GetFWRevision: integer; stdcall;
function OP510_GetModuleID(var id: integer): integer; stdcall;
function OP510_GetTemperature(var tempC: real; units: integer): integer; stdcall;
function OP510_GetUSBDeviceCount(var deviceCount: integer): integer; stdcall;
function OP510_GetUSBDeviceDescription(deviceNumber: integer; var deviceDescription: pansichar): integer; stdcall;
function OP510_GetUSBSerialNumber(deviceNumber: integer; var serialNumber: pansichar): integer; stdcall;
function OP510_GetUSBStatus(var haveError: boolean):integer; stdcall;
function OP510_GetWavelength(var wavelength: integer; var wIndex: integer; var count: integer): integer; stdcall;
function OP510_NextWavelength(var wavelength: integer; var wIndex: integer; var count: integer): integer; stdcall;
function OP510_OpenDriver(USBhandle: TFT_HANDLE): integer; stdcall;
function OP510_OpenUSBDevice(deviceNumber: integer; var handle: TFT_HANDLE):integer; stdcall;
function OP510_ReadAnalog(var analog:integer; var gain: integer; var mode: integer): integer; stdcall;
function OP510_ReadLoss(var loss: real): integer; stdcall;
function OP510_ReadPower(var power: real): integer; stdcall;
function OP510_ReferencePower(var refPower: real): integer; stdcall;
function OP510_SelectModule(module: integer): integer; stdcall;
function OP510_SetAbsolute(): integer stdcall;
function OP510_SetAutoRange(state: integer): integer; stdcall;
function OP510_SetGain(gain: integer): integer; stdcall;
function OP510_SetReference(): integer; stdcall;
function OP510_SetWavelength(wavelength: integer): integer; stdcall;

Types

TFT_HANDLE = Uint32;
TFT_HANDLE_PTR = PUint32;

Constants

DLL_REVISION=105;

Description

Functions and Procedures

function OP510_CloseDriver: integer; stdcall;

Close the driver, closing the connection and communication with the device. Device must be reinitialized after calling this.

This requires driver initialization with OP510_OpenDriver.

Returns

1: OK, -1: fail

function OP510_GetDLLRev: integer; stdcall;

Get the revision number of DLL

Returns

revision number

function OP510_GetDLLStatus: integer; stdcall;

Get the initialization status of the DLL and USB device

Returns

1: OK, -5: no USB device found, -4: communication error, -3: USB Read Error, -2: USB Write Error

function OP510_GetFWRevision: integer; stdcall;

Get the device's firmware revision

Returns

firmware revision number

function OP510_GetModuleID(var id: integer): integer; stdcall;

Get the Module ID (internal product code) of the device.

This requires driver initialization with OpenDriver.

Module IDs

  • 10 – OP250

  • 11 – OP510

  • 12 – OP710

  • 13 – OP831

  • 14 – OP930

  • 15 – OP750

  • 16 – OP815

  • 17 – OP1100

  • 18 – OP1021

  • 19 – OP1302

  • 20 – OP815D

  • 21 – OP720

  • 22 – OP850

  • 23 – OP280

  • 24 – OP715

  • 25 – OP712

  • 26 – OP931

  • 27 – OP931-FTTX

  • 28 – OP480

Parameters
id:
Module ID (by ref)
function OP510_GetTemperature(var tempC: real; units: integer): integer; stdcall;

Get the temperature in the specified units.

This requires driver initialization with OP510_OpenDriver.

Parameters
tempC:
temperature value (by ref)
units:

  • 0 – raw digital value

  • 1 – Celsius

  • 2 – Fahrenheit

Returns

1: OK, -1: fail

function OP510_GetUSBDeviceCount(var deviceCount: integer): integer; stdcall;

Get the number of connected compatible USB devices.

Parameters
devCount:
USB device count (by ref)
Returns

1: OK, -1: fail

function OP510_GetUSBDeviceDescription(deviceNumber: integer; var deviceDescription: pansichar): integer; stdcall;

Get the USB Device Description (up to 16 characters) of the specified device. Caller must allocate memory for deviceDescription buffer (16 characters + 1 null-terminator)

Parameters
deviceNumber:
the USB device number
deviceDescription:
a pointer to a null-terminated character array (by ref)
Returns

1: OK, -1: fail

function OP510_GetUSBSerialNumber(deviceNumber: integer; var serialNumber: pansichar): integer; stdcall;

Get the USB Device Serial Number (8 characters) of the specified device. Caller must allocate memory for serialNumber buffer (8 characters + 1 null-terminator)

Parameters
deviceNumber:
the USB device number
serialNumber:
a pointer to a null-terminated character array (by ref)
Returns

1: OK, -1: fail

function OP510_GetUSBStatus(var haveError: boolean):integer; stdcall;

Get the USB error flag of last operation as well as the error code.

Parameters
haveError:
error flag (by ref)
Returns

0: OK, 1: invalid handle, 2: device not found, 3: device not opened, 4: IO error

function OP510_GetWavelength(var wavelength: integer; var wIndex: integer; var count: integer): integer; stdcall;

Get the active channel's current wavelength information.

This requires driver initialization with OP510_OpenDriver.

Parameters
wavelength:
wavelength value in nanometers (by ref)
wIndex:
the index in the list of wavelengths (by ref)
count:
the number of available wavelengths (by ref)
Returns

1: OK, -1: fail

function OP510_NextWavelength(var wavelength: integer; var wIndex: integer; var count: integer): integer; stdcall;

Set wavelenght to the next one the active channel's list of available measurement wavelength.

This requires driver initialization with OP510_OpenDriver.

Parameters
wavelength:
wavelength value in nanometers (by ref)
wIndex:
the index in the list of wavelengths (by ref)
count:
the number of available wavelengths (by ref)
Returns

1: OK, -1: fail

function OP510_OpenDriver(USBhandle: TFT_HANDLE): integer; stdcall;

Initialize the device with the given USB Handle.

Parameters
USBHandle:
USB Handle for the device. Optionally, 0 can be used as a shortcut to open the first USB device detected.
Returns

1: OK, -5: no USB device found, -4: communication error, -3: USB Read Error, -2: USB Write Error

function OP510_OpenUSBDevice(deviceNumber: integer; var handle: TFT_HANDLE):integer; stdcall;

Open the specified USB device and get a USB Handle. The device is specified by USB Device Number. The USB Handle is used with OP510_OpenDriver.

Parameters
deviceNumber:
USB device number
handle:
USB Handle (by ref)
Returns

1: OK, -1: open device failed

function OP510_ReadAnalog(var analog:integer; var gain: integer; var mode: integer): integer; stdcall;

Read raw ADC values for current active OPM channel.

This requires driver initialization with OP510_OpenDriver.

Parameters
analog:
raw analog-to-digital converter value (by ref)
gain:
raw gain value (by ref)
mode:
power measurement mode (by ref)
Returns

1: OK, -1: fail

function OP510_ReadLoss(var loss: real): integer; stdcall;

Read power loss from active channel. Must use SetReference or ReferencePower to perform a reference beforehand.

This requires driver initialization with OP510_OpenDriver.

Parameters
loss:
power loss measurement (by ref)
Returns

1: OK, -1: fail

function OP510_ReadPower(var power: real): integer; stdcall;

Read power from active channel.

This requires driver initialization with OP510_OpenDriver.

Parameters
power:
power measurement (by ref)
Returns

1: OK, -1: fail

function OP510_ReferencePower(var refPower: real): integer; stdcall;

Perform internal power reference for active OPM channel.

This requires driver initialization with OP510_OpenDriver.

Parameters
refPower:
reference power in dBm (by ref)
Returns

1: OK, -1: fail

function OP510_SelectModule(module: integer): integer; stdcall;

Select the specified module. All subsequent USB commands will be directed to the seleted module. The module number corresponds to the device number.

Parameters
module:
module number
Returns

1: module has been initialized, 0: module has not been initialized

function OP510_SetAbsolute(): integer stdcall;

Set active channel to absolute (dBm) measurement mode.

This requires driver initialization with OP510_OpenDriver.

Returns

1: OK, -1: fail

function OP510_SetAutoRange(state: integer): integer; stdcall;

Set the Auto-Range on or off (Range-Hold).

This requires driver initialization with OP510_OpenDriver.

Parameters
state:
0: Auto-Range OFF (Range-Hold), 1: Auto-Range ON
Returns

1: OK, -1: fail

function OP510_SetGain(gain: integer): integer; stdcall;

Set the current gain (must have Auto-Range set to off).

This requires driver initialization with OP510_OpenDriver.

Parameters
gain:
gain value from 0 to 7
Returns

1: OK, -1: fail

function OP510_SetReference(): integer; stdcall;

Perform internal power reference then set active channel to relative (dB) measurement mode.

This requires driver initialization with OP510_OpenDriver.

Returns

1: OK, -1: fail

function OP510_SetWavelength(wavelength: integer): integer; stdcall;

Set the active channel's measurement wavelength. This will attempt to find the closest match from the internally defined list of discrete wavelengths.

This requires driver initialization with OP510_OpenDriver.

Parameters
wavelength:
wavelength value in nanometers
Returns

1: OK, -1: fail

Types

TFT_HANDLE = Uint32;

USB Handle Type. (Use Uint64 (64-bit unsigned int) for 64-bit version)

TFT_HANDLE_PTR = PUint32;

USB Handle Pointer Type. (Use PUint64 (64-bit unsigned integer pointer) for 64-bit version)

Constants

DLL_REVISION=105;
 

Generated by PasDoc 0.15.0.