Results 1 to 6 of 6

Thread: win32 API serial port in Qt4

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: win32 API serial port in Qt4

    Hardly a Qt question: you want to use Win32 API to receive data and send it to OpenCV. Here are some thoughts anyway:

    Line 3 seems unlikely to be correct. LPCWSTR means "long pointer constant wide string" and you are providing a pointer to a const narrow string. A simple C-style cast does not convert the data, it just silences the compiler error. A wide-string literal looks like L"COM1" or you might use the _T("COM1") macro.

    Before you can pass data to OpenCV it needs to be in some format OpenCV will accept, dictated by the sender, and you need to known when the received data is complete. As with network communication you cannot assume the file is received all at once, and readable in one hit, even if it was sent in one write. You must therefore buffer the received data until such time as the data is complete, which generally means you need some way to know the length of the image data.

    Line 33 does not make a lot of sense if the data is a binary (image) and not a nul-terminated text string.

  2. The following user says thank you to ChrisW67 for this useful post:

    jakr13 (15th February 2013)

Similar Threads

  1. Serial port performance
    By marcvanriet in forum General Programming
    Replies: 1
    Last Post: 2nd January 2012, 12:40
  2. serial port communication
    By robotics in forum Qt Programming
    Replies: 19
    Last Post: 28th September 2011, 15:11
  3. Serial Port communication
    By mgurbuz in forum Qt Programming
    Replies: 12
    Last Post: 22nd January 2011, 02:38
  4. data from serial port
    By bhe in forum Newbie
    Replies: 4
    Last Post: 3rd May 2009, 10:19
  5. Serial Port
    By b1 in forum Qt Programming
    Replies: 2
    Last Post: 18th January 2007, 02:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.