
Manual 18-ccTalk
Version 0.6
Page 21
Host program example (only used for protocol explanation) in pseudo code
/* Initialize communication */
For each Hopper with HOPPER_ADDRESSx in machine do
{
if ( SimplePoll(HOPPER_ADDRESSx) ) != ACK)
{
// resolve any device address problems
While ( AddressClash(HOPPER_ADDRESSx) )
// more devices share HOPPER_ADDRESSx ?
{
RandomizeAddresses(0);
// give each device a new random address
DeviceList = AddessPoll(0);
// store all received address in list
While (DeviceList not empty)
{
address = GetNextAddressFromDeviceList();
RequestEquipmentCategory(address);
// check device type
ChangeAddress(address, DEVICE_ADDRESS);
// change address to DEVICE_ADDRESS
}
}
// SimplePoll(HOPPER_ADDRESSx) returned ACK. Communication Ok!
if (RequestEquipmentCategory(HOPPER_ADDRESSx) != "Payout")
{
ShowMessage("DEVICE IS NOT A HOPPER!");
}
else
{
Hopper[x].PhysicalAddress = RequestVariableSettings(PHYSICAL_ADDR,
HOPPER_ADDRESSx);
Hopper[x].SerialNr = RequestVariableSettings(SER_NR, HOPPER_ADDRESSx);
// Optional the following items may be retrieved
Hopper[x].ManufacturerID = ...
Hopper[x].ProdCode = ...
Hopper[x].SoftwareRev = ...
Hopper[x].CommsRev = ...
Hopper[x].HopperCoin = ...
Hopper[x].BuildCode = ...
}
}
// Product Configuration details
// Check for pending Payout after a power fail recovery
// Dispense Coins from HOPPER_ADDRESSx
HopperAddress = HOPPER_ADDRESSx;
HopperType = RequestProductCode(HopperAddress);
// get hopper type
HopperStatus = TestHopper(HopperAddress);
// get hopper status bytes
if (HopperStatus & PAYOUT_ERROR_FLAGS) == 0) // no opto errors, max current exceeded, etc?
{
if (HopperStatus & RESET_OCCURRED)
// after a reset, send pin code if necessary
{
// Pin Number Unlocking
if (HopperStatus & PIN_NUMBER_REQUIRED)
{
SetPinNumber(PinCode, HopperAddress);// unlock hopper (required a after reset)
}
}
if (HopperStatus & HOPPER_DISABLED)
{
EnableHopper(HopperAddress);
// enable hopper
}
SecurityBytes = RequestCipherKey(HopperAddress);
// ReqCipherKey, not needed for ITA
// serial
if (HopperType == "MC encrypted" )
// use security bytes?
{
DispenseCoins(HopperAddress, SecurityBytes, NrCoinsToPay);
}
else if (HopperType == "ITA serial")
// use dummy bytes? (security disabled)
{