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

/// <summary>
/// Configures multipoint trigger Count, SampleCount, SampleTrigger and SampleInterval
/// properties.
/// </summary>
/// <remarks>
/// 
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="TriggerCount">
///	The number of triggers the DMM accepts before it returns to the idle state.
/// </param>
/// <param name="SampleCount">
///	The number of measurements the DMM takes each time it receives a trigger.
/// </param>
/// <param name="SampleTrigger">
///	The sample trigger source. If the value of the Sample Count is greater than
/// 1, the DMM enters the Wait-For-Sample-Trigger state after taking a single measurement.
/// When the event specified by this parameter occurs, the DMM exits the Wait-For-Sample-Trigger
/// state and takes the next measurement.
/// </param>
/// <param name="SampleInterval">
///	The interval between samples in seconds.
/// </param>
HRESULT Agilent34980A::IIviDmmMultiPoint_Configure(long TriggerCount, long SampleCount, IviDmmSampleTriggerEnum SampleTrigger, double SampleInterval)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();
	//Agilent34980ATriggerSourceEnum source;
	//switch( SampleTrigger )
	//{
	//case IviDmmSampleTriggerImmediate:	source = Agilent34980ATriggerSourceImmediate;	break;
	//case IviDmmSampleTriggerExternal:	source = Agilent34980ATriggerSourceExternal;		break;
	//default: return ReportInvalidValueError( _T("IIviDmmMultiPoint_Configure"), _T("SampleTrigger"), SampleTrigger );
	//}
	//hr = InstrPrintf(":TRIG:COUN %d; :SAMP:COUN %d; :TRIG:SOUR %s", TriggerCount, SampleCount, EnumToString<Agilent34980ATriggerSourceEnum>(source));

	return hr;
}

/// <summary>
///	The destination of the measurement-complete signal generated after each measurement.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_get_MeasurementComplete(IviDmmMeasCompleteDestEnum* Val)
{
	*Val = IviDmmMeasCompleteDestExternal;

	/*After each measurement, the DMM generates a measurement-complete 
	signal. This attribute specifies the destination of the measurement-complete signal. This signal is 
	commonly referred to as Voltmeter Complete. */
	return S_OK;
}

/// <summary>
///	The destination of the measurement-complete signal generated after each measurement.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_put_MeasurementComplete(IviDmmMeasCompleteDestEnum Val)
{
	//HRESULT hr = InstrPrintCommand();

	/*After each measurement, the DMM generates a measurement-complete 
	signal. This attribute specifies the destination of the measurement-complete signal. This signal is 
	commonly referred to as Voltmeter Complete. */
	return ReportError( IDS_E_IVI_PROPERTY_NOT_SUPPORTED );
}

/// <summary>
///	The number of triggers the DMM accepts before it returns to the idle state.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_get_Count(long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	The number of triggers the DMM accepts before it returns to the idle state.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_put_Count(long Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	The number of measurements the DMM takes each time it receives a trigger.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_get_SampleCount(long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	The number of measurements the DMM takes each time it receives a trigger.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_put_SampleCount(long Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	The interval between samples in seconds. Applies only when Sample Count is greater
/// than 1 and Sample Trigger is Interval.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_get_SampleInterval(double* Val)
{
	HRESULT hr = S_OK;

	//No SCPI, happens immediately
	
	*Val = .0;
	
	return hr;
}

/// <summary>
///	The interval between samples in seconds. Applies only when Sample Count is greater
/// than 1 and Sample Trigger is Interval.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_put_SampleInterval(double Val)
{
	HRESULT hr = S_OK;

	//No SCPI, happens immediately
	
	
	return hr;
}

/// <summary>
///	The sample trigger source.  If the value of the Sample Count is greater than
/// 1, the DMM enters the Wait-For-Sample-Trigger state after taking a single measurement.
///  When a sample trigger occurs, the DMM takes the next measurement.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_get_SampleTrigger(IviDmmSampleTriggerEnum* Val)
{
	HRESULT hr = S_OK;

	//No SCPI, internal timer
	*Val = IviDmmSampleTriggerSwTrigFunc;
	return hr;
}

/// <summary>
///	The sample trigger source.  If the value of the Sample Count is greater than
/// 1, the DMM enters the Wait-For-Sample-Trigger state after taking a single measurement.
///  When a sample trigger occurs, the DMM takes the next measurement.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34980A::IIviDmmMultiPoint_put_SampleTrigger(IviDmmSampleTriggerEnum Val)
{
	HRESULT hr = S_OK;

	//No SCPI, internal timer
	
	return hr;
}


