///////////////////////////////////////////////////////////////////////////////
// ModuleDevice.h
#pragma once

#include "PMCDeviceInterfaces.h"
#include "TcFileAccessInterfaces.h"
class CModuleDevice 
	: public ITComObject
	, public ITcADI
	, public ITcWatchSource
///<AutoGeneratedContent id="InheritanceList">
	, public ITcCyclic
///</AutoGeneratedContent>
{
public:
	DECLARE_IUNKNOWN()
	DECLARE_IPERSIST(CID_PMCDeviceCModuleDevice)
	DECLARE_ITCOMOBJECT_LOCKOP()
	DECLARE_ITCADI()
	DECLARE_ITCWATCHSOURCE()
	DECLARE_OBJPARAWATCH_MAP()
	DECLARE_OBJDATAAREA_MAP()

	CModuleDevice();
	virtual	~CModuleDevice();


///<AutoGeneratedContent id="InterfaceMembers">
	// ITcCyclic
	virtual HRESULT TCOMAPI CycleUpdate(ITcTask* ipTask, ITcUnknown* ipCaller, ULONG_PTR context);

///</AutoGeneratedContent>

protected:
	DECLARE_ITCOMOBJECT_SETSTATE();

	HRESULT AddModuleToCaller();
	VOID RemoveModuleFromCaller();

	// Tracing
	CTcTrace m_Trace;

///<AutoGeneratedContent id="Members">
	TcTraceLevel m_TraceLevelMax;
	ModuleDeviceParameter m_Parameter;
	USHORT m_LoggerPort;
	ModuleDeviceNDI m_NDI;
	ModuleDeviceSDI m_SDI;
	ModuleDeviceAI m_AI;
	ModuleDeviceNDO m_NDO;
	ModuleDeviceSDO m_SDO;
	ModuleDeviceAO m_AO;
	ITcCyclicCallerInfoPtr m_spCyclicCaller;
	ITcUnknownPtr m_spAsyncFileAccessor;
///</AutoGeneratedContent>

	// TODO: Custom variable
	UINT m_counter;
public:

	HRESULT SendClientData(unsigned long socketId, unsigned long nData, void* pData, unsigned long& nSendData);
};
