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

/// <summary>
/// Returns the last 8-bit (byte) value written to the specified output channels.
/// </summary>
/// <remarks>
/// If this command is sent to an input channel, the value returned will be:\r\n
/// 0 if the input has not been an output since the last reset\r\n
/// or\r\n
/// the last byte value sent when the channel was previously configured as 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>
HRESULT Agilent34950A::IAgilent34950ADigital_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.
/// </summary>
/// <remarks>
/// Specified channel must be either the first channel or third channel on the module.
/// Each word query involves 2 channels; note that if either of the two channels
/// involved in a word query are presently configured as inputs, this command will
/// return:\r\n
/// 0 if the input has not been an output since the last reset\r\n
///  or\r\n
/// the last byte value sent when the channel was previously configured as 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>
HRESULT Agilent34950A::IAgilent34950ADigital_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 31) on the specified
/// digital input channels and sends the results directly to the instrument 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="ChannelList">
///	One or more digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
/// <param name="BitNumber">
///	The bit number can vary from 0 to the maximum bit that the channel is capable
/// of, as determined by its present width setting (i.e. Byte, Word, LongWord):\r\n
/// Channel 01: BitNumber can range from 0 to 31\r\n
/// Channel 02: BitNumber can range from 0 to 7\r\n
/// Channel 03: BitNumber can range from 0 to 15\r\n
/// Channel 04: BitNumber can range from 0 to 7
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_ReadBit(BSTR ChannelList, 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 digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_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 digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_ReadWord(BSTR ChannelList, short* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}



/// <summary>
/// Performs a 32-bit read on the specified digital input channel (specified channel
/// must be the first channel on a bank of 4 channels) and sends the results directly
/// to the instrument's output buffer.
/// </summary>
/// <remarks>
/// Each long word read involves 4 channels; note that if any of the four channels
/// involved in a long 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 digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_ReadLongWord(BSTR ChannelList, long* 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="Data">
///	A value of 0 or 1 to be written.
/// </param>
/// <param name="BitNumber">
///	The bit number can vary from 0 to the maximum bit that the channel is capable
/// of, as determined by its present width setting (i.e. Byte, Word, LongWord):\r\n
/// Channel 01: BitNumber can range from 0 to 31\r\n
/// Channel 02: BitNumber can range from 0 to 7\r\n
/// Channel 03: BitNumber can range from 0 to 15\r\n
/// Channel 01: BitNumber can range from 0 to 7
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_WriteBit(BSTR ChannelList, long Data, long BitNumber)
{
	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 Agilent34950A::IAgilent34950ADigital_WriteByte(BSTR ChannelList, long 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 Agilent34950A::IAgilent34950ADigital_WriteWord(BSTR ChannelList, long Data)
{
	HRESULT hr = S_OK;

	hr = InstrPrintf( "SOUR:DIG:DATA:WORD #H%X, (@%s)", (USHORT)Data, LPCTSTR(COLE2T(ChannelList)) );

	return hr;
}



/// <summary>
/// Outputs the specified 32-bit pattern on the specified digital output channels
/// (must be the first channel on a bank of 4 channels).
/// </summary>
/// <remarks>
/// Each long word write involves 4 channels; note that if any of the four 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 Agilent34950A::IAgilent34950ADigital_WriteLongWord(BSTR ChannelList, long Data)
{
	HRESULT hr = S_OK;

	hr = InstrPrintf( "SOUR:DIG:DATA:LWOR #H%X, (@%s)", (ULONG)Data, LPCTSTR(COLE2T(ChannelList)) );

	return hr;
}


/// <summary>
///	Disables or enables the pattern comparison mode on the digital modules. This
/// command applies to digital input operations on the specified bank (DIO1 or DIO2).
/// </summary>
/// <remarks>
///	Digital alarms become active immediately, so this should be the last step in
/// setting up the Alarm on a digital comparison. Be certain before setting enable
/// ON that you have gone to the IAgilent34980A.Alarm interface (in the Core interfaces
/// section) to specify the desired alarm Mode and added this channel to the desired
/// alarm Source.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonEnable(BSTR ChannelList, VARIANT_BOOL* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}



/// <summary>
///	Disables or enables the pattern comparison mode on the digital modules. This
/// command applies to digital input operations on the specified bank (DIO1 or DIO2).
/// </summary>
/// <remarks>
///	Digital alarms become active immediately, so this should be the last step in
/// setting up the Alarm on a digital comparison. Be certain before setting enable
/// ON that you have gone to the IAgilent34980A.Alarm interface (in the Core interfaces
/// section) to specify the desired alarm Mode and added this channel to the desired
/// alarm Source.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc: digital input/output
/// channels only.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonEnable(BSTR ChannelList, VARIANT_BOOL val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the type of comparison - Equal or NotEqual.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonType(BSTR ChannelList, Agilent34950AComparisonTypeEnum* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandEnum( Val );

	return hr;
}



/// <summary>
///	Sets or gets the type of comparison - Equal or NotEqual.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonType(BSTR ChannelList, Agilent34950AComparisonTypeEnum Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}




/// <summary>
///	Sets or gets the state of the channel - input or output
/// </summary>
/// <remarks>
///	Changing the direction of a channel is not allowed if the channel is grouped
/// (upper byte of a multi-byte channel).  If a channel is in the scan list, changing
/// it to an output will clear the scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_Direction(BSTR ChannelList, Agilent34950ADirectionEnum* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandEnum(Val);

	return hr;
}


/// <summary>
///	Sets or gets the state of the channel - input or output
/// </summary>
/// <remarks>
///	Changing the direction of a channel is not allowed if the channel is grouped
/// (upper byte of a multi-byte channel).  If a channel is in the scan list, changing
/// it to an output will clear the scan list.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_Direction(BSTR ChannelList, Agilent34950ADirectionEnum Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the data bit pattern for comparisons on the digital modules.
/// </summary>
/// <remarks>
///	Used in conjunction with seting the mask bit pattern. Applies to digital input
/// operations on the specified bank (DIO1 or DIO2). Pattern matching always starts
/// on the lowest-numbered channel in the bank.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonDataByte(BSTR ChannelList, BYTE* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the data bit pattern for comparisons on the digital modules.
/// </summary>
/// <remarks>
///	Used in conjunction with seting the mask bit pattern. Applies to digital input
/// operations on the specified bank (DIO1 or DIO2). Pattern matching always starts
/// on the lowest-numbered channel in the bank.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonDataByte(BSTR ChannelList, BYTE Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the data bit pattern for comparisons on the digital modules
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonDataWord(BSTR ChannelList, short* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the data bit pattern for comparisons on the digital modules
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonDataWord(BSTR ChannelList, short Val)
{
	HRESULT hr = S_OK;

	if( Val<0 )
		hr = InstrPrintf( "CALC:COMP:DATA:WORD #H%X, (@%s)", (USHORT)Val, LPCTSTR(COLE2T(ChannelList)) );
	else
		hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the data bit pattern for comparisons on the digital modules
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonDataLongWord(BSTR ChannelList, long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the data bit pattern for comparisons on the digital modules
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonDataLongWord(BSTR ChannelList, long Val)
{
	HRESULT hr = S_OK;

	if( Val<0 ) // send negative values as HEX
		hr = InstrPrintf( "CALC:COMP:DATA:LWOR #H%X, (@%s)", (ULONG)Val, LPCTSTR(COLE2T(ChannelList)) );
	else
		hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Disables or enables the pattern comparison mode on the digital modules.
/// </summary>
/// <remarks>
///	This command applies to digital input operations on the specified bank (DIO1
/// or DIO2). Pattern matching always starts on the lowest-numbered channel in the
/// bank and extends to the port width.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonAlarmEnable(BSTR ChannelList, VARIANT_BOOL* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandBool(Val);

	return hr;
}

/// <summary>
///	Disables or enables the pattern comparison mode on the digital modules.
/// </summary>
/// <remarks>
///	This command applies to digital input operations on the specified bank (DIO1
/// or DIO2). Pattern matching always starts on the lowest-numbered channel in the
/// bank and extends to the port width.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonAlarmEnable(BSTR ChannelList, VARIANT_BOOL Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the comparison mask.
/// </summary>
/// <remarks>
///	If the data or mask value are greater than the width size, the excess bits will
/// be cut. For example if the width is set to BYTE and the data is 256 (1 0000
/// 0000), the pattern compare will be against the 0000 0000 and the 1 will be ignored.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonMaskByte(BSTR ChannelList, BYTE* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the comparison mask.
/// </summary>
/// <remarks>
///	If the data or mask value are greater than the width size, the excess bits will
/// be cut. For example if the width is set to BYTE and the data is 256 (1 0000
/// 0000), the pattern compare will be against the 0000 0000 and the 1 will be ignored.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonMaskByte(BSTR ChannelList, BYTE Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}


/// <summary>
///	Sets or gets the word comparison mask.
/// </summary>
/// <remarks>
///	If the data or mask value are greater than the width size, the excess bits will
/// be cut. For example if the width is set to BYTE and the data is 256 (1 0000
/// 0000), the pattern compare will be against the 0000 0000 and the 1 will be ignored.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonMaskWord(BSTR ChannelList, short* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}


/// <summary>
///	Sets or gets the word comparison mask.
/// </summary>
/// <remarks>
///	If the data or mask value are greater than the width size, the excess bits will
/// be cut. For example if the width is set to BYTE and the data is 256 (1 0000
/// 0000), the pattern compare will be against the 0000 0000 and the 1 will be ignored.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonMaskWord(BSTR ChannelList, short Val)
{
	HRESULT hr = S_OK;

	if( Val<0 )
		hr = InstrPrintf( "CALC:COMP:MASK:WORD #H%X, (@%s)", (USHORT)Val, LPCTSTR(COLE2T(ChannelList)) );
	else
		hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the long word comparison mask.
/// </summary>
/// <remarks>
///	If the data or mask value are greater than the width size, the excess bits will
/// be cut. For example if the width is set to BYTE and the data is 256 (1 0000
/// 0000), the pattern compare will be against the 0000 0000 and the 1 will be ignored.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_ComparisonMaskLongWord(BSTR ChannelList, long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(Val);

	return hr;
}

/// <summary>
///	Sets or gets the long word comparison mask.
/// </summary>
/// <remarks>
///	If the data or mask value are greater than the width size, the excess bits will
/// be cut. For example if the width is set to BYTE and the data is 256 (1 0000
/// 0000), the pattern compare will be against the 0000 0000 and the 1 will be ignored.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_ComparisonMaskLongWord(BSTR ChannelList, long Val)
{
	HRESULT hr = S_OK;
	if( Val<0 )
		hr = InstrPrintf( "CALC:COMP:MASK:LWOR #H%X, (@%s)", (ULONG)Val, LPCTSTR(COLE2T(ChannelList)) );
	else
		hr = InstrPrintCommand();

	return hr;
}


/// <summary>
///	Sets or gets the width of the digital channel.
/// </summary>
/// <remarks>
///	If the width spans multiple channels, the direction of the channels included
/// in the width is changed to match the direction of the specified channel.  The
/// default is BYTE.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_Width(BSTR ChannelList, Agilent34950AChannelWidthEnum* Val)
{
	HRESULT hr = S_OK;

	CString sRes, sQry;
	sQry.Format( "CONF:DIG:WIDT? (@%s)", LPCTSTR(COLE2T(ChannelList)) );
	hr = InstrQuery( sQry, sRes, DEFAULT_STRING_LENGTH );
	if( FAILED(hr) )
		return hr;

	sRes.Remove( '\"' );
	sRes.Remove( '\n' );
	if( sRes=='1' )
		*Val = Agilent34950AChannelWidthByte;
	else if( sRes=='2' )
		*Val = Agilent34950AChannelWidthWord;
	else if( sRes=='4' )
		*Val = Agilent34950AChannelWidthLWord;

	return hr;
}


/// <summary>
///	Sets or gets the width of the digital channel.
/// </summary>
/// <remarks>
///	If the width spans multiple channels, the direction of the channels included
/// in the width is changed to match the direction of the specified channel.  The
/// default is BYTE.
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_Width(BSTR ChannelList, Agilent34950AChannelWidthEnum val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
///	Sets or gets the polarity of the dio channel.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_get_Polarity(BSTR ChannelList, Agilent34950APolarityEnum* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommandEnum( Val );

	return hr;
}

/// <summary>
///	Sets or gets the polarity of the dio channel.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_put_Polarity(BSTR ChannelList, Agilent34950APolarityEnum Val)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}

/// <summary>
/// Queries the last value (0 or 1) that was output at this bit position.
/// </summary>
/// <remarks>
/// The 8-bit port associated with the specified channels are reconfigured as an
/// output port.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more digital input or output channels in the form sccc.
/// </param>
/// <param name="BitNumber">
///	The bit number can vary from 0 to the maximum bit that the channel is capable
/// of, as determined by its present width setting (i.e. Byte, Word, LongWord):\r\n
/// Channel 01: BitNumber can range from 0 to 31\r\n
/// Channel 02: BitNumber can range from 0 to 7\r\n
/// Channel 03: BitNumber can range from 0 to 15\r\n
/// Channel 04: BitNumber can range from 0 to 7
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_QueryLastBit(BSTR ChannelList, long BitNumber, BYTE* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand( Val );

	return hr;
}

/// <summary>
/// Reads an 8-, 16-, or 32-bit digital pattern from the specified digital output
/// channels.
/// </summary>
/// <remarks>
/// The specified channels are configured as output channels.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="ChannelList">
///	One or more digital output channels in the form sccc.
/// </param>
HRESULT Agilent34950A::IAgilent34950ADigital_QueryLastLongWord(BSTR ChannelList, long* Val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand( Val );

	return hr;
}

/// <summary>
///	Pointer to the IAgilent34950AHandshake interface.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34950A::IAgilent34950ADigital_get_Handshake(IAgilent34950AHandshake** Val)
{
	HRESULT hr = S_OK;

	hr = InternalQueryInterface(this, _GetEntries(), __uuidof(*Val), reinterpret_cast<void**>(Val));

	return hr;
}


/// <summary>
///	Pointer to the IAgilent34950AInput interface.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34950A::IAgilent34950ADigital_get_Input(IAgilent34950AInput** val)
{
	HRESULT hr = S_OK;

	hr = InternalQueryInterface(this, _GetEntries(), __uuidof(*val), reinterpret_cast<void**>(val));

	return hr;
}

/// <summary>
///	Pointer to the IAgilent34950AOutput interface.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34950A::IAgilent34950ADigital_get_Output(IAgilent34950AOutput** val)
{
	HRESULT hr = S_OK;

	hr = InternalQueryInterface(this, _GetEntries(), __uuidof(*val), reinterpret_cast<void**>(val));

	return hr;
}

/// <summary>
///	Pointer to the IAgilent34950ATrace interface.
/// </summary>
/// <remarks>
///	
/// </remarks>
HRESULT Agilent34950A::IAgilent34950ADigital_get_Trace(IAgilent34950ATrace** val)
{
	HRESULT hr = S_OK;

	hr = InternalQueryInterface(this, _GetEntries(), __uuidof(*val), reinterpret_cast<void**>(val));

	return hr;
}
