/QMK-Groundstation/trunk/Global/Kopter.h |
---|
24,9 → 24,9 |
#include <stdint.h> |
#ifdef _BETA_ |
static const QString QA_HWVERSION = "FlightCtrl v0.76e & NaviCtrl v0.17e"; |
static const QString QA_HWVERSION = "FlightCtrl v0.78f & NaviCtrl v0.18c"; |
#else |
static const QString QA_HWVERSION = "FlightCtrl v0.76e & NaviCtrl v0.17e"; |
static const QString QA_HWVERSION = "FlightCtrl v0.78f & NaviCtrl v0.18c"; |
#endif |
// Datenfeld-ID's |
/QMK-Groundstation/trunk/Global/MK_Datatypes.h |
---|
22,18 → 22,18 |
#include <stdint.h> |
#ifdef _BETA_ |
static const int MK_VERSION_SETTINGS = 80; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
static const int MK_VERSION_SETTINGS = 82; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
#else |
static const int MK_VERSION_SETTINGS = 80; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
static const int MK_VERSION_SETTINGS = 82; // wird angepasst, wenn sich die EEPROM-Daten ge�ndert haben |
#endif |
static const int MK_VERSION_NAVI = 2; // wird angepasst, wenn sich die Mixer-Daten ge�ndert haben |
static const int MK_VERSION_NAVI = 3; // wird angepasst, wenn sich die Navi-Daten ge�ndert haben |
static const int MK_VERSION_MIXER = 1; // wird angepasst, wenn sich die Mixer-Daten ge�ndert haben |
static const int MK_MAX_MOTOR = 16; // Maximale Anzahl der Motoren im Mixer |
// Version des Seriellen Protokoll |
static const int VERSION_SERIAL_MAJOR = 10; |
static const int VERSION_SERIAL_MAJOR = 11; |
static const int VERSION_SERIAL_MINOR = 0; |
// Basis-Addressen der verschiedenen Hardware |
71,6 → 71,26 |
#define CFG2_VARIO_BEEP 0x02 |
#define CFG_SENSITIVE_RC 0x04 |
struct s_MK_Debug |
{ |
unsigned char Digital[2]; |
int16_t Analog[32]; // Debugwerte |
}; |
struct s_MK_DebugLabels |
{ |
int Position; |
QString Text; |
}; |
//typedef int16_t s_MK_PPM_Data[26]; |
struct s_MK_PPM_Data |
{ |
int16_t Data[26]; |
}; |
struct s_MK_Settings |
{ |
// Die ersten beiden Bytes nicht an den MK senden. |
77,7 → 97,7 |
unsigned char Index; |
unsigned char Version; |
unsigned char Kanalbelegung[8]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
unsigned char Kanalbelegung[12]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
unsigned char GlobalConfig; // 0x01=H�henregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
unsigned char Hoehe_MinGas; // Wert : 0-100 |
unsigned char Luftdruck_D; // Wert : 0-250 |
98,12 → 118,12 |
unsigned char Gyro_P; // Wert : 10-250 |
unsigned char Gyro_I; // Wert : 0-250 |
unsigned char Gyro_D; // Wert : 0-250 |
unsigned char Gyro_Gier_P; // Wert : 10-250 |
unsigned char Gyro_Gier_I; // Wert : 0-250 |
unsigned char Gyro_Gier_P; // Wert : 10-250 |
unsigned char Gyro_Gier_I; // Wert : 0-250 |
unsigned char UnterspannungsWarnung; // Wert : 0-250 |
unsigned char NotGas; // Wert : 0-250 //Gaswert bei Emp�ngsverlust |
unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
unsigned char UfoAusrichtung; // X oder + Formation |
unsigned char Receiver; // 0= Summensignal, 1= Spektrum, 2 =Jeti, 3=ACT DSL, 4=ACT S3D |
unsigned char I_Faktor; // Wert : 0-250 |
unsigned char UserParam1; // Wert : 0-250 |
unsigned char UserParam2; // Wert : 0-250 |
119,7 → 139,10 |
unsigned char ServoRollMin; // Wert : 0-250 |
unsigned char ServoRollMax; // Wert : 0-250 |
//--- |
unsigned char ServoNickRefresh; // |
unsigned char ServoNickRefresh; // Speed of the Servo |
unsigned char Servo3; // Value or mapping of the Servo Output |
unsigned char Servo4; // Value or mapping of the Servo Output |
unsigned char Servo5; // Value or mapping of the Servo Output |
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas w�hrend Looping |
unsigned char LoopThreshold; // Wert: 0-250 Schwelle f�r Stickausschlag |
unsigned char LoopHysterese; // Wert: 0-250 Hysterese f�r Stickausschlag |
167,6 → 190,7 |
unsigned char ServoCompInvert; // // 0x01 = Nick, 0x02 = Roll 0 oder 1 // WICHTIG!!! am Ende lassen |
unsigned char ExtraConfig; // bitcodiert |
char Name[12]; |
}; |
struct s_MK_Mixer |
237,6 → 261,9 |
uint8_t RC_RSSI; // Receiver signal strength (since version 2 added) |
int16_t SetpointAltitude; // setpoint for altitude |
uint8_t Gas; // for future use |
uint16_t Current; // actual current in 0.1A steps |
uint16_t UsedCapacity; // used capacity in mAh |
} __attribute__((packed)) s_MK_NaviData; |
typedef struct |
/QMK-Groundstation/trunk/Global/Widget_Connection/wgt_Connection.cpp |
---|
0,0 → 1,541 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#include <QSettings> |
#include <QMessageBox> |
#include <QCryptographicHash> |
#include "wgt_Connection.h" |
wgt_Connection::wgt_Connection(QWidget *parent) : QWidget(parent) |
{ |
setupUi(this); |
o_Input = new Input(); |
o_AboTimer = new QTimer(); |
o_AboTimer->setInterval(3500); |
connect(btn_Connect, SIGNAL(clicked()), this, SLOT(slot_btn_Connect())); |
connect(sb_Intervall, SIGNAL(valueChanged(int)), this, SLOT(slot_sb_Intervall(int))); |
connect(o_AboTimer, SIGNAL(timeout()), this, SLOT(slot_TimeOut_AboTimer())); |
} |
void wgt_Connection::read_Settings() |
{ |
QSettings Setting("QMK", "QMK-Connection"); |
Setting.beginGroup("DATA"); |
SERVER.Intervall = Setting.value(QString("Intervall_%1").arg(gi_ID), 500).toInt(); |
Setting.endGroup(); |
Setting.beginGroup("SERVER"); |
SERVER.Password = Setting.value("Password", QString("")).toString(); |
SERVER.IP_MAX = Setting.value("IP_MAX", 1).toInt(); |
SERVER.IP_ID = Setting.value("IP_ID", 0).toInt(); |
for (int z = 0; z < SERVER.IP_MAX; z++) |
{ |
SERVER.IP[z] = Setting.value("IP_" + QString("%1").arg(z), QString("127.0.0.1:64400")).toString(); |
} |
Setting.endGroup(); |
for(int z = 0; z < SERVER.IP_MAX; z++) |
{ |
if (cb_Server->findText(SERVER.IP[z]) == -1) |
{ |
cb_Server->addItem(SERVER.IP[z]); |
} |
} |
cb_Server->setCurrentIndex(SERVER.IP_ID); |
le_Password->setText(SERVER.Password); |
sb_Intervall->setValue(SERVER.Intervall); |
} |
void wgt_Connection::write_Settings() |
{ |
SERVER.Intervall = sb_Intervall->value(); |
SERVER.Password = le_Password->text(); |
SERVER.IP_MAX = cb_Server->count(); |
SERVER.IP_ID = cb_Server->currentIndex(); |
for (int z = 0; z < cb_Server->count(); z++) |
{ |
if (z < 10) |
{ |
SERVER.IP[z] = cb_Server->itemText(z); |
} |
} |
QSettings Setting("QMK", "QMK-Connection"); |
Setting.beginGroup("DATA"); |
Setting.setValue(QString("Intervall_%1").arg(gi_ID), SERVER.Intervall); |
Setting.endGroup(); |
Setting.beginGroup("SERVER"); |
Setting.setValue("Password", SERVER.Password); |
Setting.setValue("IP_MAX", SERVER.IP_MAX); |
Setting.setValue("IP_ID", SERVER.IP_ID); |
for (int z = 0; z < SERVER.IP_MAX; z++) |
{ |
Setting.setValue("IP_" + QString("%1").arg(z), SERVER.IP[z]); |
} |
Setting.endGroup(); |
} |
void wgt_Connection::set_Client(int li_ID, QString ls_Client, QString ls_Fields) |
{ |
gi_Interval[0] = false; |
gi_Interval[1] = false; |
gs_Client = ls_Client; |
gs_Fields = ls_Fields; |
gi_ID = li_ID; |
if (ls_Fields.contains('D')) |
gi_Interval[0] = true; |
if (ls_Fields.contains('O')) |
gi_Interval[1] = true; |
read_Settings(); |
} |
void wgt_Connection::set_SelectVisible(bool pi_Visible) |
{ |
wg_Select->setVisible(pi_Visible); |
} |
void wgt_Connection::set_IntervalVisible(bool pi_Visible) |
{ |
wg_Interval->setVisible(pi_Visible); |
} |
void wgt_Connection::set_ButtonVisible(bool pi_Visible) |
{ |
btn_Connect->setVisible(pi_Visible); |
} |
void wgt_Connection::send_Data(QString ps_Data, int pi_ID) |
{ |
o_Input->send_Data(ps_Data, pi_ID); |
} |
// MK-Eingangsdaten verarbeiten |
void wgt_Connection::parse_MK_Data(QString t_Data) |
{ |
unsigned char OutData[200]; |
char *InData = t_Data.toLatin1().data(); |
if (HandlerMK::Decode_64(InData, t_Data.length(), OutData) != 0) |
{ |
switch(InData[2]) |
{ |
case 'A' : // Analog-Labels |
{ |
o_Input->stop_Resend(DATA_READ_LABEL); |
s_MK_DebugLabels MK_DebugLabels; |
MK_DebugLabels.Position = OutData[0]; |
if (MK_DebugLabels.Position < 32) |
{ |
MK_DebugLabels.Text = HandlerMK::Data2QString(OutData,1,17).trimmed(); |
if (MK_DebugLabels.Text == "") |
{ |
MK_DebugLabels.Text = "Debug-" + QString("%1").arg(MK_DebugLabels.Position); |
} |
if (((MK_DebugLabels.Position + 1) < 32))// && (get_Analoglabels == true)) |
{ |
c_Data[0] = MK_DebugLabels.Position + 1; |
o_Input->send_Data(HandlerMK::make_Frame('a', ADDRESS_ALL, c_Data, 1).toLatin1().data(), DATA_READ_LABEL); |
} |
emit(sig_MK_DebugLabels(MK_DebugLabels)); |
} |
} |
break; |
case 'D' : // Debug-Daten |
{ |
s_MK_Debug MK_Debug; |
memcpy((unsigned char *)&MK_Debug, (unsigned char *)&OutData, sizeof(MK_Debug)); |
emit(sig_MK_Debug(MK_Debug)); |
emit(sig_RawData(t_Data)); |
} |
break; |
case 'N' : // MotorMixer lesen |
{ |
o_Input->stop_Resend(DATA_READ_MIXER); |
s_MK_Mixer MK_Mixer; |
memcpy((unsigned char *)&MK_Mixer, (unsigned char *)&OutData, sizeof(MK_Mixer)); |
emit (sig_MK_ReadMotorMixer(MK_Mixer)); |
} |
break; |
case 'M' : // MotorMixer geschrieben |
{ |
o_Input->stop_Resend(DATA_WRITE_MIXER); |
emit (sig_MK_WriteMotorMixer(OutData[0])); |
} |
break; |
case 'O' : // Navi-OSD-Data |
{ |
if (InData[1] - 'a' == ADDRESS_NC) |
{ |
s_MK_NaviData MK_NaviData; |
memcpy((unsigned char *)&MK_NaviData, (unsigned char *)&OutData, sizeof(MK_NaviData)); |
if (MK_NaviData.Version == MK_VERSION_NAVI) |
{ |
emit(sig_MK_NaviData(MK_NaviData)); |
emit(sig_RawData(t_Data)); |
} |
} |
} |
break; |
case 'P' : // RC-Kanäle |
{ |
s_MK_PPM_Data PPM_in; |
memcpy((unsigned char *)&PPM_in, (unsigned char *)&OutData, sizeof(PPM_in)); |
// qDebug() << PPM_in[0] << ", " << PPM_in[1] << ", " << PPM_in[2] << ", " << PPM_in[3]; |
emit(sig_MK_PPMData(PPM_in)); |
} |
break; |
case 'Q' : // Settings lesen |
{ |
o_Input->stop_Resend(DATA_READ_SETTINGS); |
s_MK_Settings MK_Set; |
memcpy((unsigned char *)&MK_Set, (unsigned char *)&OutData, sizeof(MK_Set)); |
emit (sig_MK_ReadSettings(MK_Set)); |
} |
break; |
case 'S' : // Settings geschrieben |
{ |
o_Input->stop_Resend(DATA_WRITE_SETTINGS); |
emit (sig_MK_WriteSettings(OutData[0])); |
} |
break; |
case 'V' : // Versions-Info |
{ |
o_Input->stop_Resend(DATA_VERSION); |
VersionInfo = HandlerMK::parse_Version(OutData, InData[1] - 'a'); |
if (VersionInfo.ID == ADDRESS_FC) |
{ |
rb_FC->setChecked(true); |
} |
if (VersionInfo.ID == ADDRESS_NC) |
{ |
rb_NC->setChecked(true); |
} |
if (VersionInfo.ID == ADDRESS_MK3MAG) |
{ |
rb_MK3MAG->setChecked(true); |
} |
slot_sb_Intervall(sb_Intervall->value()); |
emit sig_MK_Version(VersionInfo); |
} |
break; |
case 'W' : // WayPoints |
{ |
o_Input->stop_Resend(DATA_WRITE_WAYPOINT); |
emit(sig_MK_WayPoint(OutData[0])); |
} |
break; |
} |
} |
} |
// IP-Daten verarbeiten.. |
void wgt_Connection::parse_IP_Data(QString t_Data) |
{ |
QStringList Data; |
Data = t_Data.split(":"); |
if (Data.count() > 1) |
{ |
int CMD = Data[2].toInt(); |
switch(CMD) |
{ |
case 101 : |
{ |
o_Input->send_Data(HandlerIP::make_Frame(gi_ID, 101, gs_Client)); |
} |
break; |
case 502 : |
{ |
switch (Data[3].toInt()) |
{ |
case 105 : |
{ |
QString s_MD5PW; |
QByteArray a_MD5PW; |
a_MD5PW = QCryptographicHash::hash(le_Password->text().toAscii(),QCryptographicHash::Md5); |
s_MD5PW = QString(a_MD5PW.toHex().data()); |
o_Input->send_Data(HandlerIP::make_Frame(gi_ID, 105, s_MD5PW)); |
} |
break; |
case 106 : |
{ |
o_Input->send_Data(HandlerIP::make_Frame(gi_ID, 106, gs_Fields)); |
} |
break; |
} |
} |
break; |
case 505 : |
{ |
if (Data[3] == "OK") |
{ |
} |
else |
{ |
QMessageBox::warning(this, gs_Client, trUtf8("Authentifizierung fehlgeschlagen. <br />Daten senden zum Mikrokopter nicht möglich."), QMessageBox::Ok); |
} |
} |
break; |
} |
} |
} |
// Datenintervall geändert. |
void wgt_Connection::slot_sb_Intervall(int t_Intervall) |
{ |
if (t_Intervall == 0) |
{ |
c_Data[0] = 0; |
} |
else |
{ |
c_Data[0] = t_Intervall / 10; |
} |
// if (wg_Interval->isVisible()) |
{ |
if (gi_Interval[0]) |
{ |
o_Input->send_Data(HandlerMK::make_Frame('d', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
} |
if (gi_Interval[1]) |
{ |
o_Input->send_Data(HandlerMK::make_Frame('o', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
} |
} |
} |
void wgt_Connection::slot_send_Data(QString ps_Data, int pi_ID) |
{ |
send_Data(ps_Data, pi_ID); |
} |
void wgt_Connection::slot_TimeOut_AboTimer() |
{ |
// qDebug("Timer"); |
slot_sb_Intervall(sb_Intervall->value()); |
} |
void wgt_Connection::slot_btn_Connect() |
{ |
if (!o_Input->IsOpen()) |
{ |
if (cb_Server->findText(cb_Server->currentText()) == -1) |
{ |
cb_Server->addItem(cb_Server->currentText()); |
cb_Server->setCurrentIndex(cb_Server->findText(cb_Server->currentText())); |
} |
cb_Server->setEnabled(false); |
le_Password->setEnabled(false); |
if (cb_Server->currentText().startsWith('/')) |
{ |
o_Input = new Input_TTY(); |
o_Input->Init(); |
set_Input s_Input; |
s_Input.Main = cb_Server->currentText(); |
if (o_Input->Open(s_Input) == true) |
{ |
emit sig_Status(true); |
btn_Connect->setChecked(true); |
o_AboTimer->start(); |
connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
} |
else |
{ |
cb_Server->setEnabled(true); |
le_Password->setEnabled(true); |
} |
} |
else |
{ |
o_Input = new Input_TCP(); |
o_Input->Init(); |
set_Input s_Input; |
QStringList Server = cb_Server->currentText().split(":"); |
s_Input.Main = Server[0]; |
s_Input.Sub = Server[1]; |
if (o_Input->Open(s_Input) == true) |
{ |
connect(o_Input, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Input_Disconnected(int))); |
connect(o_Input, SIGNAL(sig_Connected()), this, SLOT(slot_Input_Connected())); |
} |
} |
} |
else |
{ |
cb_Server->setEnabled(true); |
le_Password->setEnabled(true); |
emit sig_Status(false); |
btn_Connect->setChecked(false); |
o_AboTimer->stop(); |
o_Input->Close(); |
disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
if (o_Input->Mode() == TCP) |
{ |
disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
} |
} |
} |
// Neue Daten empfangen. |
void wgt_Connection::slot_Input_Data(QString t_Data) |
{ |
if ((t_Data[0] == '#')) |
{ |
if ((HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length() - 1)) || ((o_Input->Mode() == TTY) && (HandlerMK::Check_CRC(t_Data.toLatin1().data(), t_Data.length())))) |
{ |
parse_MK_Data(t_Data); |
} |
else |
{ |
// qDebug(QString("CRC-Error - " + t_Data).toLatin1().data()); |
} |
} |
else if ((o_Input->Mode() == TCP) && (t_Data[0] == '$')) |
{ |
parse_IP_Data(t_Data); |
} |
} |
// Neue Serververbindung. |
void wgt_Connection::slot_Input_Connected() |
{ |
connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
emit sig_Status(true); |
btn_Connect->setChecked(true); |
o_AboTimer->start(); |
} |
// Serververbindung beendet |
void wgt_Connection::slot_Input_Disconnected(int Error) |
{ |
cb_Server->setEnabled(true); |
le_Password->setEnabled(true); |
disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
emit sig_Status(false); |
btn_Connect->setChecked(false); |
o_AboTimer->stop(); |
switch (Error) |
{ |
case REMOTECLOSED : |
{ |
// lb_Status->setText(tr("Verbindung vom Server beendet.")); |
QMessageBox::warning(this, gs_Client,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok); |
} |
break; |
case REFUSED : |
{ |
// lb_Status->setText(tr("Server nicht gefunden.")); |
QMessageBox::warning(this, gs_Client,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok); |
} |
break; |
case 3 : |
{ |
// lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch.")); |
QMessageBox::warning(this, gs_Client,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok); |
} |
break; |
default : |
{ |
// lb_Status->setText(tr("Getrennt vom QMK-Datenserver.")); |
} |
break; |
} |
} |
wgt_Connection::~wgt_Connection() |
{ |
write_Settings(); |
} |
/QMK-Groundstation/trunk/Global/Widget_Connection/wgt_Connection.h |
---|
0,0 → 1,114 |
/*************************************************************************** |
* Copyright (C) 2009 by Manuel Schrape * |
* manuel.schrape@gmx.de * |
* * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License. * |
* * |
* This program is distributed in the hope that it will be useful, * |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
* GNU General Public License for more details. * |
* * |
* You should have received a copy of the GNU General Public License * |
* along with this program; if not, write to the * |
* Free Software Foundation, Inc., * |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
***************************************************************************/ |
#ifndef WGT_CONNECTION_H |
#define WGT_CONNECTION_H |
#include <QWidget> |
#include <QTimer> |
#include "ui_wgt_Connection.h" |
#include "../../Global/Kopter.h" |
#include "../../Global/Class_HandlerIP/HandlerIP.h" |
#include "../../Global/Class_HandlerMK/HandlerMK.h" |
#include "../../Global/Class_Input/Input.h" |
#include "../../Global/Class_Input/Input_TCP.h" |
#include "../../Global/Class_Input/Input_TTY.h" |
struct set_SERVER |
{ |
int IP_MAX; |
int IP_ID; |
int Intervall; |
QString IP[10]; |
QString Password; |
}; |
class wgt_Connection : public QWidget, public Ui::wgt_Connection_ui |
{ |
Q_OBJECT |
public: |
wgt_Connection(QWidget *parent = 0); |
~wgt_Connection(); |
void send_Data(QString ps_Data, int pi_ID = 0); |
void set_Client(int li_ID, QString ls_Client, QString ls_Fields); |
void set_ButtonVisible(bool pi_Visible); |
void set_SelectVisible(bool pi_Visible); |
void set_IntervalVisible(bool pi_Visible); |
Input *o_Input; |
private: |
QTimer *o_AboTimer; |
// Verbindungs-Objekt |
char c_Data[200]; |
bool gi_Interval[2]; |
// Info über die Hardware |
s_Hardware VersionInfo; |
QString gs_Client; |
QString gs_Fields; |
// char gs_Interval; |
int gi_ID; |
set_SERVER SERVER; |
void read_Settings(); |
void write_Settings(); |
void parse_IP_Data(QString t_Data); |
void parse_MK_Data(QString t_Data); |
public slots: |
void slot_btn_Connect(); |
void slot_send_Data(QString ps_Data, int pi_ID = 0); |
private slots: |
void slot_sb_Intervall(int t_Intervall); |
void slot_Input_Data(QString t_Data); |
void slot_Input_Connected(); |
void slot_Input_Disconnected(int Error); |
void slot_TimeOut_AboTimer(); |
signals: |
void sig_Status(int); |
void sig_RawData(QString); |
void sig_MK_Version(s_Hardware); |
void sig_MK_Debug(s_MK_Debug); |
void sig_MK_DebugLabels(s_MK_DebugLabels); |
void sig_MK_NaviData(s_MK_NaviData); |
void sig_MK_WayPoint(int); |
void sig_MK_ReadSettings(s_MK_Settings); |
void sig_MK_WriteSettings(int); |
void sig_MK_ReadMotorMixer(s_MK_Mixer); |
void sig_MK_WriteMotorMixer(int); |
void sig_MK_PPMData(s_MK_PPM_Data); |
}; |
#endif // WGT_CONNECTION_H |
/QMK-Groundstation/trunk/Global/Widget_Connection/wgt_Connection.ui |
---|
0,0 → 1,205 |
<?xml version="1.0" encoding="UTF-8"?> |
<ui version="4.0"> |
<class>wgt_Connection_ui</class> |
<widget class="QWidget" name="wgt_Connection_ui"> |
<property name="geometry"> |
<rect> |
<x>0</x> |
<y>0</y> |
<width>693</width> |
<height>39</height> |
</rect> |
</property> |
<property name="windowTitle"> |
<string>Form</string> |
</property> |
<layout class="QGridLayout" name="gridLayout_4"> |
<property name="margin"> |
<number>0</number> |
</property> |
<item row="0" column="0"> |
<widget class="QFrame" name="frame"> |
<property name="frameShape"> |
<enum>QFrame::StyledPanel</enum> |
</property> |
<property name="frameShadow"> |
<enum>QFrame::Raised</enum> |
</property> |
<layout class="QGridLayout" name="gridLayout_3"> |
<property name="topMargin"> |
<number>0</number> |
</property> |
<property name="bottomMargin"> |
<number>0</number> |
</property> |
<item row="0" column="0"> |
<widget class="QToolButton" name="btn_Connect"> |
<property name="text"> |
<string>...</string> |
</property> |
<property name="icon"> |
<iconset resource="../../QMK-Maps/QMK-Maps.qrc"> |
<normaloff>:/Actions/Global/Images/Actions/Connection-NO.png</normaloff> |
<normalon>:/Actions/Global/Images/Actions/Connection-OK.png</normalon>:/Actions/Global/Images/Actions/Connection-NO.png</iconset> |
</property> |
<property name="checkable"> |
<bool>true</bool> |
</property> |
<property name="checked"> |
<bool>false</bool> |
</property> |
</widget> |
</item> |
<item row="0" column="1"> |
<widget class="QLabel" name="label"> |
<property name="text"> |
<string>Server:</string> |
</property> |
</widget> |
</item> |
<item row="0" column="2"> |
<widget class="QComboBox" name="cb_Server"> |
<property name="minimumSize"> |
<size> |
<width>120</width> |
<height>0</height> |
</size> |
</property> |
<property name="editable"> |
<bool>true</bool> |
</property> |
<item> |
<property name="text"> |
<string>127.0.0.1:64400</string> |
</property> |
</item> |
</widget> |
</item> |
<item row="0" column="3"> |
<widget class="QLabel" name="label_4"> |
<property name="text"> |
<string>PW:</string> |
</property> |
</widget> |
</item> |
<item row="0" column="4"> |
<widget class="QLineEdit" name="le_Password"> |
<property name="sizePolicy"> |
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
<horstretch>0</horstretch> |
<verstretch>0</verstretch> |
</sizepolicy> |
</property> |
<property name="minimumSize"> |
<size> |
<width>120</width> |
<height>0</height> |
</size> |
</property> |
<property name="text"> |
<string/> |
</property> |
<property name="echoMode"> |
<enum>QLineEdit::Password</enum> |
</property> |
</widget> |
</item> |
<item row="0" column="5"> |
<widget class="QWidget" name="wg_Select" native="true"> |
<layout class="QGridLayout" name="gridLayout"> |
<item row="0" column="0"> |
<widget class="Line" name="line"> |
<property name="orientation"> |
<enum>Qt::Vertical</enum> |
</property> |
</widget> |
</item> |
<item row="0" column="1"> |
<widget class="QRadioButton" name="rb_FC"> |
<property name="text"> |
<string>FC</string> |
</property> |
</widget> |
</item> |
<item row="0" column="2"> |
<widget class="QRadioButton" name="rb_NC"> |
<property name="text"> |
<string>NC</string> |
</property> |
</widget> |
</item> |
<item row="0" column="3"> |
<widget class="QRadioButton" name="rb_MK3MAG"> |
<property name="text"> |
<string>MK3MAG</string> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
<item row="0" column="6"> |
<widget class="QWidget" name="wg_Interval" native="true"> |
<layout class="QGridLayout" name="gridLayout_2"> |
<item row="0" column="0"> |
<widget class="Line" name="line_2"> |
<property name="orientation"> |
<enum>Qt::Vertical</enum> |
</property> |
</widget> |
</item> |
<item row="0" column="1"> |
<widget class="QLabel" name="label_3"> |
<property name="text"> |
<string>Intervall:</string> |
</property> |
</widget> |
</item> |
<item row="0" column="2"> |
<widget class="QSpinBox" name="sb_Intervall"> |
<property name="minimumSize"> |
<size> |
<width>80</width> |
<height>0</height> |
</size> |
</property> |
<property name="suffix"> |
<string> ms</string> |
</property> |
<property name="maximum"> |
<number>5000</number> |
</property> |
<property name="singleStep"> |
<number>50</number> |
</property> |
<property name="value"> |
<number>500</number> |
</property> |
</widget> |
</item> |
</layout> |
</widget> |
</item> |
<item row="0" column="7"> |
<spacer name="horizontalSpacer_2"> |
<property name="orientation"> |
<enum>Qt::Horizontal</enum> |
</property> |
<property name="sizeHint" stdset="0"> |
<size> |
<width>35</width> |
<height>20</height> |
</size> |
</property> |
</spacer> |
</item> |
</layout> |
</widget> |
</item> |
</layout> |
</widget> |
<resources> |
<include location="../../QMK-Maps/QMK-Maps.qrc"/> |
</resources> |
<connections/> |
</ui> |
/QMK-Groundstation/trunk/Global/Widget_Connection.pri |
---|
0,0 → 1,23 |
DEPENDPATH += ../Global/Widget_Connection/ |
INCLUDEPATH += ../Global/Widget_Connection/ |
DEFINES += _TTY_POSIX_ |
include(../Global/Class_SerialPort.pri) |
SOURCES += wgt_Connection.cpp \ |
../Global/Class_HandlerMK/HandlerMK.cpp \ |
../Global/Class_HandlerIP/HandlerIP.cpp \ |
../Global/Class_Input/Input.cpp \ |
../Global/Class_Input/Input_TCP.cpp \ |
../Global/Class_Input/Input_TTY.cpp |
HEADERS += wgt_Connection.h \ |
../Global/Kopter.h \ |
../Global/MK_Datatypes.h \ |
../Global/Class_HandlerMK/HandlerMK.h \ |
../Global/Class_HandlerIP/HandlerIP.h \ |
../Global/Class_Input/Input.h \ |
../Global/Class_Input/Input_TCP.h \ |
../Global/Class_Input/Input_TTY.h |
FORMS += wgt_Connection.ui |