Hi Sean,
I have a question related to this (slightly old) post. And also, let me prefix all of this with, I'm completely new to POS development.
Per your comment above, I don't see my USB connected CashDrawer in the list of nodes. When I get a list of CashDrawer devices (using PosExplorer's GetDevices) all I see is the MS simulator. Not sure where to go from here because my CashDrawers shows up in Device Manager and seems fine.
As a side step, I created a MyCashDrawer service object class deriving from CashDrawerBase (adorning it with my physical cash drawer's HardwareId [from device manager]). I also adorned with ServiceObject providing all the proper values (see further down). Then in my button click I have:
_myCashDrawer = new CashDrawerServiceObject();
//
_myCashDrawer.Open();
_myCashDrawer.DeviceEnabled = true;
_myCashDrawer.Claim(1000);
_myCashDrawer.OpenDrawer();
_myCashDrawer.Close();
All is good except OpenDrawer does not 'open the drawer'. I understand why because it just calls the OpenDrawerImpl to which I can't just call OpenDrawer because it's recursive and will result in an overflow.
What should be in the overidden OpenDrawerImpl to actually open the cash drawer?
[HardwareId("USB\\VID_0451&PID_0909", "USB\\VID_0451&PID_0909")]
[ServiceObject(DeviceType.CashDrawer, "MyCashDrawer", "My cash drawer", 2, 0)]
public class CashDrawerServiceObject : CashDrawerBase
{
public CashDrawerServiceObject()
{
DevicePath = "USB\\VID_0451&PID_0909\\D2E1F03469A7B5C803469A7B5C8D2E1F";
}
public override string CheckHealth(HealthCheckLevel level)
{
VerifyState(true, true);
//
return "Ok";
}
public override DirectIOData DirectIO(int command, int data, object obj)
{
VerifyState(false, false);
//
return new DirectIOData(data, obj);
}
public override string CheckHealthText { get; }
protected override void OpenDrawerImpl()
{
//what to do here?
}
}
All I need to do is open the cash drawer at this time.
Thanks in advance, Sean.
-Mark
PS - I tried buying your book but your site kept telling me "Confirm Email is required" and I had it filled out with an exact match of my email.