I have a request from one of my clients to interface a USB cash drawer to my
application.   In most retail applications, the cash drawer is attached to a
receipt printer that includes a port (interface) to plug the drawer into.
The driver for the printer includes escape codes to open and release the
drawer.  My application does not use a receipt printer so I will be forced
to use a drawer with a USB interface.  Unfortunately, there are no drivers
for USB cash drawers.  However, they do have a DLL that will allow you to
pass commands to the drawer. 

 

Questions:

1) Has anyone interfaced a USB cash drawer to their RBASE application?  If
so, details please.

2) The manufacture of the cash drawer supplies a DLL which I have copied a
portion and inserted below.  I read through Mike's 2008 conference
presentation on "Understanding DLCALL"  but I am unclear on how to construct
the commands to make the drawer open.  I do not have the drawer yet, because
I do not want to make the purchase until I am confident that I can make
RBASE pass the commands.  Please supply your opinions if you have used DLL
call to communicate with RBASE.

 

1. GetDrawerHandle

This function determines if the cash drawer controller has been added to the
bus. If so it

returns the valid handle to the controller, else it return a 0.

C Calling Structure:

ULONG GetDrawerHandle(BYTE drawer_number);

example:

handle = GetDrawerHandle(0);

if (handle) drawer_online = TRUE;

else drawer_online = FALSE;

Visual Basic Calling Structure:

Private Declare Function GetDrawerHandle Lib "MSPOS_USB.dll" (ByVal Handle
As Long) As Integer

example:

Handle = GetDrawerHandle(0)

If Handle > 0 Then

Drawer_Online = TRUE

Else

Drawer_Online = FALSE

End If

2. GetDrawerStatus

This function returns the state of the switch on the controller. You must
give the function

the handle to the cash drawer you are using. The function will return
failure [0], drawer

closed [1], or drawer open [2].

Note: The DIP-SWITCH position four controls whether the system responds to a
NO [0] or a NC [1] switch.

C Calling Structure:

int GetDrawerStatus(ULONG device_handle);

example:

result = GetDrawerStatus(handle);

if (result == 2) drawer_open = TRUE;

else if (result == 1) drawer_open = FALSE;

else drawer_online = FALSE;

Visual Basic Calling Structure:

Private Declare Function GetDrawerStatus Lib "MSPOS_USB.dll" (ByVal Handle
As Long) As Integer

example:

Result = GetDrawerStatus(Handle)

If Result = 2 Then

Drawer_Open = TRUE

ElseIf Result = 1

Drawer_Open = FALSE

Else

Drawer_Online = FALSE

End If

3. OpenDrawer

This function opens the cash drawer. You must give the function the handle
to the cash

drawer you are using. The function will success drawer opened [2], drawer
already opened

[3], or failure [0]. The solenoid will fire ONLY if the drawer is closed.

C Calling Structure:

int OpenDrawer(ULONG device_handle);

example:

result = OpenDrawer (handle);

if (!result) drawer_online = 0;

Visual Basic Calling Structure:

Private Declare Function OpenDrawer Lib "MSPOS_USB.dll " (ByVal Handle As
Long) As Integer

example:

Result = OpenDrawer(Handle)

If Result = 0 Then Drawer_Online = FALSE

4. ReleaseDrawerHandle

This function will release the device handle. Call this function when your
program is

finished using the device or when your program exits.

C Calling Structure:

int ReleaseDrawerHandle(ULONG device_handle);

example:

result = ReleaseDrawerHandle (handle);

Visual Basic Calling Structure:

Private Declare Function ReleaseDrawerHandle Lib "MSPOS_USB.dll " (ByVal
Handle As Long) As Integer

example:

Result = ReleaseDrawerHandle(Handle)

 

John

 

 

 

 

 

Reply via email to