diff options
| author | Niklas | 2011-07-11 16:51:30 +0200 |
|---|---|---|
| committer | Niklas | 2011-07-11 16:51:30 +0200 |
| commit | fdae19c238de3a66c3aeaca45ce2e96ceda7cbf2 (patch) | |
| tree | 22252d5050b8a1cab99f5571ef8b0a73bb94fa01 /workspace/LogWriter | |
| parent | added the two tryout with a qt LogReceiver and a c code client (diff) | |
| download | fbgui-fdae19c238de3a66c3aeaca45ce2e96ceda7cbf2.tar.gz fbgui-fdae19c238de3a66c3aeaca45ce2e96ceda7cbf2.tar.xz fbgui-fdae19c238de3a66c3aeaca45ce2e96ceda7cbf2.zip | |
updated the LogReceiver and LogWriter. we are now able to send and receive Status SubStatus and msg messages.
Diffstat (limited to 'workspace/LogWriter')
| -rwxr-xr-x | workspace/LogWriter/LogWriter | bin | 30747 -> 35093 bytes | |||
| -rw-r--r-- | workspace/LogWriter/LogWriter.pro | 17 | ||||
| -rw-r--r-- | workspace/LogWriter/logwriter.cpp | 33 | ||||
| -rw-r--r-- | workspace/LogWriter/logwriter.h | 3 |
4 files changed, 40 insertions, 13 deletions
diff --git a/workspace/LogWriter/LogWriter b/workspace/LogWriter/LogWriter Binary files differindex bfcb726..54d4ab8 100755 --- a/workspace/LogWriter/LogWriter +++ b/workspace/LogWriter/LogWriter diff --git a/workspace/LogWriter/LogWriter.pro b/workspace/LogWriter/LogWriter.pro index 112fd84..ba5df47 100644 --- a/workspace/LogWriter/LogWriter.pro +++ b/workspace/LogWriter/LogWriter.pro @@ -1,10 +1,11 @@ TEMPLATE = app -TARGET = LogWriter - -QT += core gui network - -HEADERS += logwriter.h -SOURCES += main.cpp \ +TARGET = LogWriter +QT += core \ + gui \ + network +HEADERS += status.h \ + logwriter.h +SOURCES += main.cpp \ logwriter.cpp -FORMS += logwriter.ui -RESOURCES += +FORMS += logwriter.ui +RESOURCES += diff --git a/workspace/LogWriter/logwriter.cpp b/workspace/LogWriter/logwriter.cpp index 53a4023..94155ed 100644 --- a/workspace/LogWriter/logwriter.cpp +++ b/workspace/LogWriter/logwriter.cpp @@ -9,6 +9,7 @@ #include <QtNetwork> #include "logwriter.h" +#include "status.h" LogWriter::LogWriter(QWidget *parent) : QDialog(parent) { @@ -86,12 +87,34 @@ void LogWriter::enableWriteButton() { } void LogWriter::writeToLogReceiver() { + writeToLogReceiver(STAT_OK,DISCOVER); +} + +void LogWriter::writeToLogReceiver(int stat, int sub_stat) { + char * st = (char *) malloc(sizeof(int)*4+1); + char * sst = (char *) malloc(sizeof(int)*4+1); + sprintf(st,"%d", stat); + sprintf(sst,"%d",sub_stat); + char * msg = "msg test"; + int msize = strlen(st) + strlen(sst) + strlen(msg) + 3; + char * m = (char *) malloc(msize); + strcpy(m, ""); + strcat(m, st); + strcat(m, ";"); + strcat(m, sst); + strcat(m, ";"); + strcat(m, msg); //char buffer[256]; - char *b = "test"; - qDebug() << strlen(b); - int n = ::write(sockfd,b,strlen(b)); - if (n < 0) - qDebug() <<"ERROR writing to socket"; + //char *b = "test"; + qDebug() << strlen(m); + qDebug() << m; + int n = ::write(sockfd, m, strlen(m)); + if (n < 0) + qDebug() << "ERROR writing to socket"; + + free(st); + free(sst); + free(m); } diff --git a/workspace/LogWriter/logwriter.h b/workspace/LogWriter/logwriter.h index 1646433..a4ddea3 100644 --- a/workspace/LogWriter/logwriter.h +++ b/workspace/LogWriter/logwriter.h @@ -4,6 +4,7 @@ #include <QtGui/QDialog> #include <qlocalsocket.h> #include "ui_logwriter.h" +#include "status.h" class QDialogButtonBox; class QLabel; @@ -26,6 +27,8 @@ private slots: void writeToLogReceiver(); private: + // enum STATUS stat, enum SUBSTATUS sub_stat + void writeToLogReceiver(int stat, int sub_stat); Ui::LogWriterClass ui; QLabel *hostLabel; QLineEdit *hostLineEdit; |
