Rev 674 | Rev 750 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 674 | Rev 711 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | * Free Software Foundation, Inc., * |
16 | * Free Software Foundation, Inc., * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
18 | ***************************************************************************/ |
18 | ***************************************************************************/ |
Line 19... | Line 19... | ||
19 | 19 | ||
- | 20 | #include <QMessageBox> |
|
Line 20... | Line 21... | ||
20 | #include <QMessageBox> |
21 | #include <QCryptographicHash> |
Line 21... | Line 22... | ||
21 | 22 | ||
22 | #include "dlg_Main.h" |
23 | #include "dlg_Main.h" |
Line 195... | Line 196... | ||
195 | { |
196 | { |
196 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,Position,Position + o_Settings->DATA.Plotter_Count,0); |
197 | qwt_Plotter->setAxisScale(QwtPlot::xBottom,Position,Position + o_Settings->DATA.Plotter_Count,0); |
197 | qwt_Plotter->replot(); |
198 | qwt_Plotter->replot(); |
198 | } |
199 | } |
Line -... | Line 200... | ||
- | 200 | ||
199 | 201 | // IP-Input-Daten verarbeiten. |
|
200 | void dlg_Main::parse_IP_Data(QString t_Data) |
202 | void dlg_Main::parse_IP_Data(QString t_Data) |
201 | { |
203 | { |
202 | QStringList Data; |
204 | QStringList Data; |
Line 206... | Line 208... | ||
206 | { |
208 | { |
207 | int CMD = Data[2].toInt(); |
209 | int CMD = Data[2].toInt(); |
Line 208... | Line 210... | ||
208 | 210 | ||
209 | switch(CMD) |
211 | switch(CMD) |
210 | { |
212 | { |
211 | case 501 : |
213 | case 101 : |
212 | { |
214 | { |
- | 215 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 101, QA_NAME + " " + QA_VERSION)); |
|
- | 216 | } |
|
- | 217 | case 502 : |
|
- | 218 | { |
|
- | 219 | switch (Data[3].toInt()) |
|
- | 220 | { |
|
- | 221 | case 105 : |
|
- | 222 | { |
|
- | 223 | QString s_MD5PW; |
|
- | 224 | QByteArray a_MD5PW; |
|
- | 225 | ||
- | 226 | a_MD5PW = QCryptographicHash::hash(le_Password->text().toAscii(),QCryptographicHash::Md5); |
|
- | 227 | ||
- | 228 | s_MD5PW = QString(a_MD5PW.toHex().data()); |
|
- | 229 | ||
- | 230 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 105, s_MD5PW)); |
|
- | 231 | } |
|
- | 232 | break; |
|
- | 233 | case 106 : |
|
- | 234 | { |
|
- | 235 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 106, DataFields)); |
|
- | 236 | } |
|
- | 237 | break; |
|
213 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 105, le_Password->text())); |
238 | } |
214 | } |
239 | } |
215 | break; |
240 | break; |
216 | case 505 : |
241 | case 505 : |
217 | { |
242 | { |
Line 226... | Line 251... | ||
226 | break; |
251 | break; |
227 | } |
252 | } |
228 | } |
253 | } |
229 | } |
254 | } |
Line 230... | Line 255... | ||
230 | 255 | ||
231 | // Eingangsdaten verarbeiten |
256 | // MK-Eingangsdaten verarbeiten |
232 | void dlg_Main::parse_MK_Data(QString t_Data) |
257 | void dlg_Main::parse_MK_Data(QString t_Data) |
233 | { |
258 | { |
234 | unsigned char OutData[150]; |
259 | unsigned char OutData[150]; |
Line 455... | Line 480... | ||
455 | } |
480 | } |
Line 456... | Line 481... | ||
456 | 481 | ||
457 | cb_Server->setEnabled(false); |
482 | cb_Server->setEnabled(false); |
Line -... | Line 483... | ||
- | 483 | le_Password->setEnabled(false); |
|
458 | le_Password->setEnabled(false); |
484 | |
459 | 485 | // Connect über Device |
|
460 | if (cb_Server->currentText().startsWith('/')) |
486 | if (cb_Server->currentText().startsWith('/')) |
461 | { |
487 | { |
Line 477... | Line 503... | ||
477 | cb_Server->setEnabled(true); |
503 | cb_Server->setEnabled(true); |
478 | le_Password->setEnabled(true); |
504 | le_Password->setEnabled(true); |
479 | } |
505 | } |
Line 480... | Line 506... | ||
480 | 506 | ||
481 | } |
507 | } |
482 | else |
508 | else // Connect über TCPIP |
483 | { |
509 | { |
484 | o_Input = new Input_TCP(); |
510 | o_Input = new Input_TCP(); |
Line 485... | Line 511... | ||
485 | o_Input->Init(); |
511 | o_Input->Init(); |
Line 523... | Line 549... | ||
523 | { |
549 | { |
524 | parse_MK_Data(t_Data); |
550 | parse_MK_Data(t_Data); |
525 | } |
551 | } |
526 | else |
552 | else |
527 | { |
553 | { |
528 | // qDebug(QString("CRC-Error - " + t_Data).toLatin1().data()); |
554 | qDebug(QString("CRC-Error - " + t_Data).toLatin1().data()); |
529 | } |
555 | } |
530 | } |
556 | } |
531 | else if (o_Input->Mode() == TCP) |
557 | else if ((o_Input->Mode() == TCP) && (t_Data[0] == '$')) |
532 | { |
558 | { |
533 | parse_IP_Data(t_Data); |
559 | parse_IP_Data(t_Data); |
534 | } |
560 | } |
535 | } |
561 | } |
Line 536... | Line 562... | ||
536 | 562 | ||
537 | void dlg_Main::slot_Input_Disconnected(int Error) |
563 | void dlg_Main::slot_Input_Disconnected(int Error) |
538 | { |
564 | { |
539 | cb_Server->setEnabled(true); |
565 | cb_Server->setEnabled(true); |
Line 540... | Line -... | ||
540 | le_Password->setEnabled(true); |
- | |
541 | 566 | le_Password->setEnabled(true); |
|
542 | // qDebug("Close"); |
- | |
543 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
- | |
544 | if (o_Input->Mode() == TCP) |
567 | |
545 | { |
568 | disconnect(o_Input, SIGNAL(sig_NewData(QString)), 0, 0); |
546 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
569 | disconnect(o_Input, SIGNAL(sig_Disconnected(int)), 0, 0); |
547 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
570 | disconnect(o_Input, SIGNAL(sig_Connected()), 0, 0); |
548 | } |
571 | |
Line 549... | Line 572... | ||
549 | ac_Connect->setChecked(false); |
572 | ac_Connect->setChecked(false); |
550 | ac_Connect->setText(tr("Verbinden")); |
573 | ac_Connect->setText(tr("Verbinden")); |
Line 580... | Line 603... | ||
580 | 603 | ||
581 | void dlg_Main::slot_Input_Connected() |
604 | void dlg_Main::slot_Input_Connected() |
582 | { |
605 | { |
Line 583... | Line 606... | ||
583 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
606 | connect(o_Input, SIGNAL(sig_NewData(QString)), this, SLOT(slot_Input_Data(QString))); |
584 | 607 | ||
585 | o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 101, QA_NAME + " " + QA_VERSION)); |
608 | // o_Input->send_Data(HandlerIP::make_Frame(ID_SCOPE, 101, QA_NAME + " " + QA_VERSION)); |
586 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
609 | o_Input->send_Data(HandlerMK::make_Frame('v', 0, c_Data, 0).toLatin1().data(), DATA_VERSION); |
Line 587... | Line 610... | ||
587 | ac_Connect->setText(tr("Trennen")); |
610 | ac_Connect->setText(tr("Trennen")); |