[Interest] Is there a way to simulate serial port data?

Samuel Gaist samuel.gaist at edeltech.ch
Tue Mar 28 01:16:31 CEST 2017


> On 28 Mar 2017, at 00:48, Murphy, Sean <smurphy at walbro.com> wrote:
> 
> I've got a class that inherits from QSerialPort. The bulk of the code in the class is parsing that I'm doing in a slot that is connected to QSerialPort's readyRead() signal. I want to inject known data  into this class as if it's actually coming across the serial port to validate my parsing code, is there any way to do that? Ideally I'd be able to write data in and have it trigger the readyRead() signal, but I'm not seeing any way to do that.
> 
> I know I could write a separate application that writes out one serial port, and then I could cable that back to my other serial port, but I was just looking for a way to do it all in code.
> 
> Sean
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

Hi,

What about writing a “virtual serial port” ?

QSerialPort is a QIODevice, so one thing you can do is to replace it with a custom QIODevice where you can write what you from e.g. a “console widget” to evaluate what you want from your application.

Cheers
Samuel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170328/a141337e/attachment.sig>


More information about the Interest mailing list