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



/// <summary>
/// Aborts an initiated counter measurement in progress.
/// </summary>
/// <remarks>
/// This can be useful for aborting long internally or externally gated measurements.
///  Abort does not invalidate or clear data.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_Abort(BSTR ChannelList)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
/// Initiates a gated measurement
/// </summary>
/// <remarks>
/// Begins a counter measurement. Once the measurement is initiated, gating can
/// start. If gate source is INTernal, the measurement will begin immidiately. Otherwise,
/// the EXTernal gate is used to begin the measurement. If the counter function
/// is Totalize, the measurement will begin without an Initiate call, but subsequent
/// Initiate calls will reset the count to 0 and begin totalizing again. An initiated
/// measurement can be aborted via Abort call.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_Initiate(BSTR ChannelList)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Returns the measured frequency.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_get_Frequency(BSTR ChannelList, double* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}

/// <summary>
///	Returns the measured period.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_get_Period(BSTR ChannelList, double* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}

/// <summary>
///	Returns the measured pulse width.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_get_PulseWidth(BSTR ChannelList, double* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}

/// <summary>
///	Returns the measured duty cycle.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_get_PulseDutyCycle(BSTR ChannelList, double* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}


/// <summary>
/// Returns the data from the last configured measurement.
/// </summary>
/// <remarks>
/// If the counter is currently initiated and taking and internally gated measurement
/// the method will pend untill the measurement is finished. For externally gated
/// or non-initiated measurements (i.e. Totalizer count), the data query will return
/// the current result. The data is returned in floating point format. Example:
/// +1.00000000E+00.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_ReadData(BSTR ChannelList, double* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand( Val );

	return hr;
}

/// <summary>
///	Returns the current totalizer count.
/// </summary>
/// <remarks>
///	Can be used at any time.  If an internally gated measurement is in progress
/// this query will pend until the measurement is complete.
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950AMeasurement_get_TotalizeCount(BSTR ChannelList, long* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}
