Chapter 12: Cash Drawer Interface 12-15
WaitForSingleObject( g_hHWPortMutex, INFINITE ); // TAR 95236
if ( m_bIFOpened )
{
WaitForSingleObject( m_hPowerMutex, INFINITE );
// Set Device in RELEASE State
if ( SetState( STATE_RELEASE ) )
{
// Give time for Drawer to see the RELEASE state change, then
// check the drawer position.
Sleep( CD7402_OPEN_WAIT );
// Set Device in IDLE State
if ( SetState( STATE_IDLE ) )
{
if (( GetDrawerStatusLIO() == DRAWER_OPENED ) ||
( m_pCashDrawer->m_bCapStatus == FALSE)) // no drawer status
available return success
{
RetStatus = OPOS_SUCCESS;
}
else
{
RetStatus = OPOS_E_TIMEOUT;
}
}//SetState( STATE_IDLE )
else
{
RetStatus = OPOS_E_NOEXIST;
}
}//SetState( STATE_RELEASE )
else
{
RetStatus = OPOS_E_NOEXIST;
}
ReleaseMutex( m_hPowerMutex );
}
ReleaseMutex( g_hHWPortMutex );
return RetStatus;
}
//////////////////////////////////////////////////////////////////////////////
// CDevice7402::GetDrawerStatus [called from polling thread]
//
// Return Value: DrawerStatus