#ifndef QPICONNECTION_H
#define QPICONNECTION_H

#include <QObject>
#include <QMetaObject>
#include "piconnection.h"
#include "qpiconfig.h"
#include "piqt.h"

class QPIConnection: public QObject, public PIConnection {
	Q_OBJECT
	PIOBJECT_SUBCLASS(QPIConnection, PIConnection)
public:
	QPIConnection(const QString & name = QString());
	
	bool loadFromCMFile(const QString & file);
	
protected:
	void propertyChanged(const PIString & ) {setObjectName(PI2QString(name()));}
	EVENT_HANDLER2(void, piDataRec, const PIString &, from, const PIByteArray &, data);
	EVENT_HANDLER2(void, piPacketRec, const PIString &, from, const PIByteArray &, data);
	
public slots:
	
signals:
	void qDataReceivedEvent(QString from, QByteArray data);
	void qPacketReceivedEvent(QString from, QByteArray data);
	
};

#endif // QPICONNECTION_H
