Take the 2-minute tour ×

I'm working on a point of sale (POS) application, at the checkout the terminals need to support various devices; scanners, magnetic swipe card readers and cash drawers. We're supporting all these using POS.NET and in normal operating situations they all work fine.

A problem has come to light during testing, if the cash drawer is initialised correctly, and then the power is subsequently lost to the cash drawer, an RS232 Posiflex CR4101, POS.NET doesn't tell you that anything is wrong. No exceptions, no errors, nothing.

We're using pretty standard code to initialise the device:

this.PosExplorer = new PosExplorer();
var deviceInfo = this.PosExplorer.GetDevice(DeviceType.CashDrawer, deviceName);
this.device = (CashDrawer)this.PosExplorer.CreateInstance(deviceInfo);
this.device.DeviceEnabled = true;

And then, when we want to open the cash drawer we use (couched in appropriate exception handling and re-initialisation logic on failure code):


The problem is, the call to OpenDrawer doesn't return any issues. The POS.NET cash drawer service object has a property, DrawerOpened, which actually returns true despite the drawer remaining physically closed. Even better, is that if you power the cash drawer back on at this point DrawerOpened returns false and it indicates that the cash drawer was just closed.

Does anyone have any advice?

Also, before it's suggested, the cash drawer model can't be changed to one that reports power status more accurately (at all) due to the cost of rolling out replacements at all stores nation-wide.

Secondly, there are no power indicators on these devices so the first indication a check-out person would know anything is wrong would be when the drawer didn't open.

Thirdly, I've suggested optimising the working environment to minimise the chance of the check-out person bumping, kicking or otherwise coming anywhere near the power pack or cables to reduce the chance of a "partially powered-off" system.

This is an exercise in coding to the lowest common denominator (the user) and trying to recover from an unexpected, unreported situation where all the information is wrong.

To quote Borat, "Great success!".

share|improve this question
Have you checked CapPowerReporting to see if the cashdraws you use support power reporting? If they do you can try enabling PowerNotify and then checking the PowerState property (msdn.microsoft.com/en-US/library/…) –  Re0sless Jun 27 '13 at 15:52
Cheers for the suggestion @Re0sless, but I'm out of luck...the devices I have do not support power reporting. –  Fooksie Jul 15 '13 at 1:15
add comment


Your Answer



Browse other questions tagged or ask your own question.