Initial commit

This commit is contained in:
Roland Winklmeier
2013-02-15 18:50:17 +01:00
parent 57214c1c1e
commit 584251e0a8
125 changed files with 10640 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
FILE(GLOB sample_com_client_SOURCES *.cpp)
SET(sample_com_client_HEADERS client.h)
QT4_WRAP_CPP(sample_com_client_HEADERS_MOC ${sample_com_client_HEADERS})
ADD_EXECUTABLE(sample_com_client ${sample_com_client_SOURCES} ${sample_com_client_HEADERS_MOC})
TARGET_LINK_LIBRARIES(sample_com_client blackmisc ${QT_LIBRARIES})
SET_TARGET_PROPERTIES(sample_com_client PROPERTIES PROJECT_LABEL "Samples - Com client")

View File

@@ -0,0 +1,36 @@
#include <blackmisc/debug.h>
#include "client.h"
#include <blackmisc/message.h>
using namespace BlackMisc;
Client::Client(QObject *parent) : QObject(parent)
{
connect(&comclient, SIGNAL(doError(QAbstractSocket::SocketError,QString)), this, SLOT(onError(QAbstractSocket::SocketError,QString)));
connect(&comclient, SIGNAL(doConnected()), this, SLOT(onClientConnected()));
QString address = "127.0.0.1";
comclient.connectTo(address, 6809);
}
Client::~Client()
{
}
void Client::onError(QAbstractSocket::SocketError error, QString message)
{
bWarning << "Socket error!";
}
void Client::onClientConnected()
{
QByteArray message_data;
QDataStream out(&message_data, QIODevice::WriteOnly);
IMessage* testmsg = new TestMessage();
*testmsg >> out;
comclient.sendMessage(testmsg->getID(), message_data);
delete testmsg;
}

View File

@@ -0,0 +1,19 @@
#include <blackmisc/message_system.h>
#include <blackmisc/com_client.h>
class Client : public QObject
{
Q_OBJECT
public:
explicit Client(QObject *parent = NULL);
~Client();
protected slots:
void onError(QAbstractSocket::SocketError,QString);
void onClientConnected();
private:
BlackMisc::CComClient comclient;
};

View File

@@ -0,0 +1,16 @@
#include <QApplication>
#include <blackmisc/context.h>
#include "client.h"
using namespace BlackMisc;
int main(int argc, char *argv[])
{
BlackMisc::CApplicationContext myApplicationContext;
QApplication a(argc, argv);
Client client;
return a.exec();
}