/********************************************/
/* Written by David Yates                   */
/* Copyright Siemens Business Services 2007 */
/********************************************/
#if !defined(AFX_BNCS_MULTICAST_H__5A0FE84C_95BC_45BB_8FB9_EE8D060550B0__INCLUDED_)
#define AFX_BNCS_MULTICAST_H__5A0FE84C_95BC_45BB_8FB9_EE8D060550B0__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
 
#include <qobject.h>
#include <qhostaddress.h>

class QSocketNotifier;
class QSocketDevice;
class bncs_textCallback;

class bncs_multicast  : public QObject
{
	Q_OBJECT
public:
	bncs_multicast( const QString & address, int port, const QString & bindAddress = QString::null );
	bncs_multicast();
	virtual ~bncs_multicast();

	bool enableRx( bool enable );
	void setMulticastParams( const QString & address, int port, const QString & bindAddress= QString::null  );

	virtual void rx( const char*, int len );
	bool tx( const char*, int len );
	void setCallback( bncs_textCallback * cb );

private:
	QHostAddress m_address;
	QHostAddress m_bindAddress;
	int m_port;
	bncs_textCallback *m_callback;

	QSocketNotifier * m_notifier;
	QSocketDevice * m_socket;


public slots:
	void rxdata( int i );
};

#endif // !defined(AFX_BNCS_MULTICAST_H__5A0FE84C_95BC_45BB_8FB9_EE8D060550B0__INCLUDED_)
