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









/// <summary>
/// Configures the instrument for a scan.
/// </summary>
/// <remarks>
/// 
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	Determines the new scan list.
/// </param>
/// <param name="SweepCount">
///	Selects the number of sweeps per trigger event.
/// </param>
/// <param name="Ordered">
///	If FALSE, ordered scan is disabled.
/// </param>
HRESULT Agilent34980A::IAgilent34980AScan_ConfigureScan(BSTR ChannelList, long SweepCount, VARIANT_BOOL Ordered)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();
	return hr;
}

/// <summary>
///	Sets or gets an automated scan. The specified channels supersede any channels previously defined to be part of the scan list.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_get_ScanList(BSTR* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets an automated scan. The specified channels supersede any channels previously defined to be part of the scan list.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_put_ScanList(BSTR Val)
{
	HRESULT hr = S_OK;

	CorrectChannelList( Val );
	if( ::SysStringLen( Val ) )
		return InstrPrintCommand(); // normal scan list
	// empty scan list=clear, instrument requires '(@)' to clear the scan list
	PushInstrCommand( "ROUT:SCAN (@)" );
	hr = InstrPrintCommand();
	PopInstrCommand();

	return hr;
}

/// <summary>
///	Returns the number of channels in the scan list.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_get_ScanSize(long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}



/// <summary>
///	Returns the time at the start of the scan.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_get_ScanTime(BSTR* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the number of triggers that will be accepted by the internal DMM
/// before returning to the idle trigger state.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_get_SweepCount(long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the number of triggers that will be accepted by the internal DMM
/// before returning to the idle trigger state.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_put_SweepCount(long Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}


/// <summary>
///	When OFF, Scan list will be executed in the order given in the list.  When ON,
/// the scan list will be re-ordered in ascending channel number order.  Also affects
/// READ and MEAS commands.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_get_OrderedScan(VARIANT_BOOL* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandBool(val);

	return hr;
}

/// <summary>
///	When OFF, Scan list will be executed in the order given in the list.  When ON,
/// the scan list will be re-ordered in ascending channel number order.  Also affects
/// READ and MEAS commands.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IAgilent34980AScan_put_OrderedScan(VARIANT_BOOL val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}
