Fork me on GitHub
2.15.20
FGx
A cross-platform launcher for FlightGear
mptelnet.cpp
Go to the documentation of this file.
1 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
2 // FGx FlightGear Launcher // mptelnet.cpp
3 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
4 // (c) 2010-2012
5 // Yves Sablonier, Pete Morgan
6 // Geoff McLane
7 // GNU GPLv2, see main.cpp and shipped licence.txt for further information
8 
9 
10 #include <QIODevice>
11 #include "mptelnet.h"
12 
13 
15  QObject(parent)
16 {
17  telnet_reply = QString("");
18  socket = new QTcpSocket(this);
19  connect(socket, SIGNAL(connected()), this, SLOT(on_telnet_connected()));
20  connect(socket, SIGNAL(disconnected()), this, SLOT(on_telnet_disconnected()));
21  connect(socket, SIGNAL(readyRead()), this, SLOT(on_telnet_ready_read()));
22 }
23 
24 void MpTelnet::get_info(QString ip_address){
25  telnet_address = QString(ip_address);
26  socket->connectToHost(telnet_address, 5001, QIODevice::ReadOnly);
27 }
28 
29 
31  // qDebug("connected");
32 }
33 
35 
36  telnet_reply.append( QString(socket->readAll()) );
37 }
38 
40  emit telnet_data(telnet_address, telnet_reply); //, telnet_reply);
41 }
42 
43 
44 
QString telnet_reply
Definition: mptelnet.h:24
MpTelnet(QObject *parent=0)
Definition: mptelnet.cpp:14
void on_telnet_ready_read()
Definition: mptelnet.cpp:34
void on_telnet_disconnected()
Definition: mptelnet.cpp:39
void on_telnet_connected()
Definition: mptelnet.cpp:30
QTcpSocket * socket
Definition: mptelnet.h:27
void get_info(QString ip_address)
Definition: mptelnet.cpp:24
void telnet_data(QString telnet_address, QString reply)
QString telnet_address
Definition: mptelnet.h:23