Hello,

I've been trying for the past few days to create a Lua library that uses QSerialPort.
It works, but I've run into the following problem. Every time I call QSerialPort::write, I get the following warning:
Qt Code:
  1. QObject::startTimer: Timers can only be used with threads started with QThread
To copy to clipboard, switch view to plain text mode 

My guess is that Lua uses its own threads, so I don't really know how to fix that.
For reference, here is a sample of what the code looks like:

Qt Code:
  1. class SerialIO {
  2.  
  3. public:
  4. SerialIO(std::string deviceName);
  5. ~SerialIO();
  6.  
  7. public:
  8. virtual bool open();
  9. virtual void close();
  10. virtual std::string read(int len);
  11. virtual std::string readLine();
  12. virtual bool write(std::string data);
  13.  
  14. private:
  15. QSerialPort m_port;
  16. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. bool SerialIO::write(std::string data) {
  2. if (m_port.isOpen()) {
  3. return m_port.write(data.c_str(), data.length()) == data.length();
  4. }
  5. return false;
  6. }
To copy to clipboard, switch view to plain text mode 

The class is then registered into a Lua state, so that I can use it as a Lua module:

Qt Code:
  1. require "siema_cnx"
  2. port = cnx.Serial("COM4")
  3. port:open()
  4. port:write(":RDREG 0\r\n")
  5. answer = port:readLine()
  6. print(answer)
  7. port:close()
To copy to clipboard, switch view to plain text mode 

The code works fine and I get the expected results, but Qt prints a warning I have no idea of how to get rid of.