//******************************************************************************
//
// Restricted Rights
// WARNING: This is a restricted distribution Zeligsoft file.
//
//******************************************************************************
//
// Copyright (C) 2006 Zeligsoft Inc. - All Rights Reserved
//

//******************************************************************************
//
//     FILE: zceAssemblyControllerWorker.h
//
//******************************************************************************

#ifndef __ZCEASSEMBLYCONTROLLERWORKER_H
#define __ZCEASSEMBLYCONTROLLERWORKER_H


#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <string>

#include "PortTypes.h"

#include "zceOperatingEnvironment.h"

#include "zceAssemblyControllerServant.h"


#include "zceCF_ResourceUsesPort.h"
#include "zceCF_DeviceUsesPort.h"

using namespace std;

class zceAssemblyControllerWorker
{

	public:
	    void setAudioDeviceRunningStatus();

		zceAssemblyControllerWorker( const AssemblyController_params& execParams , zceCF_ResourceUsesPort* portSendReceiveData, zceCF_DeviceUsesPort* portAudioDevice, zceCF_ResourceUsesPort* portProcessRx, zceCF_ResourceUsesPort* portProcessTx, zceCF_ResourceUsesPort* portCaptureData, zceCF_ResourceUsesPort* portWriteData, zceCF_ResourceUsesPort* portReadData, zceCF_ResourceUsesPort* portPlayData ZCE_EXC_ENV_ARG );

		virtual ~zceAssemblyControllerWorker();

		void setportSendReceiveData( zceCF_ResourceUsesPort& portSendReceiveData );

		void setportAudioDevice( zceCF_DeviceUsesPort& portAudioDevice );

		void setportProcessRx( zceCF_ResourceUsesPort& portProcessRx );

		void setportProcessTx( zceCF_ResourceUsesPort& portProcessTx );

		void setportCaptureData( zceCF_ResourceUsesPort& portCaptureData );

		void setportWriteData( zceCF_ResourceUsesPort& portWriteData );

		void setportReadData( zceCF_ResourceUsesPort& portReadData );

		void setportPlayData( zceCF_ResourceUsesPort& portPlayData );

		void initExecParams( const AssemblyController_params& params ZCE_EXC_ENV_ARG);

		void config_propQoS( const CORBA::Long& propqos ZCE_EXC_ENV_ARG );

		void config_propDestinationId( const CORBA::String_var& propdestinationid ZCE_EXC_ENV_ARG );

		void config_propModulation( const CORBA::Long& propmodulation ZCE_EXC_ENV_ARG );

		void config_propInputFilePath( const CORBA::String_var& propinputfilepath ZCE_EXC_ENV_ARG );

		void config_propApplicationType( const CORBA::Long& propapplicationtype ZCE_EXC_ENV_ARG );


		void query_propQoS( CORBA::Long& propqos ZCE_EXC_ENV_ARG );

		void query_propDestinationId( CORBA::String_var& propdestinationid ZCE_EXC_ENV_ARG );

		void query_propModulation( CORBA::Long& propmodulation ZCE_EXC_ENV_ARG );

		void query_propInputFilePath( CORBA::String_var& propinputfilepath ZCE_EXC_ENV_ARG );

		void query_propApplicationType( CORBA::Long& propapplicationtype ZCE_EXC_ENV_ARG );



		/*!	\brief
		 *
		 *	 Describe operation here.
		 *
		 *	\throw ::CF::LifeCycle::InitializeError
		 *
		 */
		virtual void CF_LifeCycle_initialize( int portIdentifier ZCE_EXC_ENV_ARG );

		/*!	\brief
		 *
		 *	 Describe operation here.
		 *
		 *	\throw ::CF::LifeCycle::ReleaseError
		 *
		 */
		virtual void CF_LifeCycle_releaseObject( int portIdentifier ZCE_EXC_ENV_ARG );

		/*!
		 * \brief The start operation is provided to command a Resource implementing this
		 * interface to start internal processing.
		 *
		 * Specification reference:  3.1.3.1.6.5.2
		 *
		 * The start operation puts the Resource in an operating condition.
		 *
		 * \return This operation does not return a value.
		 *
		 * \throw StartError The start operation shall raise the StartError exception if
		 * an error occurs while starting the resource.
		 *
		 */
		virtual void CF_Resource_start( int portIdentifier ZCE_EXC_ENV_ARG );

		/*!
		 * \brief The stop operation is provided to command a Resource implementing this
		 * interface to stop internal processing.
		 *
		 * Specification reference:  3.1.3.1.6.5.1
		 *
		 * The stop operation shall disable all current operations and put the Resource in
		 * a non-operating condition. Subsequent configure, query, and start operations
		 * are not inhibited by the stop operation.
		 *
		 * \return This operation does not return a value.
		 *
		 * \throw StopError The stop operation shall raise the StopError exception if an
		 * error occurs while stopping the resource.
		 *
		 */
		virtual void CF_Resource_stop( int portIdentifier ZCE_EXC_ENV_ARG );


		#if defined(DEBUG_MSGS)
		void setDebugStream(const std::ostream& stream);

		void debugMsg(const std::string&);
		#endif

	private:
		zceCF_ResourceUsesPort* portSendReceiveData_;

		zceCF_DeviceUsesPort* portAudioDevice_;

		zceCF_ResourceUsesPort* portProcessRx_;

		zceCF_ResourceUsesPort* portProcessTx_;

		zceCF_ResourceUsesPort* portCaptureData_;

		zceCF_ResourceUsesPort* portWriteData_;

		zceCF_ResourceUsesPort* portReadData_;

		zceCF_ResourceUsesPort* portPlayData_;


		AssemblyController_params execParams_;

		CORBA::String_var mPropDestinationId; ///< DestinationId property (Ex. 00905551112233)
		CORBA::Long mPropApplicationType; ///< ApplicationType property (0 = voice, 1 = data)
		CORBA::Long mPropQoS; ///< Quality of Service property (Between 1 and 5)
        CORBA::Long mPropModulation; ///< Modulation type property (Any long value)
        CORBA::String_var mPropInputFilePath; ///< Input file that will be read by ReadData component

		#if defined(DEBUG_MSGS)
		std::ostream debug_;
		#endif

};
#endif     // __ZCEASSEMBLYCONTROLLERWORKER_H

// End-Of-File
//------------------------------------------------------------------------------
