Reputation: 17099
I have to develop software for a USB scale that, when you press a button on it, sends serial communications over USB. I can see the values in HyperTerminal.
I am going to use the .NET classes for Serial communication to trap the data.
The problem is, I don't have the scale. The scale is connected to a remote computer I can RDP into. When I want to test, I can ask the client to press the button on the scale.
I can't ask the client to press the button 100 times a day, I need to have a way to develop with a reasonably good idea of what the scale will report, and only test when I think I have a solution.
I'm looking for something locally, that can mimic the scale and send to my .NET Serial classes, the same output as the scale. Ideally, if I could record the scale's data, and then play it back on another machine, it would be perfect.
How would I do this?
Upvotes: 2
Views: 3817
Reputation: 1781
If you take the serial port emulation route, take a look at com0com. I use it all the time to fake communications with laboratory instruments and it works nicely. Very useful when you laptop lacks serial ports.
Upvotes: 2
Reputation: 56123
You have two problems:
You can test 1. by attaching anything which can generate data (e.g. another PC with Hyperterminal) to your PC's local serial port.
You can test 2. by (for testing purposes) replacing your serial classes with software which acts as a "mock object" for the 'serial classes + scale' combination (i.e. which feeds into your program, using the API which your serial classes would use, the data which you expect to receive from the scale).
You can also test 1 and 2, by:
Upvotes: 1
Reputation: 12994
1) Abstract away your communications code. In test mode, feed your logic function from a data file stream rather than the serial stream.
or
2) If you have 2 serial ports (or two pcs), then setup a scale emulator app that talks out thru one port, and plug that into the other port where your software is running.
Upvotes: 2