Hi friends,
I have one problem with Qextserialport , that i was unable to read and store the data to database properly.In my program i was able to read and store the data properly for some time only and after that the data was getting corrupted(ie overwriting in port I think).
Here I am receiving huge data from other system through RS232 in which it contains a data frame of 50 channels approximately ,each channel information occupies 2bytes.The data will be 50 data frames per 1sec.when I was reading and storing these channels data into database, channel wise.I am able to insert the data for 2 or 3seconds only and then after the data corrupted. for this i used QTimer to call "receiveMsg()" for every 1millisec.
But since i am new to threads i am still figuring out how to implement it in the program, Can you pls give me any suggestions on how i should implement threads in my program.I don't know how to create the new threads and own classes. I don't know how to implement the threads in my program . Where to declare and where to start the threads.
This is the code I tried with out Threads.

Qt Code:
  1. void QT_receive::receiveMsg()
  2. {
  3. QByteArray msg ;
  4. QString ss;
  5. msg.clear();
  6. char buff[2];
  7. if(port->bytesAvailable())
  8. {
  9. int i= port->read(buff, 2);
  10. msg = QByteArray::fromRawData(buff,2);
  11. if (i!= -1)
  12. buff[i] = '\0';
  13. else
  14. buff[0] = '\0';
  15. int d = 0;
  16. while(d<msg.count())
  17. {
  18. m.prepend(msg.at(d));
  19. d++;
  20. }
  21. ss = m.toHex();
  22. QString sq("INSERT INTO Bulkdb values(%1,%2)");
  23. sq = sq.arg(rcount)
  24. .arg("'"+ ss +"'");
  25. m_query.exec(sq);
  26. rcount++;
  27. ss.clear();
  28. m.clear();
  29. }
  30. }
To copy to clipboard, switch view to plain text mode 

Please Help me to solve this problem

Regards,
Sudheer