I have an Ardac (ID-003) note reader in my system. In order to move into a state where it will accept notes I use the following code:
Code: Select all
for (int i = 0; i < MAX_COINS; i++)
{//Loop through all the coins/notes
if(this->globalConfig->coinStates.isInhibited[i] == false)
{//check if this coin/note should be allowed
for (int j = 0; j < MAX_NOTE_ACCEPTORS+MAX_COIN_ACCEPTORS; j++)
{//Loop through acceptors
if(this->m_Acceptors[j]->accepts(this->globalConfig->coinStates.coinValue[i]))
{//find the correct acceptor for this note/coin and un-inhibit it
this->m_Acceptors[j]->acceptCoin(this->globalConfig->coinStates.coinValue[i]);
}
}
}
}
//Setup a timer
LARGE_INTEGER freq,start, end;
end.QuadPart=0;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&start);
while((this->m_MHE->doErrorChecks(true,ACCEPTOR) == MHE_ACPT_BUSY) && (((end.QuadPart-start.QuadPart) / freq.QuadPart) < 5))
{
QueryPerformanceCounter(&end);
}
//wait for timeout or ACCEPTOR to no longer report itselft as busY
if(this->m_MHE->doErrorChecks(true,ACCEPTOR) == MHE_ACPT_BUSY)
{
ASSERT(FALSE); //This never happens, so must not be reporting as busy
}
bool CBaseAcceptor::acceptCoin(int coinValue)
{
if (!this->accepts(coinValue))
return false;
this->readBlock(); //update the local copy of the AcceptorDetailsBlock
for(int i = 0; i<this->m_aBlock->NoOfCoins; i++)
{// loop and find the correct index for this coin
if (this->m_aBlock->Coin[i].Value == coinValue)
{
this->m_aBlock->Coin[i].Inhibit = 0;
this->writeBlock();
return true;
}
}
return false;
}The problem is (and this only happens on the note reader not the coin reader) that the note reader seems to take another 10 seconds after the code above has run to get into a state where it actually starts accepting notes.
Is there a quicker way to move the note reader from a state of not accepting anything to accepting notes from a list of values and vice cersa (timing is not as vital on the move from accept to reject though)?
I cannot use EnableInterface() as this has a blanket effect of enabling or disabling all interfaces including the one to the door switches which should always be on.
Failing that is there a way of getting the switch states without making a call to EnableInterface()?