/******************************************************************************
 *                                                                         
 *               Copyright 2004-2006 Agilent Technologies
 *               All rights reserved.
 *
 *****************************************************************************/
 
#include "stdafx.h"
#include "CoAgilent34980A.h"

/// <summary>
///	Enters a new security code.  
/// </summary>
/// <remarks>
/// You must first unsecure the instrument using the
///  old security code (SecureEnable = false)  and then enter a new code.  The code
///  may contain up to 12 alphanumeric characters, and the first character must
/// be a letter.
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_put_Code(BSTR Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets message stored in Mainframe calibration memory.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_get_String(BSTR* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets message stored in Mainframe calibration memory.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_put_String(BSTR Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}


/// <summary>
///	Gets the calibration count on the specified location.
/// </summary>
/// <remarks>
///	Individual calibration counts are kept for the DMM and each DAC module; the
/// mainframe count is a total of all calibrations done.
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_get_Count(long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}


/// <summary>
///	Gets/Sets the line frequency used for 34951 Calibration.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_get_LineFrequency(double* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}


/// <summary>
///	Gets/Sets the line frequency used for 34951 Calibration.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_put_LineFrequency(double Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
/// Enables or disables the calibration state, when the proper Code string is supplied.
/// </summary>
/// <remarks>
/// When the state is 0 (OFF), calibration is allowed on the DMM or DAC modules,
/// and the results of a calibration will be saved in non-volatile memory.  When
/// the state is 1 (ON), the stored calibration constants are protected from modification
/// (they are secure).
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="Enable">
///	If TRUE, instrument is secured and cannot be calibrated. Set to FALSE before
/// calibration.
/// </param>
/// <param name="Code">
///	Security code of the instrument.
/// </param>
HRESULT Agilent34980A::IAgilent34980ACalibration_SecurityEnable(VARIANT_BOOL Enable, BSTR Code)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Returns the state of calibration security on the instrument.
/// </summary>
/// <remarks>
///	When  0 (OFF), the instrument’s calibration constants may be modified and saved
/// to non-volatile memory by one of the calibration procedures.  Additionally,
/// when 0 (OFF), the calibration security code string can be changed.  When 1 (ON)
/// changes to the calibration constants saved in non-volatile locations is disallowed,
/// as is any change of the calibration security code string.
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_get_SecurityState(VARIANT_BOOL* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandBool(Val);

	return hr;
}

/// <summary>
///	Returns pointer to the instrument specific DAC interface
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_get_DAC(IAgilent34980ADAC** Val)
{
	HRESULT hr = S_OK;

	hr = InternalQueryInterface(this, _GetEntries(), __uuidof(*Val), reinterpret_cast<void**>(Val));

	return hr;
}


/// <summary>
///	Returns pointer to the instrument specific DMM interface
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980ACalibration_get_DMM(IAgilent34980ADMM** Val)
{
	HRESULT hr = S_OK;

	hr = InternalQueryInterface(this, _GetEntries(), __uuidof(*Val), reinterpret_cast<void**>(Val));

	return hr;
}
