Module LB2_Declarations

    Const ADDRESS_MIN = 1
    Const ADDRESS_MAX = 255

    Public DFLT_MIN_FREQ As Double = 10000000.0#
    Public DFLT_MAX_FREQ As Double = 10000000000.0#

    Public Const MIN_FREQ_LB559A = 10000000.0
    Public Const MAX_FREQ_LB559A = 12500000000.0
    Public Const MIN_FREQ_LB579A = 10000000.0
    Public Const MAX_FREQ_LB579A = 18000000000.0
    Public Const MIN_FREQ_LB589A = 10000000.0
    Public Const MAX_FREQ_LB589A = 26500000000.0
    Public Const DEFAULT_MIN_FREQ As Double = 10000000.0#
    Public Const DEFAULT_MAX_FREQ As Double = 10000000000.0#

    Const MIN_AVERAGES As Integer = 1
    Const MAX_AVERAGES As Integer = 100000
    Const MAX_PK_PLS_CRIT As Double = 200.0#
    Const MIN_PK_PLS_CRIT As Double = 0.001
    Const MAX_OFFSET As Double = 200.0#
    Const MIN_OFFSET As Double = -200.0#

    Const FIRST_REG_INDEX As Integer = 0
    Const LAST_REG_INDEX As Integer = 19
    Const NUM_SAVE_RECALL_STATES As Integer = 20

    Const MAX_NUMBER_OF_SENSORS As Integer = 8
    Public Const MAX_NUM_RESP_PTS As Integer = 201
    Public Const DEFAULT_TRIG_TIMEOUT As Integer = 3000
    Public Const MAX_TRIGGER_TIMEOUE As Integer = 30000
    Public Const DEFAULT_FREQ As Double = 1000000000.0#
    Public Const DEFAULT_AVERAGES As Integer = 75
    Public Const DEFAULT_PULSE_CRIT As Double = 3.0#
    Public Const DEFAULT_RCDR_1V_LEVEL As Double = 10.0#
    Public Const DEFAULT_RCDR_0V_LEVEL As Double = -20.0#
    Public Const MIN_DC_PER_CENT As Double = 0.001
    Public Const MAX_DC_PER_CENT As Double = 100.0#
    Public Const MIN_DC_DECIMAL As Double = 0.00001
    Public Const MAX_DC_DECIMAL As Double = 1.0#

    Public Enum MODEL_NUMBER    ' Enumeration of model numbers
        LBUknwn = -1
        LB4xxA = 0
        LB478A = 1
        LB479A = 2
        LB480A = 3
        LB559A = 4
        LB579A = 5
        LB589A = 6
    End Enum

    Public Enum PWR_UNITS
        DBM = 0                 ' dBm
        DBW = 1                 ' dBW
        DBKW = 2                ' dBkW
        DBUV = 3                ' dBuV
        DBMV = 4                ' dBmV
        DBV = 5                 ' dBV
        W = 6                   ' Watts
        V = 7                   ' Volts
        DBREL = 8               ' dB Relative
    End Enum

    Public Enum FEATURE_STATE
        ST_OFF = 0              'disable or turn the feature off
        ST_ON = 1               'enable or turn the feature on
    End Enum

    Public Enum LIMIT_STYLE
        LIMITS_OFF = 0          'disable limits
        SINGLE_SIDED = 1        'use single sided limits in pass/fail evaluation
        DOUBLE_SIDED = 2        'use double sided limits in pass/fail evaluation
    End Enum

    Public Enum SS_RULE
        PASS_LT = 0             ' Pass if measured value less than
        PASS_LTE = 1            ' Pass if measured value less than or equal
        PASS_GT = 2             ' Pass if measured value greater than
        PASS_GTE = 3            ' Pass if measured value greater than or equal
    End Enum

    Public Enum DS_RULE
        PASS_BETWEEN_EXC = 0    ' Pass if measured value is greater than the lower limit and less than the upper limit
        PASS_BETWEEN_INC = 1    ' Pass if measured value is equal to or greater than the lower limit and equal to or less than the upper limit
        PASS_OUTSIDE_EXC = 2    ' Pass if measured value is less than the lower limit OR greater than the upper limit
        PASS_OUTSIDE_INC = 3    ' Pass if measured value is equal to or greater than the upper limit OR equal to or less than the lower limit
    End Enum

    Public Enum PASS_FAIL_RESULT
        PASS = 0                    ' pass measured value within limits
        FAIL_LOW = 1                ' failed measured value too low
        FAIL_HIGH = 2               ' failed measured value too high
        FAIL_BETWEEN_LIMIT_EXC = 3  ' failed between limits
        FAIL_BETWEEN_LIMIT_INC = 4  ' failed between limits
        NO_DETERMINATION = 5        ' no determination made possible reasons include but are
    End Enum

    Public Enum SVC_WTY_OPTS
        NO_SVC_WTY_OPT = 0          'no service options
        CW03 = 1                    'calibration and warranty repair service option
        C03 = 2                     'calibration service option
        W03 = 3                     'warranty repair service option
    End Enum

    Public Enum CONN_TYPES
        NOT_SET = 0                 '
        SMA_F = 1                   'SMA female
        SMA_M = 2                   'SMA male
        TNC_F = 3                   'TNC female
        TNC_M = 4                   'TNC male
        N_TYPE_F = 5                'N-Type female
        N_TYPE_M = 6                'N-Type male
    End Enum

    Public Enum HDWE_OPT_VAL        'Used for recorder out, trigger in/out, filters and best match hardware options
        OPT_OFF = 0
        OPT_ON = 1
    End Enum

    Public Enum AVG_MODE
        AVG_OFF = 0
        AVG_AUTO_RESET = 1
        AVG_MANUAL_RESET = 2
    End Enum

    Public Enum MARKER_MODE
        MKR_OFF = 0
        NORMAL_MKR = 1
        DELTA_MKR = 2
    End Enum

    Public Enum GATE_MODE
        GATE_OFF = 0
        GATE_ON = 1
    End Enum

    Public Enum TRIGGER_EDGE
        POSITIVE = 0
        NEGATIVE = 1
    End Enum

    Public Enum TRIGGER_OUT_MODE
        TRG_OUT_DISABLED = 0
        TRG_OUT_ENABLED_NON_INV = 1
        TRG_OUT_ENABLED_INV = 2
    End Enum

    Public Enum TRIGGER_SOURCE
        INT_AUTO_LEVEL = 0
        INTERNAL = 1
        EXTERNAL = 2
    End Enum

    Public Enum SWEEP_TIME
        INVALID_SWP_TIME = -1   'invalid sweep time
        ST_10 = 0               '10 USEC
        ST_20 = 1               '20 USEC
        ST_50 = 2               '50 USEC

        ST_100 = 3              '100 USEC
        ST_200 = 4              '200 USEC
        ST_500 = 5              '500 USEC

        ST_1000 = 6             '1000 USEC OR 1 MSEC
        ST_2000 = 7             '2000 USEC OR 2 MSEC
        ST_5000 = 8             '5000 USEC OR 5 MSEC

        ST_10000 = 9            '10000 USEC OR 10 MSEC
        ST_20000 = 10           '20000 USEC OR 20 MSEC
        ST_50000 = 11           '50000 USEC RO 50 MSEC

        ST_100000 = 12          '100000 USEC OR 100 MSEC
        ST_200000 = 13          '200000 USEC OR 200 MSEC
        ST_500000 = 14          '500000 USEC OR 500 MSEC

        ST_1000000 = 15         '1000000 USEC OR 1000 MSEC OR 1 SEC
    End Enum

    Public Enum FLT_POLES
        ONE_POLE = 0
        TWO_POLES = 1
        FOUR_POLES = 2
    End Enum

    Public Enum FLT_CO_FREQ
        FLT_UNK = -1            'filter unknown
        FLT_DIS = 0             'filters disabled
        FLT_100K = 1            '100KHz
        FLT_200K = 2            '200KHz
        FLT_300K = 3            '300KHz
        FLT_500K = 4            '500KHz
        FLT_1M = 5              '1MHz
        FLT_2M = 6              '2MHz
        FLT_3M = 7              '3MHz
        FLT_5M = 8              '5MHz
        FLT_MAX = 9             '>=10MHz
    End Enum

    Public Structure SensorDescription_NET
        Dim DeviceIndex As Integer
        Dim DeviceAddress As Integer
        Dim SerialNumber As String
    End Structure

    Public Structure SDByte
        Dim DeviceIndex As Integer
        Dim DeviceAddress As Integer
        Dim SNByte0, _
            SNByte1, _
            SNByte2, _
            SNByte3, _
            SNByte4, _
            SNByte5, _
            SNByte6 As Byte
        Public Function SN() As String
            Return Chr(SNByte0) & Chr(SNByte1) & Chr(SNByte2) & Chr(SNByte3) & Chr(SNByte4) & Chr(SNByte5)
        End Function
    End Structure

    Public Structure SensorDescrption
        Dim DeviceIndex As Integer
        Dim DeviceAddress As Integer
        Dim SerialNumber As String
    End Structure

    Public Structure ResponsePoints
        Dim Frequency As Double
        Dim Amplitude As Double
    End Structure

    Public Structure Peak
        Dim trIdx As Integer        'index where peak was found
        Dim value As Double         'value of peak
    End Structure

    Public validDeviceSelected As Boolean = False
    Public currDev As SensorDescription_NET

    '==============================
    'GENERAL QUERIES
    '------------------------------
    Public Declare Function LB_DriverVersion Lib "LB_API2.dll" () As Integer
    Public Declare Function LB_GetFirmwareVersion Lib "LB_API2.dll" (ByVal addr As Integer, ByRef ba As Byte, ByVal strLen As Integer) As Integer
    Public Declare Function LB_SensorCnt Lib "LB_API2.dll" () As Integer
    Public Declare Function LB_SensorList Lib "LB_API2.dll" (ByRef sd As SDByte, ByVal cnt As Integer) As Integer
    '==============================
    'SET/GET ADDRESS                                                                   )
    '------------------------------
    Public Declare Function LB_GetAddress_SN Lib "LB_API2.dll" (ByVal sn As String) As Integer
    Public Declare Function LB_GetAddress_Idx Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    Public Declare Function LB_SetAddress_SN Lib "LB_API2.dll" (ByVal sn As String, ByVal addr As Integer) As Integer
    Public Declare Function LB_SetAddress_Idx Lib "LB_API2.dll" (ByVal idx As Integer, ByVal addr As Integer) As Integer
    Public Declare Function LB_ChangeAddress Lib "LB_API2.dll" (ByVal currentAddr As Integer, ByVal newAddr As Integer) As Integer

    '==============================
    'CHECKING FOR ADDRESS CONFLICTS
    '------------------------------
    Public Declare Function LB_AddressConflictExists Lib "LB_API2.dll" () As Integer
    Public Declare Function LB_WillAddressConflict Lib "LB_API2.dll" (ByVal addr As Integer) As Integer

    '==============================
    'MODEL NUMBER
    '------------------------------
    Public Declare Function LB_GetModelNumber_SN Lib "LB_API2.dll" (ByVal sn As String, ByRef modelNumber As MODEL_NUMBER) As Integer
    Public Declare Function LB_GetModelNumber_Idx Lib "LB_API2.dll" (ByVal idx As Integer, ByRef modelNumber As MODEL_NUMBER) As Integer
    Public Declare Function LB_GetModelNumber_Addr Lib "LB_API2.dll" (ByVal addr As Integer, ByRef modelNumber As MODEL_NUMBER) As Integer

    '==============================
    'USE AND PRESENCE OF SENSOR
    '------------------------------
    Public Declare Function LB_IsSensorConnected_SN Lib "LB_API2.dll" (ByVal sn As String) As Integer
    Public Declare Function LB_IsSensorConnected_Addr Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    Public Declare Function LB_IsDeviceInUse_Idx Lib "LB_API2.dll" (ByVal idx As Integer) As Integer
    Public Declare Function LB_IsDeviceInUse_Addr Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    Public Declare Function LB_IsDeviceInUse_SN Lib "LB_API2.dll" (ByVal sn As String) As Integer

    '==============================
    'SERIAL NUMBER
    '------------------------------
    Public Declare Function LB_GetSerNo_Idx Lib "LB_API2.dll" (ByVal idx As Integer, ByVal sn As String) As Integer
    Public Declare Function LB_GetSerNo_Addr Lib "LB_API2.dll" (ByVal address As Integer, ByVal sn As String) As Integer

    '==============================
    'INDEX
    '------------------------------
    Public Declare Function LB_GetIndex_SN Lib "LB_API2.dll" (ByVal sn As String) As Integer
    Public Declare Function LB_GetIndex_Addr Lib "LB_API2.dll" (ByVal addr As Integer) As Integer

    '==============================
    'BLINK LED
    '------------------------------
    Public Declare Function LB_BlinkLED_SN Lib "LB_API2.dll" (ByVal sn As String) As Integer
    Public Declare Function LB_BlinkLED_Idx Lib "LB_API2.dll" (ByVal idx As Integer) As Integer
    Public Declare Function LB_BlinkLED_Addr Lib "LB_API2.dll" (ByVal addr As Integer) As Integer

    '================================
    'INITIALIZE & UNINITIALIZE SENSOR
    '--------------------------------
    Public Declare Function LB_InitializeSensor_SN Lib "LB_API2.dll" (ByVal sn As String) As Integer
    Public Declare Function LB_UninitializeSensor_SN Lib "LB_API2.dll" (ByVal sn As String) As Integer
    Public Declare Function LB_InitializeSensor_Idx Lib "LB_API2.dll" (ByVal idx As Integer) As Integer
    Public Declare Function LB_InitializeSensor_Addr Lib "LB_API2.dll" (ByVal addr As Integer) As Integer

    '==============================
    'MEASUREMENTS
    '------------------------------
    Public Declare Function LB_MeasureCW Lib "LB_API2.dll" (ByVal addr As Integer, ByRef CW As Double) As Integer
    Public Declare Function LB_MeasurePulse Lib "LB_API2.dll" (ByVal addr As Integer, ByRef pulse As Double, ByRef peak As Double, ByRef average As Double, ByRef dutyCycle As Double) As Integer
    Public Declare Function LB_MeasureCW_PF Lib "LB_API2.dll" (ByVal addr As Integer, ByRef CW As Double, ByRef pf As PASS_FAIL_RESULT) As Integer
    Public Declare Function LB_MeasurePulse_PF _
                                Lib "LB_API2.dll" ( _
                                ByVal addr As Integer, _
                                ByRef pulse As Double, _
                                ByRef peak As Double, _
                                ByRef average As Double, _
                                ByRef dutyCycle As Double, _
                                ByRef pf As PASS_FAIL_RESULT) _
                                As Integer

    '==============================
    'FREQUENCY (FOR CORRECTION)
    '------------------------------
    Public Declare Function LB_SetFrequency Lib "LB_API2.dll" (ByVal addr As Integer, ByVal value As Double) As Integer
    Public Declare Function LB_GetFrequency Lib "LB_API2.dll" (ByVal addr As Integer, ByRef value As Double) As Integer

    '==============================
    'AVERAGING
    '------------------------------
    Public Declare Function LB_GetAverages Lib "LB_API2.dll" (ByVal addr As Integer, ByRef value As Integer) As Integer
    Public Declare Function LB_SetAverages Lib "LB_API2.dll" (ByVal addr As Integer, ByVal value As Integer) As Integer

    '==============================
    'PULSE MEAUREMENT CRITERIA
    '------------------------------
    Public Declare Function LB_SetAutoPulseEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal state As FEATURE_STATE) As Integer
    Public Declare Function LB_GetAutoPulseEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef state As FEATURE_STATE) As Integer
    Public Declare Function LB_SetPulseCriteria Lib "LB_API2.dll" (ByVal addr As Integer, ByVal val As Double) As Integer
    Public Declare Function LB_GetPulseCriteria Lib "LB_API2.dll" (ByVal addr As Integer, ByRef val As Double) As Integer

    '==============================
    'OFFSET
    '------------------------------
    Public Declare Function LB_SetOffsetEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal state As FEATURE_STATE) As Integer
    Public Declare Function LB_GetOffsetEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef state As FEATURE_STATE) As Integer
    Public Declare Function LB_SetOffset Lib "LB_API2.dll" (ByVal addr As Integer, ByVal val As Double) As Integer
    Public Declare Function LB_GetOffset Lib "LB_API2.dll" (ByVal addr As Integer, ByRef val As Double) As Integer

    Public Declare Function LB_SetResponse Lib "LB_API2.dll" (ByVal addr As Integer, ByRef pts As ResponsePoints, ByVal numPts As Integer) As Integer
    Public Declare Function LB_GetResponse Lib "LB_API2.dll" (ByVal addr As Integer, ByRef pts As ResponsePoints, ByRef numPts As Integer) As Integer
    Public Declare Function LB_SetResponseEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetResponseEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer


    '==============================
    'DUTY CYCLE
    '------------------------------
    Public Declare Function LB_SetDutyCycleEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal state As FEATURE_STATE) As Integer
    Public Declare Function LB_GetDutyCycleEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef state As FEATURE_STATE) As Integer
    Public Declare Function LB_SetDutyCyclePerCent Lib "LB_API2.dll" (ByVal addr As Integer, ByVal val As Double) As Integer
    Public Declare Function LB_GetDutyCyclePerCent Lib "LB_API2.dll" (ByVal addr As Integer, ByRef val As Double) As Integer

    '==============================
    'UNITS
    '------------------------------
    Public Declare Function LB_SetMeasurementPowerUnits Lib "LB_API2.dll" (ByVal addr As Integer, ByVal units As PWR_UNITS) As Integer
    Public Declare Function LB_GetMeasurementPowerUnits Lib "LB_API2.dll" (ByVal addr As Integer, ByRef units As PWR_UNITS) As Integer

    '==============================
    'SET/GET MEASUREMENT REFERENCES
    '------------------------------
    Public Declare Function LB_SetCWReference Lib "LB_API2.dll" (ByVal addr As Integer, ByVal Ref As Double, ByVal units As PWR_UNITS) As Integer
    Public Declare Function LB_SetPulseReference _
                                Lib "LB_API2.dll" ( _
                                ByVal addr As Integer, _
                                ByVal pulseRef As Double, _
                                ByVal peakRef As Double, _
                                ByVal averageRef As Double, _
                                ByVal dutyCycleRef As Double, _
                                ByVal units As PWR_UNITS) _
                                As Integer
    Public Declare Function LB_GetCWReference Lib "LB_API2.dll" (ByVal addr As Integer, ByRef relRef As Double, ByRef units As PWR_UNITS) As Integer
    Public Declare Function LB_GetPulseReference _
                                Lib "LB_API2.dll" ( _
                                ByVal addr As Integer, _
                                ByRef pulseRef As Double, _
                                ByRef peakRef As Double, _
                                ByRef averageRef As Double, _
                                ByRef dutyCycleRef As Double, _
                                ByRef units As PWR_UNITS) _
                                As Integer

    '==============================
    'SET/GET ANTI-ALIASING
    '------------------------------
    Public Declare Function LB_SetAntiAliasingEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetAntiAliasingEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer

    '==============================
    'SET/GET TTL TRIGGER IN
    '------------------------------
    Public Declare Function LB_SetTTLTriggerInEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_SetTTLTriggerInInverted Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_SetTTLTriggerInTimeOut Lib "LB_API2.dll" (ByVal addr As Integer, ByVal timeOut As Integer) As Integer
    Public Declare Function LB_GetTTLTriggerInEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetTTLTriggerInInverted Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetTTLTriggerInTimeOut Lib "LB_API2.dll" (ByVal addr As Integer, ByRef timeOut As Integer) As Integer

    '==============================
    'SET/GET TTL TRIGGER OUT
    '------------------------------
    Public Declare Function LB_SetTTLTriggerOutEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_SetTTLTriggerOutInverted Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetTTLTriggerOutEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetTTLTriggerOutInverted Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer

    '==============================
    'SET/GET RECORDER OUTPUT
    '------------------------------
    Public Declare Function LB_SetRecorderOutSetup Lib "LB_API2.dll" (ByVal addr As Integer, ByVal val_0_V As Double, ByVal val_1_V As Double, ByVal units As PWR_UNITS) As Integer
    Public Declare Function LB_GetRecorderOutSetup Lib "LB_API2.dll" (ByVal addr As Integer, ByRef val_0_V As Double, ByRef val_1_V As Double, ByRef units As PWR_UNITS) As Integer
    Public Declare Function LB_SetRecorderOutEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetRecorderOutEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer

    '==============================
    'SET/GET LIMITS
    '------------------------------
    Public Declare Function LB_SetLimitEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal lmtStyle As LIMIT_STYLE) As Integer
    Public Declare Function LB_SetSingleSidedLimit Lib "LB_API2.dll" (ByVal addr As Integer, ByVal val As Double, ByVal units As PWR_UNITS, ByVal passFail As SS_RULE) As Integer
    Public Declare Function LB_SetDoubleSidedLimit _
                                Lib "LB_API2.dll" ( _
                                ByVal addr As Integer, _
                                ByVal lowerVal As Double, _
                                ByVal upperVal As Double, _
                                ByVal units As PWR_UNITS, _
                                ByVal passFail As DS_RULE) _
                                As Integer
    Public Declare Function LB_GetLimitEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef lmtStyle As LIMIT_STYLE) As Integer
    Public Declare Function LB_GetSingleSidedLimit Lib "LB_API2.dll" (ByVal addr As Integer, ByRef val As Double, ByRef units As PWR_UNITS, ByRef passFail As SS_RULE) As Integer
    Public Declare Function LB_GetDoubleSidedLimit _
                                Lib "LB_API2.dll" ( _
                                ByVal addr As Integer, _
                                ByRef lowerVal As Double, _
                                ByRef upperVal As Double, _
                                ByRef units As PWR_UNITS, _
                                ByRef passFail As DS_RULE) _
                                As Integer

    '==============================
    'EXTENDED AVERAGING AND MAX HOLD
    '------------------------------
    Public Declare Function LB_GetExtendedAveragingEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer
    Public Declare Function LB_SetExtendedAveragingEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_GetExtendedAveraging Lib "LB_API2.dll" (ByVal addr As Integer, ByRef extAvg As Integer) As Integer
    Public Declare Function LB_SetExtendedAveraging Lib "LB_API2.dll" (ByVal addr As Integer, ByVal extAvg As Integer) As Integer
    Public Declare Function LB_ResetExtendedAveraging Lib "LB_API2.dll" (ByVal addr As Integer) As Integer

    Public Declare Function LB_GetMaxHoldEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer
    Public Declare Function LB_SetMaxHoldEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer
    Public Declare Function LB_ResetMaxHold Lib "LB_API2.dll" (ByVal addr As Integer) As Integer

    '==============================
    'MLP
    '------------------------------
    Public Declare Function LB_Get75OhmsEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByRef st As FEATURE_STATE) As Integer
    Public Declare Function LB_Set75OhmsEnabled Lib "LB_API2.dll" (ByVal addr As Integer, ByVal st As FEATURE_STATE) As Integer


    '==============================
    'STORE/RECALL
    '------------------------------
    '------------------------------
    '       NUMBERED STATES
    '------------------------------
    Public Declare Function LB_Store Lib "LB_API2.dll" (ByVal addr As Integer, ByVal regIdx As Integer) As Integer
    Public Declare Function LB_Recall Lib "LB_API2.dll" (ByVal addr As Integer, ByVal regIdx As Integer) As Integer
    Public Declare Function LB_ResetCurrentState Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    Public Declare Function LB_ResetRegStates Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    Public Declare Function LB_WriteStateToINI Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    Public Declare Function LB_ReadStateFromINI Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    '------------------------------
    '       NAMED STATES
    '------------------------------
    Public Declare Function LB_SaveCurrStateTo Lib "LB_API2.dll" (ByVal addr As Integer, ByVal stateName As String) As Integer
    Public Declare Function LB_RestoreCurrStateFrom Lib "LB_API2.dll" (ByVal addr As Integer, ByVal stateName As String) As Integer

    Public Declare Function LB_GetNamedStateCount Lib "LB_API2.dll" (ByVal addr As Integer) As Integer
    Public Declare Function LB_GetNamedStateNames Lib "LB_API2.dll" (ByVal addr As Integer, ByVal buff As String, ByRef buffLen As Integer) As Integer
    Public Declare Function LB_DeleteNamedState Lib "LB_API2.dll" (ByVal addr As Integer, ByVal stateName As String) As Integer

    '==============================
    'SET/GET OPTIONS & DATES
    '------------------------------
    Public Declare Function LB_SetCalDueDate Lib "LB_API2.dll" (ByVal sn As String, ByVal year As Integer, ByVal month As Integer, ByVal day As Integer) As Integer
    Public Declare Function LB_GetCalDueDate Lib "LB_API2.dll" (ByVal sn As String, ByRef year As Integer, ByRef month As Integer, ByRef day As Integer) As Integer
    Public Declare Function LB_GetCalOptExpDate Lib "LB_API2.dll" (ByVal sn As String, ByRef year As Integer, ByRef month As Integer, ByRef day As Integer) As Integer
    Public Declare Function LB_GetWtyOptExpDate Lib "LB_API2.dll" (ByVal sn As String, ByRef year As Integer, ByRef month As Integer, ByRef day As Integer) As Integer
    Public Declare Function LB_GetConnectorOption Lib "LB_API2.dll" (ByVal sn As String, ByRef val As Integer) As Integer
    Public Declare Function LB_GetCalAndWtyOption Lib "LB_API2.dll" (ByVal sn As String, ByRef optVal As Integer) As Integer
    Public Declare Function LB_GetRecorderOutOption Lib "LB_API2.dll" (ByVal sn As String, ByRef optVal As Integer) As Integer
    Public Declare Function LB_GetTriggerOpt Lib "LB_API2.dll" (ByVal sn As String, ByRef optVal As Integer) As Integer
    Public Declare Function LB_GetFilterOpt Lib "LB_API2.dll" (ByVal sn As String, ByRef optVal As Integer) As Integer

End Module

