/******************************************************************************
 *                                                                         
 *               Copyright 2004-2006 Agilent Technologies
 *               All rights reserved.
 *
 *****************************************************************************/

#pragma once
#include "resource.h"       // main symbols

#include "ErrorMessages.nimbus.h"
#include "ntlres.h"

#include "Interfaces.nimbus.h"
#include "Catids.nimbus.h"
#include "ForwardingShims.nimbus.h"

#define RETURN_IF_FAIL(x) {hr = x; if( FAILED(hr) ) return hr;}

[	
	// COM component categories
	implements_category("CATID_IVI_COM_DRIVER_PERSONALITY"),

	// Instrument personality support

	// Supported instrument models

	// General attributes
	coclass,
	threading(both),
	vi_progid("Agilent34951A.Agilent34951A"),
	progid("Agilent34951A.Agilent34951A.1"),
	uuid("21f7d49e-e742-4964-80ab-1c02021c6682"),
	helpstring("Agilent34951A Class"),
	default(IAgilent34951A)
]
class ATL_NO_VTABLE Agilent34951A : 
	public CPersonality<Agilent34951A, CVisaComIOProvider>,
	public ISupportErrorInfo,
	public _IAgilent34951A,
		public _IAgilent34951ACurrent,
	public _IAgilent34951AOutput,
	public _IAgilent34951ASource,
	public _IAgilent34951ATrace,
	public _IAgilent34951ATrigger,
	public _IAgilent34951AVoltage
{
	HRESULT _CreateCustomFloat(long slotNumber, BSTR name, long points, double* dataArray, long length );
public:
	HRESULT FinalConstruct();
	void FinalRelease();

	// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

	HRESULT FinalInitialize();
	HRESULT FinalClose();

	CString GetSelectCommand()
	{
		return "";	
	}

	DECLARE_PROTECT_FINAL_CONSTRUCT()
	DECLARE_NIMBUS_CLASS(Agilent34951A)

public:

public:
	// IAgilent34951A
	STDMETHOD(IAgilent34951A_get_Source)(IAgilent34951ASource** val);
	STDMETHOD(IAgilent34951A_get_Trace)(IAgilent34951ATrace** val);
	STDMETHOD(IAgilent34951A_get_Trigger)(IAgilent34951ATrigger** val);
	STDMETHOD(IAgilent34951A_get_Output)(IAgilent34951AOutput** val);


	// IAgilent34951ACurrent
	STDMETHOD(IAgilent34951ACurrent_Configure)(BSTR ChannelList, double Level);
	STDMETHOD(IAgilent34951ACurrent_get_Level)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951ACurrent_put_Level)(BSTR ChannelList, double val);
	STDMETHOD(IAgilent34951ACurrent_get_Gain)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951ACurrent_put_Gain)(BSTR ChannelList, double val);
	STDMETHOD(IAgilent34951ACurrent_get_Offset)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951ACurrent_put_Offset)(BSTR ChannelList, double val);

	// IAgilent34951AOutput
	STDMETHOD(IAgilent34951AOutput_get_State)(BSTR ChannelList, VARIANT_BOOL* val);
	STDMETHOD(IAgilent34951AOutput_put_State)(BSTR ChannelList, VARIANT_BOOL val);

	// IAgilent34951ASource
	STDMETHOD(IAgilent34951ASource_ApplyLevel)(BSTR ChannelList, Agilent34951AFunctionTypeEnum Function, double Level);
	STDMETHOD(IAgilent34951ASource_ApplyTrace)(BSTR ChannelList, BSTR TraceName, Agilent34951AFunctionTypeEnum Function, double Gain, double Offset, double Frequency);
	STDMETHOD(IAgilent34951ASource_ConfigureTrace)(BSTR ChannelList, Agilent34951AFunctionTypeEnum Function, BSTR TraceName, double Gain, double Offset);
	STDMETHOD(IAgilent34951ASource_StartTrace)(BSTR ChannelList, long NumCycles, long StartIndex);
	STDMETHOD(IAgilent34951ASource_get_OperationMode)(BSTR ChannelList, VARIANT_BOOL* val);
	STDMETHOD(IAgilent34951ASource_put_OperationMode)(BSTR ChannelList, VARIANT_BOOL val);
	STDMETHOD(IAgilent34951ASource_get_FunctionType)(BSTR ChannelList, Agilent34951AFunctionTypeEnum* val);
	STDMETHOD(IAgilent34951ASource_put_FunctionType)(BSTR ChannelList, Agilent34951AFunctionTypeEnum val);
	STDMETHOD(IAgilent34951ASource_get_NumCycles)(BSTR ChannelList, long* val);
	STDMETHOD(IAgilent34951ASource_put_NumCycles)(BSTR ChannelList, long val);
	STDMETHOD(IAgilent34951ASource_get_StartIndex)(BSTR ChannelLast, long* val);
	STDMETHOD(IAgilent34951ASource_put_StartIndex)(BSTR ChannelLast, long val);
	STDMETHOD(IAgilent34951ASource_get_TraceName)(BSTR ChannelList, BSTR* val);
	STDMETHOD(IAgilent34951ASource_put_TraceName)(BSTR ChannelList, BSTR val);
	STDMETHOD(IAgilent34951ASource_get_Frequency)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951ASource_put_Frequency)(BSTR ChannelList, double val);
	STDMETHOD(IAgilent34951ASource_get_Current)(IAgilent34951ACurrent** val);
	STDMETHOD(IAgilent34951ASource_get_Voltage)(IAgilent34951AVoltage** val);
	STDMETHOD(IAgilent34951ASource_HaltTrace)(BSTR ChannelList);

	// IAgilent34951ATrace
	STDMETHOD(IAgilent34951ATrace_CreateCustomInteger)(long SlotNumber, BSTR Name, long Points, SAFEARRAY** DataArray);
	STDMETHOD(IAgilent34951ATrace_CreateCustomFloat)(long SlotNumber, BSTR name, long numPoints, SAFEARRAY** dataArray);
	STDMETHOD(IAgilent34951ATrace_CreateStandard)(long slotNumber, BSTR name, long points, Agilent34951ATraceWaveformEnum type);
	STDMETHOD(IAgilent34951ATrace_Delete)(long SlotNumber, BSTR TraceName);
	STDMETHOD(IAgilent34951ATrace_DeleteAll)(long SlotNumber);
	STDMETHOD(IAgilent34951ATrace_CreateCustomFromFile)(long SlotNumber, BSTR Name, BSTR SourceFile);
	STDMETHOD(IAgilent34951ATrace_get_Points)(long SlotNumber, BSTR Name, long* Val);
	STDMETHOD(IAgilent34951ATrace_get_MemoryFree)(long SlotNumber, long* val);
	STDMETHOD(IAgilent34951ATrace_get_Catalog)(long SlotNumber, BSTR* val);

	// IAgilent34951ATrigger
	STDMETHOD(IAgilent34951ATrigger_ConfigureInternalPacing)(BSTR ChannelList, Agilent34951ATraceTriggerSourceEnum TriggerSource, double Period);
	STDMETHOD(IAgilent34951ATrigger_ConfigureExternalPacing)(BSTR ChannelList, Agilent34951ATraceTriggerSourceEnum TriggerSource, long Divisor);
	STDMETHOD(IAgilent34951ATrigger_TriggerImmediate)(BSTR ChannelList);
	STDMETHOD(IAgilent34951ATrigger_get_Source)(BSTR ChannelList, Agilent34951ATraceTriggerSourceEnum* val);
	STDMETHOD(IAgilent34951ATrigger_put_Source)(BSTR ChannelList, Agilent34951ATraceTriggerSourceEnum val);
	STDMETHOD(IAgilent34951ATrigger_get_ClockSource)(BSTR ChannelList, Agilent34951AClockSourceEnum* val);
	STDMETHOD(IAgilent34951ATrigger_put_ClockSource)(BSTR ChannelList, Agilent34951AClockSourceEnum val);
	STDMETHOD(IAgilent34951ATrigger_get_ClockPeriod)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951ATrigger_put_ClockPeriod)(BSTR ChannelList, double val);

	// IAgilent34951AVoltage
	STDMETHOD(IAgilent34951AVoltage_Configure)(BSTR ChannelList, double Level);
	STDMETHOD(IAgilent34951AVoltage_get_Gain)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951AVoltage_put_Gain)(BSTR ChannelList, double val);
	STDMETHOD(IAgilent34951AVoltage_get_Level)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951AVoltage_put_Level)(BSTR ChannelList, double val);
	STDMETHOD(IAgilent34951AVoltage_get_Offset)(BSTR ChannelList, double* val);
	STDMETHOD(IAgilent34951AVoltage_put_Offset)(BSTR ChannelList, double val);

};

