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

/// <summary>
/// Makes an immediate null measurement on the specified channels and store it as
/// the offset ('B') for subsequent measurements.  This allows you to adjust for
/// voltage or resistive offsets through your wiring to the point of the measurement.
/// </summary>
/// <remarks>
/// 
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_OffsetNull(BSTR ChannelList)
{
	HRESULT hr = S_OK;

	CorrectChannelList( ChannelList );

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the gain for scaled readings on the specified channel.
/// </summary>
/// <remarks>
///	Allowable values are from -1E+15 to +1E+15. If the ChannelList parameter is
/// empty, this method applies to the internal DMM, independent of any channels
/// or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_get_Gain(BSTR ChannelList, double* Val)
{
	HRESULT hr = S_OK;

	CString sList(ChannelList);
	if( -1 != sList.Find( ',' ) || -1!=sList.Find( ':' ) || -1 != sList.Find( '-' ) )
	{
		return ReportError( E_AGILENT34980A_MULTIPLE_CHANNELS_IN_GET, _T("IAgilent34980AScale_get_Gain"), _T("ChannelList"));
 	}
	CorrectChannelList( ChannelList, false );
	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the gain for scaled readings on the specified channel.
/// </summary>
/// <remarks>
///	Allowable values are from -1E+15 to +1E+15. If the ChannelList parameter is
/// empty, this method applies to the internal DMM, independent of any channels
/// or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_put_Gain(BSTR ChannelList, double Val)
{
	HRESULT hr = S_OK;

	CorrectChannelList( ChannelList );

 	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the offset for scaled readings on the specified channels.
/// </summary>
/// <remarks>
///	Allowable values are from -1E+15 to +1E+15. If the ChannelList parameter is
/// empty, this method applies to the internal DMM, independent of any channels
/// or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_get_Offset(BSTR ChannelList, double* Val)
{
	HRESULT hr = S_OK;

	CString sList(ChannelList);
	if( -1 != sList.Find( ',' ) || -1!=sList.Find( ':' ) || -1 != sList.Find( '-' ) )
	{
		return ReportError( E_AGILENT34980A_MULTIPLE_CHANNELS_IN_GET, _T("IAgilent34980AScale_get_Offset"), _T("ChannelList"));
 	}
	CorrectChannelList( ChannelList, false );
	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the offset for scaled readings on the specified channels.
/// </summary>
/// <remarks>
///	Allowable values are from -1E+15 to +1E+15. If the ChannelList parameter is
/// empty, this method applies to the internal DMM, independent of any channels
/// or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_put_Offset(BSTR ChannelList, double Val)
{
	HRESULT hr = S_OK;

	CorrectChannelList( ChannelList );

	hr = InstrPrintCommand();

	return hr;
}


/// <summary>
///	Enables/Disables scaling on the specified channel.
/// </summary>
/// <remarks>
///	If the ChannelList parameter is empty, this method applies to the internal DMM,
/// independent of any channels or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_get_State(BSTR ChannelList, VARIANT_BOOL* Val)
{
	HRESULT hr = S_OK;

	CString sList(ChannelList);
	if( -1 != sList.Find( ',' ) || -1!=sList.Find( ':' ) || -1 != sList.Find( '-' ) )
	{
		return ReportError( E_AGILENT34980A_MULTIPLE_CHANNELS_IN_GET, _T("IAgilent34980AScale_get_State"), _T("ChannelList"));
 	}
	CorrectChannelList( ChannelList, false );
	hr = InstrQueryCommand(Val);

	return hr;
}


/// <summary>
///	Enables/Disables scaling on the specified channel.
/// </summary>
/// <remarks>
///	If the ChannelList parameter is empty, this method applies to the internal DMM,
/// independent of any channels or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_put_State(BSTR ChannelList, VARIANT_BOOL Val)
{
	HRESULT hr = S_OK;

	CorrectChannelList( ChannelList );

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets the custom label for scaled measurements on the specified channel.  The
/// label can have up to three characters, including letters (A-Z), numbers (0-9),
/// the underscore (_), or the # character for a degree symbol.
/// </summary>
/// <remarks>
///	If the ChannelList parameter is empty, this method applies to the internal DMM,
/// independent of any channels or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_get_Unit(BSTR ChannelList, BSTR* Val)
{
	HRESULT hr = S_OK;

	CString sList(ChannelList);
	if( -1 != sList.Find( ',' ) || -1!=sList.Find( ':' ) || -1 != sList.Find( '-' ) )
	{
		return ReportError( E_AGILENT34980A_MULTIPLE_CHANNELS_IN_GET, _T("IAgilent34980AScale_get_Unit"), _T("ChannelList"));
 	}
	CorrectChannelList( ChannelList, false );
	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets the custom label for scaled measurements on the specified channel.  The
/// label can have up to three characters, including letters (A-Z), numbers (0-9),
/// the underscore (_), or the # character for a degree symbol.
/// </summary>
/// <remarks>
///	If the ChannelList parameter is empty, this method applies to the internal DMM,
/// independent of any channels or a scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc. Must contain only 1 entry for the getter.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScale_put_Unit(BSTR ChannelList, BSTR VSal)
{
	HRESULT hr = S_OK;

	CorrectChannelList( ChannelList );

 	hr = InstrPrintCommand();

	return hr;
}


