Rev 307 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 307 | Rev 313 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | cConnection::cConnection() |
21 | cConnection::cConnection() |
22 | { |
22 | { |
23 | i_Type = 0; |
23 | i_Type = 0; |
Line 24... | Line 24... | ||
24 | 24 | ||
- | 25 | TTY = new ManageSerialPort(); |
|
- | 26 | o_Timer = new QTimer(this); |
|
- | 27 | ||
Line 25... | Line 28... | ||
25 | TTY = new ManageSerialPort(); |
28 | connect(o_Timer, SIGNAL(timeout()), SLOT(slot_Timer())); |
26 | 29 | ||
27 | TTY->setBaudRate(BAUD57600); //BaudRate |
30 | TTY->setBaudRate(BAUD57600); //BaudRate |
28 | TTY->setDataBits(DATA_8); //DataBits |
31 | TTY->setDataBits(DATA_8); //DataBits |
Line 199... | Line 202... | ||
199 | TX_Data = ToolBox::Encode64(Data, Length); |
202 | TX_Data = ToolBox::Encode64(Data, Length); |
Line 200... | Line 203... | ||
200 | 203 | ||
201 | TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
204 | TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
Line -... | Line 205... | ||
- | 205 | TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
|
- | 206 | ||
202 | TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
207 | Temp = QByteArray(TX_Data.toUtf8()); |
203 | 208 | ||
204 | if (Resend) |
209 | if (Resend) |
205 | { |
210 | { |
206 | // LastSend = TX_Data; |
211 | o_Timer->start(2000); |
207 | // TickerEvent[0] = true; |
- | |
208 | } |
212 | s_ReSend = Temp; |
209 | Temp = QByteArray(TX_Data.toUtf8()); |
213 | } |
210 | } |
214 | } |
211 | else |
215 | else |
212 | { |
216 | { |
Line 232... | Line 236... | ||
232 | 236 | ||
233 | emit(showTerminal(3, TX_Data)); |
237 | emit(showTerminal(3, TX_Data)); |
234 | } |
238 | } |
235 | return true; |
239 | return true; |
- | 240 | } |
|
- | 241 | ||
- | 242 | void cConnection::stop_ReSend() |
|
- | 243 | { |
|
- | 244 | o_Timer->stop(); |
|
- | 245 | } |
|
- | 246 | ||
- | 247 | void cConnection::slot_Timer() |
|
- | 248 | { |
|
- | 249 | switch(i_Type) |
|
- | 250 | { |
|
- | 251 | case C_TTY : |
|
- | 252 | { |
|
- | 253 | TTY->sendData(s_ReSend); |
|
- | 254 | } |
|
- | 255 | break; |
|
- | 256 | case C_IP : |
|
- | 257 | { |
|
- | 258 | TcpSocket->write(s_ReSend); |
|
- | 259 | } |
|
- | 260 | break; |
|
- | 261 | } |
|
- | 262 | ||
- | 263 | emit(showTerminal(3, QString(s_ReSend))); |