views:

2706

answers:

6

I am developing a mobile app to run on a pocketpc. We have a mobile printer and card swipe that uses com1 to send and get info. I'm using the device emulator and want to test without the printer. How do I create a virtual com1 port to right to and read from? I tried com0com but the device emulator will not set that as serial 0.

+1  A: 

This isn't a direct answer, but if you get desperate enough, I had a friend use Detours to redirect output relating to COM interfaces to where he wanted it when he couldn't edit another program's source.

Tom Ritter
A: 

Interesting, never heard of that before.

nportelli
A: 

I did research on this about 2 days ago to emulate a GPS device. The only thing I was able to come up with was a bunch of low level assembly code.

JTA
A: 

I'm not sure I understand what you're after. The emulator can be bound to a COM port on the PC, so you could use that to read and write from the app on the emulator to the physical ports on the PC.

Now if you're asking how you can just open the COM port and read and write with nothing attached, that's far more difficult. Writing is simple - I'd just abstract out the communication layer and slap together a mock class, then have writes go nowhere. Reads are a lot more challenging, as you're going to have to write some sort of simulator to present data in the same way as your peripheral.

IMO, you should be doing this abstraction anyway to allow you to write unit and integration tests for the software anyway.

ctacke
A: 

The abstraction is there already. I was wondering if I could just redirect the com input output to hyperterminal or something. Apparently it isn't easy.

nportelli
A: 

If the PC has 2 serial ports (USB to serial adapters work well) you can use a null modem from the port shared with the emulator to another on the PC and attach Hyperterminal to it. That would give you the redirect pretty easily.

ctacke