/QMK-Groundstation/branches/libMK/Classes/cConnection.cpp |
---|
23,9 → 23,9 |
i_Type = 0; |
TTY = new ManageSerialPort(); |
o_Timer = new QTimer(this); |
//o_Timer = new QTimer(this); |
connect(o_Timer, SIGNAL(timeout()), SLOT(slot_Timer())); |
//connect(o_Timer, SIGNAL(timeout()), SLOT(slot_Timer())); |
TTY->setBaudRate(BAUD57600); //BaudRate |
TTY->setDataBits(DATA_8); //DataBits |
242,7 → 242,7 |
void cConnection::stop_ReSend() |
{ |
o_Timer->stop(); |
//o_Timer->stop(); |
} |
void cConnection::slot_Timer() |
/QMK-Groundstation/branches/libMK/Classes/cConnection.h |
---|
46,7 → 46,7 |
private: |
ManageSerialPort *TTY; |
QTcpSocket *TcpSocket; |
QTimer *o_Timer; |
//QTimer *o_Timer; |
QByteArray s_ReSend; |
/QMK-Groundstation/branches/libMK/Forms/dlg_MotorMixer.cpp |
---|
77,7 → 77,7 |
// Motordaten übernehmen. |
//FIXME: put this in libMK/Handler.cpp and fill motor values in KopterData |
/* |
void dlg_MotorMixer::set_MotorConfig(char * data) |
{ |
int Pos = 0; |
97,7 → 97,7 |
set_MotorData(); |
} |
*/ |
// Motordaten aus GUI übernehmen |
void dlg_MotorMixer::get_MotorData() |
{ |
/QMK-Groundstation/branches/libMK/eeepc.pro |
---|
8,7 → 8,3 |
INCLUDEPATH += $(HOME)/include /usr/include/qwt-qt4 |
include(global.pri) |
HEADERS += testing/LibMKTest.h |
SOURCES += testing/LibMKTest.cpp |
/QMK-Groundstation/branches/libMK/libMK/Parser.h |
---|
8,14 → 8,7 |
* The Parser gets values from the Mikrokopter-USART interface |
* and parses them into a sRxData-Struct |
*/ |
/* |
struct sRxData |
{ |
char *input; |
int decode[150]; |
int decLen; |
}; |
*/ |
class Parser { |
public: |
static void create_frame(char cmd, int address, char * data, unsigned int length); |
/QMK-Groundstation/branches/libMK/libMK/QTSerialCommunication.cpp |
---|
6,6 → 6,7 |
* initiate connection and stuff |
*/ |
QTSerialCommunication::QTSerialCommunication() { |
connection_lost(); |
serial = new ManageSerialPort(); |
serial->setBaudRate(BAUD57600); //BaudRate |
serial->setDataBits(DATA_8); //DataBits |
39,6 → 40,11 |
}; |
/** |
* received new data from MK |
*/ |
/** |
* send command to Mikrokopter |
*/ |
void QTSerialCommunication::send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend) { |
45,10 → 51,14 |
if (is_connected()) { |
Parser::create_frame(cmd, address, data, length); |
if (resend) { |
//FIXME: start timer...? |
//resend evrey 2 seconds |
resendTimer.start(2000); |
resendData = data; |
} |
QByteArray temp(data); |
serial->sendData(temp); |
} else { |
//FIXME: Error message: not connected |
} |
}; |
58,4 → 68,10 |
*/ |
void QTSerialCommunication::stop_resend() { |
}; |
}; |
/** |
* resend timer timout |
*/ |
void QTSerialCommunication::slot_resend_timer() { |
} |
/QMK-Groundstation/branches/libMK/libMK/QTSerialCommunication.h |
---|
1,5 → 1,7 |
#ifndef QT_SERIAL_COMMUNICATION_H |
#define QT_SERIAL_COMMUNICATION_H |
#include <QObject> |
#include <QTimer> |
#include "Communication.h" |
#include "../SerialPort/ManageSerialPort.h" |
11,14 → 13,24 |
* ( philippe.vianney.liaud gmail.com ) |
*/ |
using namespace std; |
class QTSerialCommunication : public Communication, QObject { |
Q_OBJECT |
class QTSerialCommunication : public Communication { |
private: |
//timer to resend data if necessary |
QTimer resendTimer; |
//data that will be resended if the timer |
//got the timeout |
char * resendData; |
//Serial Port connection class by Philippe VIANNEY-LIAUD |
ManageSerialPort * serial; |
private slots: |
void slot_resend_timer(); |
public: |
QTSerialCommunication(); |
void connect_MK(char * addr); |
void received_data(char * data); |
void send_cmd(char cmd, int address, char data[150], unsigned int length, bool resend); |
void stop_resend(); |
}; |