Rev 711 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 711 | Rev 750 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | { |
30 | { |
31 | setupUi(this); |
31 | setupUi(this); |
Line 32... | Line 32... | ||
32 | 32 | ||
Line 33... | Line 33... | ||
33 | o_Settings = new cSettings(); |
33 | o_Settings = new cSettings(); |
Line 34... | Line 34... | ||
34 | 34 | ||
35 | o_Input = new Input(); |
35 | wg_Connection->set_Client(ID_MAPS, QA_NAME + " " + QA_VERSION, DataFields); |
36 | 36 | ||
37 | o_Map = new MapControl(QSize(25,25)); |
37 | o_Map = new MapControl(QSize(25,25)); |
Line 52... | Line 52... | ||
52 | if (o_Settings->GUI.isMax) |
52 | if (o_Settings->GUI.isMax) |
53 | { |
53 | { |
54 | showMaximized(); |
54 | showMaximized(); |
55 | } |
55 | } |
Line 56... | Line -... | ||
56 | - | ||
57 | for(int z = 0; z < o_Settings->SERVER.IP_MAX; z++) |
- | |
58 | { |
- | |
59 | if (cb_Server->findText(o_Settings->SERVER.IP[z]) == -1) |
- | |
60 | { |
- | |
61 | cb_Server->addItem(o_Settings->SERVER.IP[z]); |
- | |
62 | } |
- | |
63 | } |
- | |
64 | - | ||
65 | cb_Server->setCurrentIndex(o_Settings->SERVER.IP_ID); |
- | |
66 | - | ||
67 | le_Password->setText(o_Settings->SERVER.Password); |
- | |
68 | 56 | ||
Line 69... | Line 57... | ||
69 | sb_Intervall->setValue(o_Settings->DATA.Intervall); |
57 | wg_Connection->set_SelectVisible(false); |
70 | 58 | ||
71 | cb_CenterPos->setChecked(o_Settings->CONFIG.cb_CenterPos); |
59 | cb_CenterPos->setChecked(o_Settings->CONFIG.cb_CenterPos); |
72 | cb_ShowRoute->setChecked(o_Settings->CONFIG.cb_ShowRoute); |
60 | cb_ShowRoute->setChecked(o_Settings->CONFIG.cb_ShowRoute); |
Line 73... | Line 61... | ||
73 | cb_ShowWPs->setChecked(o_Settings->CONFIG.cb_ShowWPs); |
61 | cb_ShowWPs->setChecked(o_Settings->CONFIG.cb_ShowWPs); |
74 | cb_Goto->setChecked(o_Settings->CONFIG.cb_Goto); |
62 | cb_Goto->setChecked(o_Settings->CONFIG.cb_Goto); |
Line 75... | Line 63... | ||
75 | 63 | ||
Line 76... | Line 64... | ||
76 | // tb_More->addWidget(cb_Maps); |
64 | tb_More->addWidget(cb_Maps); |
77 | cb_Maps->setVisible(false); |
65 | cb_Maps->setVisible(false); |
78 | 66 | ||
79 | ac_Toolbar->setChecked(o_Settings->GUI.Toolbar); |
67 | ac_Toolbar->setChecked(o_Settings->GUI.Toolbar); |
80 | 68 | ||
81 | if (ac_Toolbar->isChecked()) |
69 | if (ac_Toolbar->isChecked()) |
82 | { |
70 | { |
83 | btn_Connect->setVisible(false); |
71 | wg_Connection->set_ButtonVisible(false); |
Line 90... | Line 78... | ||
90 | } |
78 | } |
Line 91... | Line 79... | ||
91 | 79 | ||
92 | // Signale mit Slots verbinden |
80 | // Signale mit Slots verbinden |
93 | void dlg_Main::init_Connections() |
81 | void dlg_Main::init_Connections() |
94 | { |
82 | { |
95 | connect(ac_Connect, SIGNAL(triggered()), this, SLOT(slot_ac_Connect())); |
83 | connect(ac_Connect, SIGNAL(triggered()), wg_Connection, SLOT(slot_btn_Connect())); |
Line 96... | Line -... | ||
96 | connect(ac_Toolbar, SIGNAL(triggered()), this, SLOT(slot_ac_Toolbar())); |
- | |
97 | - | ||
98 | connect(sb_Intervall, SIGNAL(valueChanged(int)), this, SLOT(slot_sb_Intervall(int))); |
84 | connect(ac_Toolbar, SIGNAL(triggered()), this, SLOT(slot_ac_Toolbar())); |
99 | 85 | ||
Line 100... | Line 86... | ||
100 | connect(sl_Zoom, SIGNAL(valueChanged(int)), this, SLOT(slot_Zoom(int))); |
86 | connect(sl_Zoom, SIGNAL(valueChanged(int)), this, SLOT(slot_Zoom(int))); |
Line 114... | Line 100... | ||
114 | connect(ac_RouteDelete, SIGNAL(triggered()), this, SLOT(slot_ac_RouteDelete())); |
100 | connect(ac_RouteDelete, SIGNAL(triggered()), this, SLOT(slot_ac_RouteDelete())); |
Line 115... | Line 101... | ||
115 | 101 | ||
116 | // About QMK-Kernel & About-QT Dialog einfügen |
102 | // About QMK-Kernel & About-QT Dialog einfügen |
117 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
103 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
- | 104 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
|
- | 105 | ||
- | 106 | connect(wg_Connection, SIGNAL(sig_Status(int)), this, SLOT(slot_ConnectionStatus(int))); |
|
- | 107 | connect(wg_Connection, SIGNAL(sig_MK_Version(s_Hardware)), this, SLOT(slot_MK_Version(s_Hardware))); |
|
- | 108 | connect(wg_Connection, SIGNAL(sig_MK_NaviData(s_MK_NaviData)), this, SLOT(slot_MK_NaviData(s_MK_NaviData))); |
|
118 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
109 | connect(wg_Connection, SIGNAL(sig_MK_WayPoint(int)), this, SLOT(slot_MK_WayPoint(int))); |
Line 119... | Line 110... | ||
119 | } |
110 | } |
120 | 111 | ||
121 | void dlg_Main::init_Directorys() |
112 | void dlg_Main::init_Directorys() |
Line 151... | Line 142... | ||
151 | { |
142 | { |
152 | t_Dir->mkdir(s_Dir.Flights); |
143 | t_Dir->mkdir(s_Dir.Flights); |
153 | } |
144 | } |
154 | } |
145 | } |
Line 155... | Line -... | ||
155 | - | ||
156 | void dlg_Main::parse_IP_Data(QString t_Data) |
- | |
157 | { |
- | |
158 | QStringList Data; |
- | |
159 | Data = t_Data.split(":"); |
- | |
160 | - | ||
161 | if (Data.count() > 1) |
- | |
162 | { |
- | |
163 | int CMD = Data[2].toInt(); |
- | |
164 | - | ||
165 | switch(CMD) |
- | |
166 | { |
- | |
167 | case 101 : |
- | |
168 | { |
- | |
169 | o_Input->send_Data(HandlerIP::make_Frame(ID_MAPS, 101, QA_NAME + " " + QA_VERSION)); |
- | |
170 | } |
- | |
171 | break; |
- | |
172 | case 502 : |
- | |
173 | { |
- | |
174 | switch (Data[3].toInt()) |
- | |
175 | { |
- | |
176 | case 105 : |
- | |
177 | { |
- | |
178 | QString s_MD5PW; |
- | |
179 | QByteArray a_MD5PW; |
- | |
180 | - | ||
181 | a_MD5PW = QCryptographicHash::hash(le_Password->text().toAscii(),QCryptographicHash::Md5); |
- | |
182 | - | ||
183 | s_MD5PW = QString(a_MD5PW.toHex().data()); |
- | |
184 | - | ||
185 | o_Input->send_Data(HandlerIP::make_Frame(ID_MAPS, 105, s_MD5PW)); |
- | |
186 | } |
- | |
187 | break; |
- | |
188 | case 106 : |
- | |
189 | { |
- | |
190 | o_Input->send_Data(HandlerIP::make_Frame(ID_MAPS, 106, DataFields)); |
- | |
191 | } |
- | |
192 | break; |
- | |
193 | } |
- | |
194 | } |
- | |
195 | break; |
- | |
196 | case 505 : |
- | |
197 | { |
- | |
198 | if (Data[3] == "OK") |
- | |
199 | { |
- | |
200 | } |
- | |
201 | else |
- | |
202 | { |
- | |
203 | QMessageBox::warning(this, QA_NAME, trUtf8("Authentifizierung fehlgeschlagen. <br />Daten senden zum Mikrokopter nicht möglich."), QMessageBox::Ok); |
- | |
204 | } |
- | |
205 | } |
- | |
206 | break; |
- | |
207 | } |
- | |
208 | } |
- | |
209 | } |
- | |
210 | - | ||
211 | // Eingangsdaten verarbeiten |
- | |
212 | void dlg_Main::parse_MK_Data(QString t_Data) |
- | |
213 | { |
- | |
214 | unsigned char OutData[150]; |
- | |
215 | char *InData = t_Data.toLatin1().data(); |
- | |
216 | - | ||
217 | if (HandlerMK::Decode_64(InData, t_Data.length(), OutData) != 0) |
- | |
218 | { |
- | |
219 | - | ||
220 | switch(InData[2]) |
- | |
221 | { |
- | |
222 | case 'V' : // Versions-Info |
- | |
223 | { |
- | |
224 | o_Input->stop_Resend(DATA_VERSION); |
- | |
225 | VersionInfo = HandlerMK::parse_Version(OutData, InData[1] - 'a'); |
- | |
226 | setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + VersionInfo.Hardware + " " + VersionInfo.Version); |
- | |
227 | - | ||
228 | if (VersionInfo.ID == ADDRESS_NC) |
- | |
229 | { |
- | |
230 | c_Data[0] = sb_Intervall->value() / 10; |
- | |
231 | o_Input->send_Data(HandlerMK::make_Frame('o', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
- | |
232 | } |
- | |
233 | else // TODO: Befehl wenden zum Wechseln auf Navi. |
- | |
234 | { |
- | |
235 | } |
- | |
236 | } |
- | |
237 | break; |
- | |
238 | case 'O' : // Navi-OSD-Data |
- | |
239 | { |
- | |
240 | if (InData[1] - 'a' == ADDRESS_NC) |
- | |
241 | { |
- | |
242 | s_MK_NaviData MK_NaviData; |
- | |
243 | - | ||
244 | memcpy((unsigned char *)&MK_NaviData, (unsigned char *)&OutData, sizeof(MK_NaviData)); |
- | |
245 | if (MK_NaviData.Version == MK_VERSION_NAVI) |
- | |
246 | { |
- | |
247 | show_Data(MK_NaviData); |
- | |
248 | add_Position(MK_NaviData); |
- | |
249 | } |
- | |
250 | } |
- | |
251 | } |
- | |
252 | break; |
- | |
253 | case 'W' : // WayPoints |
- | |
254 | { |
- | |
255 | o_Input->stop_Resend(DATA_WRITE_WAYPOINT); |
- | |
256 | - | ||
257 | if (OutData[0] < l_WayPoints.count()) |
- | |
258 | { |
- | |
259 | send_WayPoints(l_WayPoints, OutData[0] + 1); |
- | |
260 | } |
- | |
261 | } |
- | |
262 | break; |
- | |
263 | } |
- | |
264 | } |
- | |
265 | } |
- | |
266 | 146 | ||
267 | /////////////////////////////////////////////////////////////////// |
147 | /////////////////////////////////////////////////////////////////// |
268 | // QMK-Maps // |
148 | // QMK-Maps // |
Line 269... | Line 149... | ||
269 | /////////////////////////////////////////////////////////////////// |
149 | /////////////////////////////////////////////////////////////////// |
Line 480... | Line 360... | ||
480 | } |
360 | } |
Line 481... | Line 361... | ||
481 | 361 | ||
482 | f_MKW->close(); |
362 | f_MKW->close(); |
Line 483... | Line -... | ||
483 | } |
- | |
484 | - | ||
485 | void dlg_Main::show_Data(s_MK_NaviData t_NaviData) |
- | |
486 | { |
- | |
487 | QString Mode = "NC-Flags : "; |
- | |
488 | if (t_NaviData.NCFlags & 0x08) {le_Mode->setText(tr("Range Limit")); Mode += "R";} |
- | |
489 | if (t_NaviData.NCFlags & 0x10) {le_Mode->setText(tr("Serial Error")); Mode += "S";} |
- | |
490 | if (t_NaviData.NCFlags & 0x20) {le_Mode->setText(tr("Target reached")); Mode += "T";} |
- | |
491 | if (t_NaviData.NCFlags & 0x40) {le_Mode->setText(tr("Manual Control")); Mode += "M";} |
- | |
492 | if (t_NaviData.NCFlags & 0x01) {le_Mode->setText(tr("Free")); Mode += "F";} |
- | |
493 | if (t_NaviData.NCFlags & 0x02) {le_Mode->setText(tr("Position Hold")); Mode += "P";} |
- | |
494 | if (t_NaviData.NCFlags & 0x04) {le_Mode->setText(tr("Coming Home")); Mode += "C";} |
- | |
495 | - | ||
496 | //qDebug(Mode.toLatin1().data()); |
- | |
497 | - | ||
498 | le_WP->setText(QString("%1/").arg(t_NaviData.WaypointIndex) + QString("%1").arg(t_NaviData.WaypointNumber)); |
- | |
499 | le_WPTime->setText(QString("%1:").arg(t_NaviData.TargetHoldTime / 60) + (QString("%1").arg(t_NaviData.TargetHoldTime % 60)).rightJustified(2, '0')); |
- | |
500 | le_WPDist->setText(QString("%1m").arg(t_NaviData.TargetPositionDeviation.Distance / 10)); |
- | |
501 | le_HomeDist->setText(QString("%1m").arg(t_NaviData.HomePositionDeviation.Distance / 10)); |
- | |
502 | } |
363 | } |
503 | 364 | ||
504 | // Aktuelle MK-Position hinzufügen |
365 | // Aktuelle MK-Position hinzufügen |
505 | void dlg_Main::add_Position(s_MK_NaviData t_NaviData) |
366 | void dlg_Main::add_Position(s_MK_NaviData t_NaviData) |
Line 575... | Line 436... | ||
575 | s_WayPoint.reserve[1] = 0; // reserve |
436 | s_WayPoint.reserve[1] = 0; // reserve |
576 | s_WayPoint.reserve[2] = 0; // reserve |
437 | s_WayPoint.reserve[2] = 0; // reserve |
577 | s_WayPoint.reserve[3] = 0; |
438 | s_WayPoint.reserve[3] = 0; |
Line 578... | Line 439... | ||
578 | 439 | ||
579 | memcpy((unsigned char *)&c_Data, (unsigned char *)&s_WayPoint, sizeof(s_WayPoint)); |
440 | memcpy((unsigned char *)&c_Data, (unsigned char *)&s_WayPoint, sizeof(s_WayPoint)); |
580 | o_Input->send_Data(HandlerMK::make_Frame('s', ADDRESS_NC, c_Data, sizeof(s_WayPoint)).toLatin1().data()); |
441 | wg_Connection->send_Data(HandlerMK::make_Frame('s', ADDRESS_NC, c_Data, sizeof(s_WayPoint)).toLatin1().data()); |
581 | } |
442 | } |
582 | else |
443 | else |
583 | { |
444 | { |
584 | QMessageBox::warning(this, QA_NAME,tr("Es wurden noch keine aktuellen Positionsdaten vom Mikrokopter empfangen."), QMessageBox::Ok); |
445 | QMessageBox::warning(this, QA_NAME,tr("Es wurden noch keine aktuellen Positionsdaten vom Mikrokopter empfangen."), QMessageBox::Ok); |
Line 594... | Line 455... | ||
594 | if (t_Pos == 0) |
455 | if (t_Pos == 0) |
595 | { // Waypoint-Liste löschen |
456 | { // Waypoint-Liste löschen |
596 | s_WayPoint.Position.Status = INVALID; |
457 | s_WayPoint.Position.Status = INVALID; |
Line 597... | Line 458... | ||
597 | 458 | ||
598 | memcpy((unsigned char *)&c_Data, (unsigned char *)&s_WayPoint, sizeof(s_WayPoint)); |
459 | memcpy((unsigned char *)&c_Data, (unsigned char *)&s_WayPoint, sizeof(s_WayPoint)); |
599 | o_Input->send_Data(HandlerMK::make_Frame('w', ADDRESS_NC, c_Data, sizeof(s_WayPoint)).toLatin1().data(), DATA_WRITE_WAYPOINT); |
460 | wg_Connection->send_Data(HandlerMK::make_Frame('w', ADDRESS_NC, c_Data, sizeof(s_WayPoint)).toLatin1().data(), DATA_WRITE_WAYPOINT); |
600 | } |
461 | } |
601 | else |
462 | else |
602 | { |
463 | { |
603 | int z = t_Pos - 1; |
464 | int z = t_Pos - 1; |
Line 623... | Line 484... | ||
623 | s_WayPoint.reserve[1] = 0; // reserve |
484 | s_WayPoint.reserve[1] = 0; // reserve |
624 | s_WayPoint.reserve[2] = 0; // reserve |
485 | s_WayPoint.reserve[2] = 0; // reserve |
625 | s_WayPoint.reserve[3] = 0; // reserve |
486 | s_WayPoint.reserve[3] = 0; // reserve |
Line 626... | Line 487... | ||
626 | 487 | ||
627 | memcpy((unsigned char *)&c_Data, (unsigned char *)&s_WayPoint, sizeof(s_WayPoint)); |
488 | memcpy((unsigned char *)&c_Data, (unsigned char *)&s_WayPoint, sizeof(s_WayPoint)); |
628 | o_Input->send_Data(HandlerMK::make_Frame('w', ADDRESS_NC, c_Data, sizeof(s_WayPoint)).toLatin1().data(), DATA_WRITE_WAYPOINT); |
489 | wg_Connection->send_Data(HandlerMK::make_Frame('w', ADDRESS_NC, c_Data, sizeof(s_WayPoint)).toLatin1().data(), DATA_WRITE_WAYPOINT); |
629 | } |
490 | } |
Line 630... | Line 491... | ||
630 | } |
491 | } |
631 | 492 | ||
Line 641... | Line 502... | ||
641 | 502 | ||
642 | void dlg_Main::slot_ac_Toolbar() |
503 | void dlg_Main::slot_ac_Toolbar() |
643 | { |
504 | { |
644 | if (ac_Toolbar->isChecked()) |
505 | if (ac_Toolbar->isChecked()) |
645 | { |
506 | { |
646 | btn_Connect->setVisible(false); |
507 | wg_Connection->set_ButtonVisible(false); |
647 | ToolBar->setVisible(true); |
508 | ToolBar->setVisible(true); |
648 | tb_More->setVisible(true); |
509 | tb_More->setVisible(true); |
649 | } |
510 | } |
650 | else |
511 | else |
651 | { |
512 | { |
652 | btn_Connect->setVisible(true); |
513 | wg_Connection->set_ButtonVisible(true); |
653 | ToolBar->setVisible(false); |
514 | ToolBar->setVisible(false); |
654 | tb_More->setVisible(false); |
515 | tb_More->setVisible(false); |
655 | } |
516 | } |
Line 656... | Line -... | ||
656 | } |
- | |
657 | - | ||
658 | 517 | } |
|
659 | // Datenintervall geändert. |
518 | |
660 | void dlg_Main::slot_sb_Intervall(int t_Intervall) |
519 | void dlg_Main::slot_ConnectionStatus(int li_Status) |
661 | { |
- | |
662 | if (t_Intervall == 0) |
- | |
663 | { |
- | |
664 | c_Data[0] = 0; |
- | |
665 | } |
520 | { |
666 | else |
- | |
667 | { |
- | |
668 | c_Data[0] = t_Intervall / 10; |
- | |
669 | } |
- | |
670 | o_Input->send_Data(HandlerMK::make_Frame('o', ADDRESS_ALL, c_Data, 1).toLatin1().data()); |
- | |
671 | } |
- | |
672 | - | ||
673 | // Verbindung zum Server auf f_Settings = new wdg_Settings( this );bauen |
- | |
674 | void dlg_Main::slot_ac_Connect() |
- | |
675 | { |
- | |
676 | if (!o_Input->IsOpen()) |
- | |
677 | { |
- | |
678 | if (cb_Server->findText(cb_Server->currentText()) == -1) |
- | |
679 | { |
- | |
680 | cb_Server->addItem(cb_Server->currentText()); |
- | |
681 | cb_Server->setCurrentIndex(cb_Server->findText(cb_Server->currentText())); |
- | |
682 | } |
521 | if (li_Status) |
683 | - | ||
684 | cb_Server->setEnabled(false); |
- | |
685 | le_Password->setEnabled(false); |
- | |
686 | - | ||
687 | if (cb_Server->currentText().startsWith('/')) |
- | |
688 | { |
- | |
689 | o_Input = new Input_TTY(); |
- | |
690 | o_Input->Init(); |
- | |
691 | - | ||
692 | set_Input s_Input; |
- | |
693 | s_Input.Main = cb_Server->currentText(); |
- | |
694 | - | ||
695 | if (o_Input->Open(s_Input) == true) |
522 | { |
696 | { |
- | |
697 | ac_Connect->setText(tr("Trennen")); |
- | |
698 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
- | |
699 | - | ||
700 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
- | |
701 | } |
- | |
702 | else |
- | |
703 | { |
- | |
704 | cb_Server->setEnabled(true); |
- | |
705 | le_Password->setEnabled(true); |
- | |
706 | } |
- | |
707 | - | ||
708 | } |
- | |
709 | else // Connect über TCPIP |
- | |
710 | { |
- | |
711 | o_Input = new Input_TCP(); |
- | |
712 | o_Input->Init(); |
- | |
713 | - | ||
714 | set_Input s_Input; |
- | |
715 | - | ||
716 | QStringList Server = cb_Server->currentText().split(":"); |
- | |
717 | - | ||
718 | s_Input.Main = Server[0]; |
- | |
719 | s_Input.Sub = Server[1]; |
- | |
720 | - | ||
721 | if (o_Input->Open(s_Input) == true) |
- | |
722 | { |
- | |
723 | connect(o_Input, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_Input_Disconnected(int))); |
- | |
724 | connect(o_Input, SIGNAL(sig_Connected()), this, SLOT(slot_Input_Connected())); |
- | |
725 | } |
523 | ac_Connect->setChecked(true); |
726 | } |
524 | ac_Connect->setText(tr("Trennen")); |
727 | } |
525 | } |
728 | else |
526 | else |
729 | { |
- | |
730 | cb_Server->setEnabled(true); |
- | |
731 | le_Password->setEnabled(true); |
527 | { |
732 | - | ||
733 | ac_Connect->setText(tr("Verbinden")); |
- | |
734 | o_Input->Close(); |
- | |
735 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
- | |
736 | if (o_Input->Mode() == TCP) |
- | |
737 | { |
- | |
738 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
- | |
739 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
528 | ac_Connect->setChecked(false); |
740 | } |
529 | ac_Connect->setText(tr("Verbinden")); |
Line 741... | Line -... | ||
741 | } |
- | |
742 | } |
530 | } |
743 | 531 | } |
|
744 | // Neue Daten empfangen. |
532 | |
745 | void dlg_Main::slot_Input_Data(QString t_Data) |
- | |
746 | { |
- | |
747 | if ((t_Data[0] == '#')) |
- | |
748 | { |
- | |
749 | 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())))) |
- | |
750 | { |
- | |
751 | parse_MK_Data(t_Data); |
- | |
752 | } |
533 | void dlg_Main::slot_MK_Version(s_Hardware ls_Version) |
753 | else |
- | |
754 | { |
- | |
755 | // qDebug(QString("CRC-Error - " + t_Data).toLatin1().data()); |
- | |
756 | } |
- | |
757 | } |
- | |
758 | else if ((o_Input->Mode() == TCP) && (t_Data[0] == '$')) |
- | |
759 | { |
534 | { |
Line 760... | Line -... | ||
760 | parse_IP_Data(t_Data); |
- | |
761 | } |
535 | gs_Version = ls_Version; |
762 | } |
536 | setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + ls_Version.Hardware + " " + ls_Version.Version); |
763 | 537 | } |
|
764 | // Serververbindung beendet |
538 | |
765 | void dlg_Main::slot_Input_Disconnected(int Error) |
- | |
766 | { |
539 | void dlg_Main::slot_MK_NaviData(s_MK_NaviData ps_MK_NaviData) |
- | 540 | { |
|
767 | cb_Server->setEnabled(true); |
541 | QString Mode = "NC-Flags : "; |
768 | le_Password->setEnabled(true); |
542 | if (ps_MK_NaviData.NCFlags & 0x08) {le_Mode->setText(tr("Range Limit")); Mode += "R";} |
- | 543 | if (ps_MK_NaviData.NCFlags & 0x10) {le_Mode->setText(tr("Serial Error")); Mode += "S";} |
|
- | 544 | if (ps_MK_NaviData.NCFlags & 0x20) {le_Mode->setText(tr("Target reached")); Mode += "T";} |
|
Line 769... | Line -... | ||
769 | - | ||
770 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
- | |
771 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
- | |
772 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
- | |
773 | - | ||
774 | ac_Connect->setChecked(false); |
- | |
775 | ac_Connect->setText(tr("Verbinden")); |
- | |
776 | btn_Connect->setChecked(false); |
- | |
777 | - | ||
778 | switch (Error) |
545 | if (ps_MK_NaviData.NCFlags & 0x40) {le_Mode->setText(tr("Manual Control")); Mode += "M";} |
779 | { |
- | |
780 | case REMOTECLOSED : |
- | |
781 | { |
- | |
782 | // lb_Status->setText(tr("Verbindung vom Server beendet.")); |
- | |
783 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Verbindung wurde vom Server beendet."), QMessageBox::Ok); |
- | |
784 | } |
546 | if (ps_MK_NaviData.NCFlags & 0x01) {le_Mode->setText(tr("Free")); Mode += "F";} |
785 | break; |
- | |
786 | case REFUSED : |
- | |
787 | { |
- | |
788 | // lb_Status->setText(tr("Server nicht gefunden.")); |
- | |
789 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Kann nicht zum Server verbinden."), QMessageBox::Ok); |
547 | if (ps_MK_NaviData.NCFlags & 0x02) {le_Mode->setText(tr("Position Hold")); Mode += "P";} |
790 | } |
- | |
791 | break; |
- | |
792 | case 3 : |
- | |
793 | { |
- | |
794 | // lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch.")); |
- | |
795 | QMessageBox::warning(this, QA_NAME,tr("QMK-Datenserver: Loginname oder Password falsch."), QMessageBox::Ok); |
548 | if (ps_MK_NaviData.NCFlags & 0x04) {le_Mode->setText(tr("Coming Home")); Mode += "C";} |
796 | } |
- | |
797 | break; |
- | |
798 | default : |
- | |
Line -... | Line 549... | ||
- | 549 | ||
799 | { |
550 | le_WP->setText(QString("%1/").arg(ps_MK_NaviData.WaypointIndex) + QString("%1").arg(ps_MK_NaviData.WaypointNumber)); |
Line 800... | Line -... | ||
800 | // lb_Status->setText(tr("Getrennt vom QMK-Datenserver.")); |
- | |
801 | } |
551 | le_WPTime->setText(QString("%1:").arg(ps_MK_NaviData.TargetHoldTime / 60) + (QString("%1").arg(ps_MK_NaviData.TargetHoldTime % 60)).rightJustified(2, '0')); |
802 | break; |
552 | le_WPDist->setText(QString("%1m").arg(ps_MK_NaviData.TargetPositionDeviation.Distance / 10)); |
803 | } |
553 | le_HomeDist->setText(QString("%1m").arg(ps_MK_NaviData.HomePositionDeviation.Distance / 10)); |
804 | 554 | ||
805 | } |
555 | add_Position(ps_MK_NaviData); |
806 | 556 | } |
|
807 | // Serververbindung hergestellt |
557 | |
808 | void dlg_Main::slot_Input_Connected() |
- | |
809 | { |
558 | void dlg_Main::slot_MK_WayPoint(int pi_WayPointID) |
810 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
559 | { |
811 | 560 | if (pi_WayPointID < l_WayPoints.count()) |
|
Line 812... | Line 561... | ||
812 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
561 | { |
Line 1141... | Line 890... | ||
1141 | o_Settings->GUI.isMax = isMaximized(); |
890 | o_Settings->GUI.isMax = isMaximized(); |
1142 | o_Settings->GUI.Size = size(); |
891 | o_Settings->GUI.Size = size(); |
1143 | o_Settings->GUI.Point = pos(); |
892 | o_Settings->GUI.Point = pos(); |
1144 | o_Settings->GUI.Toolbar = ac_Toolbar->isChecked(); |
893 | o_Settings->GUI.Toolbar = ac_Toolbar->isChecked(); |
Line 1145... | Line -... | ||
1145 | - | ||
1146 | o_Settings->DATA.Intervall = sb_Intervall->value(); |
- | |
1147 | - | ||
1148 | o_Settings->SERVER.Password = le_Password->text(); |
- | |
1149 | o_Settings->SERVER.IP_MAX = cb_Server->count(); |
- | |
1150 | o_Settings->SERVER.IP_ID = cb_Server->currentIndex(); |
- | |
1151 | - | ||
1152 | for (int z = 0; z < cb_Server->count(); z++) |
- | |
1153 | { |
- | |
1154 | if (z < 10) |
- | |
1155 | { |
- | |
1156 | o_Settings->SERVER.IP[z] = cb_Server->itemText(z); |
- | |
1157 | } |
- | |
1158 | } |
- | |
1159 | 894 | ||
1160 | o_Settings->CONFIG.cb_CenterPos = cb_CenterPos->isChecked(); |
895 | o_Settings->CONFIG.cb_CenterPos = cb_CenterPos->isChecked(); |
1161 | o_Settings->CONFIG.cb_ShowRoute = cb_ShowRoute->isChecked(); |
896 | o_Settings->CONFIG.cb_ShowRoute = cb_ShowRoute->isChecked(); |
1162 | o_Settings->CONFIG.cb_ShowWPs = cb_ShowWPs->isChecked(); |
897 | o_Settings->CONFIG.cb_ShowWPs = cb_ShowWPs->isChecked(); |