I’m writing an app which requires certain hardware to run (Cameras, Motors, Optics, etc…)
For testing purposes I figured it could be nice to have an emulator so that I don’t need to have the hardware connected to test the app.
I was able to achieve this for most components by replacing the usual libaries used to communicate with the hardware with a custom DLL that simply emulates the behaviour of the hardware.
The last component I need to emulate is an Arduino that I communicate with through the serial port, so I would need to make the app think that it’s the normal serial port it’s communicating with but I’d just be a socket to the emulator app.
From reading online it seems that making a fully functional virtual serial port is hard, it’d require a device driver running in kernel mode.
My question: Is there any easier way to do this ?
I’m using Qt’s serial port library so maybe there’s already something specific to that library that could do the job ?
One way that I think would be the easiest is using software like com0com which allow you to make a virtual serial port (i.e COM0<->COM1) and then put the app on COM0 and the emulator on COM1. However the app currently looks for VID/PID of the Arduino model to find the COM port so it would mean changing the code of the app which I’d ideally like to avoid.
From looking online here’s what I found
- This code sample could maybe help with making the virtual serial port ?
- I looked at Qt’s doc but couldn’t find anything yet