Subversion Repositories Projects

Rev

Rev 711 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 711 Rev 715
Line 20... Line 20...
20
 
20
 
21
void Input_TCP::Init()
21
void Input_TCP::Init()
22
{
22
{
23
    b_Open = false;
23
    b_Open = false;
-
 
24
    Timer = new QTimer();
24
    Timer = new QTimer();
25
    s_Buffer = "";
Line 25... Line 26...
25
    connect(Timer, SIGNAL(timeout()), this, SLOT(slot_Timer()));
26
    connect(Timer, SIGNAL(timeout()), this, SLOT(slot_Timer()));
26
 
27
 
27
    for (int z = 0; z < MAX_Confirm; z++)
28
    for (int z = 0; z < MAX_Confirm; z++)
Line 76... Line 77...
76
        {
77
        {
77
            t_Data = t_Data + "\r";
78
            t_Data = t_Data + "\r";
78
        }
79
        }
Line 79... Line 80...
79
 
80
 
80
        QByteArray Temp;
81
        QByteArray Temp;
Line 81... Line 82...
81
        Temp = QByteArray(t_Data.toAscii());
82
        Temp = QByteArray(QString(t_Data + "\n").toAscii());
82
 
83
 
Line 83... Line 84...
83
        TCP_Socket->write(Temp);
84
        TCP_Socket->write(Temp);
Line 138... Line 139...
138
}
139
}
Line 139... Line 140...
139
 
140
 
140
void Input_TCP::slot_TCP_ReadLine()
141
void Input_TCP::slot_TCP_ReadLine()
141
{
142
{
142
//    QString t_Data = QString(TCP_Socket->readLine(TCP_Socket->bytesAvailable())).remove(QChar('\n'));
143
//    QString t_Data = QString(TCP_Socket->readLine(TCP_Socket->bytesAvailable())).remove(QChar('\n'));
-
 
144
    QString t_Data = s_Buffer + QString(TCP_Socket->readAll());
-
 
145
 
Line 143... Line 146...
143
    QString t_Data = QString(TCP_Socket->readAll());
146
    s_Buffer = "";
144
 
147
 
Line 145... Line 148...
145
    QStringList l_Data;
148
    QStringList l_Data;
146
    l_Data = t_Data.split('\n');
149
    l_Data = t_Data.split('\n');
Line 147... Line 150...
147
 
150
 
148
    for (int z = 0; z < l_Data.count(); z++)
151
    for (int z = 0; z < l_Data.count(); z++)
149
    {
152
    {
150
 
153
 
151
        if ((l_Data[z].length() > 3) && (t_Data[l_Data[z].length() - 1] == '\r'))
154
        if ((l_Data[z][l_Data[z].length() - 1] == '\r'))
-
 
155
        {
-
 
156
            emit(sig_NewData(l_Data[z]));
-
 
157
//                qDebug(QString("DATA: _" + l_Data[z] + "_ < END").toLatin1().data());
-
 
158
        }
152
        {
159
        else
153
            emit(sig_NewData(l_Data[z]));
160
        {
Line 154... Line 161...
154
//                qDebug(QString("DATA: _" + l_Data[z] + "_ < END").toLatin1().data());
161
            s_Buffer = s_Buffer + l_Data[z];
155
        }
162
        }