We are trying to intercept data between pos and printer.
The problem we have ran into is the POS reports the printer x is offline when we connect it to com0com endpoint.
an instance of hyperterminal on each side of com0com endpoints do communicate with each other.
I never knew there was a way to detect if hardware was actually connected to the serial port. Normally I write to the com port regardless if there is a device listening. I know the pos uses opos as it's underlying way to communicate to the printer. What event is opos firing to notify the pos application to think the printer is offline? How does the hardware identify if a device is connected? Is there anyway to circumvent this event when using com0com?
OPOS follows three a step process: Open(), ClaimDevice(), and Enable. Calling Open() will cause the OPOS Common Control Object (OPOS CCO) to construct the vendor-provided device specific Service Object (SO), and it will then call the Open() method on the SO. This initializes the software, but probably will not attempt to talk to the device at this time.
ClaimDevice() negotiates with the SO to make sure the device is shareable and available to the app. It is at this time that the device could be reported offline. ClaimDevice() will raise an exception with a ResultCode indicating OPOS_E_OFFLINE.
Setting Enable to true, or performing print activities can fail the call if the device is offline. Someone might unplug the printer in the middle of printing, for example.
The SO is responsible for performing the negotiation and communication with the device. The vendor's provided OPOS installation package typically installs and configures the SO for you. But it is your responsibility to make sure the SO is properly configured to talk to the correct port and device. If it is not properly configured, you will get a device offline error when ClaimDevice() is called.