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

/// <summary>
/// Configures digital subsystem.
/// </summary>
/// <remarks>
/// 
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
/// <param name="Width">
///	Channel width (1,2 or 4 bytes).
/// </param>
/// <param name="Direction">
///	Signal direction (input or output).
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_Configure(BSTR ChannelList, Agilent34959AWidthEnum Width, Agilent34959ADirectionEnum Direction)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
/// Returns the last 1-bit value written to the specified output channel.
/// </summary>
/// <remarks>
/// 
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
/// <param name="BitNumber">
///	Specifies the bit of interest.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_QueryLastBit(BSTR ChannelList, long BitNumber, VARIANT_BOOL* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandBool(val);

	return hr;
}

/// <summary>
/// Returns the last 8-bit value written to the specified output channels .
/// </summary>
/// <remarks>
/// 
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_QueryLastByte(BSTR ChannelList, BYTE* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}

/// <summary>
/// Returns the last 16-bit value written to the specified output channels (specified
/// channel must be either the first channel or third channel on the module).
/// </summary>
/// <remarks>
/// 
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_QueryLastWord(BSTR ChannelList, short* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}

/// <summary>
/// Reads the value of the specified bit location (0 through 7) on the specified
/// digital input channels and sends the results directly to the instrument's output
/// buffer.
/// </summary>
/// <remarks>
/// Each bit read involves 1 channel; note that if any of the specified channels
/// are presently configured as outputs, this command will return the last value
/// output on the specified bit from those channels (the channels are not reconfigured
/// as inputs).
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="Channel">
///	One or more channels in the form sccc.
/// </param>
/// <param name="BitNumber">
///	Number of bit of interest.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_ReadBit(BSTR Channel, long BitNumber, VARIANT_BOOL* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandBool(val);

	return hr;
}


/// <summary>
/// Performs an 8-bit read on the specified digital input channels and sends the
/// results directly to the instrument's output buffer.
/// </summary>
/// <remarks>
/// Each byte read involves 1 channel; note that if any of the specified channels
/// are presently configured as outputs, this command will return the last value
/// output from those channels (the channels are not reconfigured as inputs).
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_ReadByte(BSTR ChannelList, BYTE* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}


/// <summary>
/// Performs a 16-bit read on the specified digital input channel (specified channel
/// must be either the first channel or third channel on the module) and sends the
/// results directly to the instrument's output buffer.
/// </summary>
/// <remarks>
/// Each word read involves 2 channels; note that if either of the two channels
/// involved in a word read are presently configured as outputs, this command will
/// return the last value output from those channels (the channels are not reconfigured
/// as inputs).
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_ReadWord(BSTR ChannelList, short* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}

/// <summary>
/// Sets or clears individual bits on the specified digital output channels.
/// </summary>
/// <remarks>
/// If an input channel is specified in the list, that channel is reconfigured to
/// be an output channel.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
/// <param name="BitNumber">
///	Bit number between 0 (LSB) and 7 (MSB) on the specified channel.
/// </param>
/// <param name="Data">
///	A value of 0 or 1 to be written.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_WriteBit(BSTR ChannelList, long BitNumber, VARIANT_BOOL Data)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
/// Outputs the specified 8-bit (byte) value on the specified digital output channels.
/// </summary>
/// <remarks>
/// If an input channel is specified in the list, that channel is reconfigured to
/// be an output channel.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
/// <param name="Data">
///	A data byte to be written.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_WriteByte(BSTR ChannelList, BYTE Data)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}


/// <summary>
/// Outputs the specified 16-bit pattern on the specified digital output channels
/// (must be either first or third channel on a module).
/// </summary>
/// <remarks>
/// Each word write involves 2 channels; note that if either of the two channels
/// involved in a word write are presently configured as inputs, they will be reconfigured
/// to be an output channel.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
/// <param name="Data">
///	Data to be written.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_WriteWord(BSTR ChannelList, short Data)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the signal direction (input or output).
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_get_Direction(BSTR ChannelList, Agilent34959ADirectionEnum* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandEnum(val);

	return hr;
}

/// <summary>
///	Sets or gets the signal direction (input or output).
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_put_Direction(BSTR ChannelList, Agilent34959ADirectionEnum val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the digital channel width (1,2 or 4 bytes).
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_get_Width(BSTR ChannelList, Agilent34959AWidthEnum* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandEnum(val);

	return hr;
}

/// <summary>
///	Sets or gets the digital channel width (1,2 or 4 bytes).
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34959A::IAgilent34959ADigital_put_Width(BSTR ChannelList, Agilent34959AWidthEnum val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}


