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

/// <summary>
/// Resets all 34945EXT remote modules connected to the 34945A Microwave Switch/Attenuator Driver in the specified slot.
/// </summary>
/// <remarks>
/// This method provides the only way to reset all 34945EXT remote modules in a given slot to a factory default state.
/// </remarks>
/// <returns>
///	
/// </returns>
/// <param name="Slot">
///	Slot number.
/// </param>
HRESULT Agilent34945A::IAgilent34945ASystem_RemoteModuleReset(long Slot)
{
	HRESULT hr = S_OK;

	hr = InstrPrintCommand();

	return hr;
}


/// <summary>
///	Returns a string containing a description of one of four Distribution Boards connected to the specified 34945EXT remote module.
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="RemoteModule">
///	One remote module identifier in the form sr00.\r\n
/// s: Mainframe slot number (1 through 8)\r\n
/// r: 34945EXT remote module (1 through 8)\r\n
/// </param>
/// <param name="Bank">
///	Specify an individual bank (1 to 4).
/// </param>
HRESULT Agilent34945A::IAgilent34945ASystem_get_RemoteModuleDescription(BSTR RemoteModule, long Bank, BSTR* val)
{
	HRESULT hr = S_OK;

	CString strResponse;
	hr = InstrQueryCommand(strResponse, DEFAULT_STRING_LENGTH);
	if (SUCCEEDED(hr))
	{
		*val = ::SysAllocString(CT2OLE(strResponse.Trim("\"")));
	}

	return hr;
}


/// <summary>
///	Returns the identity of the one of four Distribution Boards connected to the specified 34945EXT remote module.  
/// </summary>
/// <remarks>
///	
/// </remarks>
/// <param name="RemoteModule">
///	One remote module identifier in the form sr00.\r\n
/// s: Mainframe slot number (1 through 8)\r\n
/// r: 34945EXT remote module (1 through 8)\r\n
/// </param>
/// <param name="Bank">
///	Specify an individual bank (1 to 4).
/// </param>
HRESULT Agilent34945A::IAgilent34945ASystem_get_RemoteModuleType(BSTR RemoteModule, long Bank, BSTR* val)
{
	HRESULT hr = S_OK;

	CString strResponse;
	hr = InstrQueryCommand(strResponse, DEFAULT_STRING_LENGTH);
	if (SUCCEEDED(hr))
	{
		*val = ::SysAllocString(CT2OLE(strResponse.Trim("\"")));
	}

	return hr;
}



/// <summary>
///	Returns the hardware state of the 34945EXT remote modules connected to the 34945A Microwave Switch/Attenuator Driver in the specified slot. 
/// </summary>
/// <remarks>
///	Two decimal values are returned indicating which 34945EXT remote modules are currently present, properly booted, and under 34980A control.
/// The command returns the state of each register in the following format:\r\n
///    &lt;Booted Register&gt;,&lt;Attached Register&gt;\r\n
/// See the SCPI command reference for the SYSTem:RMODule:STATus? command for more information.
/// </remarks>
/// <param name="Slot">
///	Mainframe slot number (1 to 8).
/// </param>
HRESULT Agilent34945A::IAgilent34945ASystem_get_RemoteModuleStatus(long Slot, BSTR* val)
{
	HRESULT hr = S_OK;

	hr = InstrQueryCommand(val);

	return hr;
}
