Main Page | Data Structures | File List | Data Fields | Globals

cctalk-sr5test.c File Reference


Detailed Description

This is some test code to excerise a SR5 coin mechanism.

Using the cctalk PDF for the SR5 coin mechanism this code will perform some test functions on a SR5.

Author:
Rod Boyce
Date:
02/11/04

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "cctalk-channel-defs.h"
#include "cctalk-operations.h"
#include "cctalk-channel.h"

Include dependency graph for cctalk-sr5test.c:

Include dependency graph

Data Structures

struct  tsCCT_OP

Enumerations

enum  teSR5_CCTALK_MSG_ID {
  SR5_ACK = 0, SR5_RESET = 1, SR5_GET_COMM_STATUS = 2, SR5_CLEAR_COMM_STATUS = 3,
  SR5_GET_COMM_REVISION = 4, SR5_MODIFY_INHIBIT_AND_OVERIDE = 162, SR5_GET_ADDESS_MODE = 169, SR5_GET_BASE_YEAR = 170,
  SR5_GET_THERMISTOR_READING = 173, SR5_GET_ALARM_COUNTER = 176, SR5_HANDHELD_FN = 177, SR5_MODIFY_BANK_SELECT = 179,
  SR5_GET_SECURITY_SETTING = 180, SR5_MOFIFY_SECURITY_SETTING = 181, SR5_DLOAD_CALIBRATION_INFOMATION = 182, SR5_ULOAD_WINDOW_DATA = 183,
  SR5_GET_COIN_ID = 184, SR5_MODIFY_COIN_ID = 185, SR5_GET_DEFAULT_SORTER_PATH = 188, SR5_MODIFY_DEFULT_SORTER_PATH = 189,
  SR5_GET_BUILD_CODE = 192, SR5_GET_FRAUD_COUNTER = 193, SR5_GET_REJECT_COUNTER = 194, SR5_GET_LAST_MODIFICATION_DATE = 195,
  SR5_GET_CREATION_DATE = 196, SR5_CALCULATE_ROM_CSUM = 197, SR5_CONFIGURATION_TO_EEPROM = 199, SR5_GET_TEACH_STATUS = 201,
  SR5_TEACH_MODE_CONTROL = 202, SR5_GET_AUDIT_INFORMATION = 205, SR5_GET_SORTER_PATHS = 209, SR5_MODIFY_SORTER_PATHS = 210,
  SR5_GET_COIN_POSITION = 212, SR5_GET_OPTION_FLAGS = 213, SR5_WRITE_DATA_BLOCK = 214, SR5_READ_DATA_BLOCK = 215,
  SR5_GET_DATA_STORAGE_AVALILABILITY = 216, SR5_ENTER_PIN = 218, SR5_ENTER_NEW_PIN = 219, SR5_GET_SORTER_OVERIDE_STATUS = 221,
  SR5_MODIFY_SORTER_OVERIDE_STATUS = 222, SR5_GET_ACCEPT_COUNTER = 225, SR5_GET_INSERTION_COUNTER = 226, SR5_GET_MASTER_INHIBIT_STATUS = 227,
  SR5_NODIFY_MASTER_INHIBIT_STATUS = 228, SR5_READ_BUFFERED_CREDIT_OR_ERROR_CODES = 229, SR5_GET_INHIBIT_STATUS = 230, SR5_MODIFY_INHIBIT_STATUS = 231,
  SR5_DO_SELF_TEST = 232, SR5_LATCH_OUTPUT_LINES = 233, SR5_READ_OPTO_STATES = 236, SR5_READ_INPUT_LINES = 237,
  SR5_TEST_OUTPUT_LINES = 238, SR5_TEST_SOLENOIDS = 240, SR5_GET_SOFTWARE_REVISION = 241, SR5_GET_SERIAL_NUMBER = 242,
  SR5_GET_DBASE_REVISION = 243, SR5_GET_PRODUCT_CODE = 244, SR5_GET_EQUIPMENT_CATEGORY_ID = 245, SR5_GET_MANUFACTURER_ID = 246,
  SR5_GET_VARIABLE_SET = 247, SR5_GET_STATUS = 248, SR5_GET_POLLING_PRIORITY = 249, SR5_ADDRESS_RANDOM = 250,
  SR5_ADDRESS_CHANGE = 251, SR5_ADDRESS_CLASH = 252, SR5_ADDRESS_POLL = 253, SR5_SIMPLE_POOL = 254
}
 These are message identifiers that the SR5 coin mech understands. More...

enum  teSR5_ERROR_CODES {
  SR5_REJECT_COIN = 1, SR5_INHIBIT_COIN = 2, SR5_MULTIPLE_WINDOW = 3, SR5_ACCEPT_SENSOR_TIMEOUT = 6,
  SR5_2ND_CLOSE_COIN = 8, SR5_ACCEPT_SENSOR_BLOCKED = 14, SR5_SORTER_OPTO_BLOCKED = 15, SR5_COIN_GOING_BACKWARDS = 17,
  SR5_CREDIT_SENSOR_REACHED_TOO_EARLY = 23, SR5_REJECT_COIN1 = 24, SR5_REJECT_SLUG = 25, SR5_NUM_COIN_METER_PULSES_OVERLOAD = 35,
  SR5_GAMES_OVERLOADED = 36, SR5_COIN_RETURN_MECHANISM_ACTIVATED = 254
}
 Error codes that the SR5 coin mech can return. More...

enum  teSR5_FAULT_CODES {
  SR5_EEPROM_CSUM_BAD = 1, SR5_FAULT_ON_INDUCTIVE_COILS = 2, SR5_FAULT_ON_CREDIT_SENSOR = 3, SR5_FAULT_ON_PIEZO_SENSOR = 4,
  SR5_FAULT_ON_SORTER_EXIT_SENSORS = 8, SR5_FAULT_ON_THEMISTOR = 22, SR5_TEMPERATURE_OUTSIDE_LIMITS = 34
}
enum  teSR5_STATUS_CODES { SR5_COIN_RETURN_ACTIVATED = 1 }
 Status codes returned by the SR5 coin mech can return. More...


Functions

void print_hex (unsigned char *abData, int zlen)
 print a buffer is hex and ASCII

void sr5t_PrintPacket (tsCCTALK_STANDARD_PACKET *psCctPkt)
 Given a pointer to a cctalk packet print that packet out Display the fields of a cctalk packet to standard out. These packets are displayed in normalised form for the SR5 coin mechanism.

teCCTALK_ERRORS sr5t_WaitForReply (teCCTALK_CHANNEL eCctCh, tsCCTALK_OPERATION *psCctPkt)
 After sending a packet wait for a reply from the cctalk server.

void sr5_SendCctalkOperation (teCCTALK_CHANNEL eCctCh, teSR5_CCTALK_MSG_ID eCctId, unsigned long lWaitTime, unsigned char bDestId, unsigned long lMaxRply, unsigned char bTxDataSz, unsigned char *pabTxData)
 Send a cctalk operation out to a cctalk device.

void sr5_TestChannel (teCCTALK_CHANNEL eCh)
 Send a lot of commands to a cctalk channel.

void sr5_FastQueueTest (void)
 Using the table send a whole lot of messages to each cctalk channel.

int main (void)

Variables

unsigned char abCoinInhibit1 [] = { 0xff, 0xff }
tsCCT_OP asCctOps []

Enumeration Type Documentation

enum teSR5_CCTALK_MSG_ID
 

These are message identifiers that the SR5 coin mech understands.

enum teSR5_ERROR_CODES
 

Error codes that the SR5 coin mech can return.

enum teSR5_STATUS_CODES
 

Status codes returned by the SR5 coin mech can return.


Function Documentation

int main void   ) 
 

Here is the call graph for this function:

void print_hex unsigned char *  pabData,
int  zlen
[static]
 

print a buffer is hex and ASCII

Given a buffer print the buffer in hex and in ASCII form.

Author:
Rod Boyce
Parameters:
pabData - pointer to the data to be displayed
zlen - the number of bytes to display

History

void sr5_FastQueueTest void   )  [static]
 

Using the table send a whole lot of messages to each cctalk channel.

Using the a table of cctalk messages send out a lot of cctalk messages to each cctalk channel as fast as possible and wait for the reply once all messages have been sent.

Date:
04/11/04
Author:
Rod Boyce

History

Here is the call graph for this function:

void sr5_SendCctalkOperation teCCTALK_CHANNEL  eCctCh,
teSR5_CCTALK_MSG_ID  eCctId,
unsigned long  lWaitTime,
unsigned char  bDestId,
unsigned long  lMaxRply,
unsigned char  bTxDataSz,
unsigned char *  pabTxData
[static]
 

Send a cctalk operation out to a cctalk device.

Send a cctalk operation to a device on a channel. Most operations are expecting to receive data back but the ability to send data as part of a cctalk operation is also possible. This function just waits for the operation to be returned before returning to the main code but this does not have to happen. A list of operations could be sent out and then the results checked while performing other transactions.

Date:
03/11/04
Author:
Rod Boyce
Parameters:
eCctCh - The cctalk channel to send the packet over.
eCctId - The message ID to send.
lWaitTime - The time to wait for a reply packet.
bDestAddr - The address to send that packet to.
lMaxRply - The expected maximum number of bytes to be received.
bTxDataSz - The number of bytes in the Tx packet payload.
pabTxData - The Tx buffer to send to the cctalk device

History

Here is the call graph for this function:

void sr5_TestChannel teCCTALK_CHANNEL  eCh  )  [static]
 

Send a lot of commands to a cctalk channel.

Date:
04/11/04
Author:
Rod Boyce
Parameters:
eCh - The channel to send the data out

History

Here is the call graph for this function:

void sr5t_PrintPacket tsCCTALK_STANDARD_PACKET psCctPkt  )  [static]
 

Given a pointer to a cctalk packet print that packet out Display the fields of a cctalk packet to standard out. These packets are displayed in normalised form for the SR5 coin mechanism.

Date:
03/11/04
Author:
Rod Boyce
Parameters:
psCctPkt - pointer to the cctalk packet

History

Here is the call graph for this function:

teCCTALK_ERRORS sr5t_WaitForReply teCCTALK_CHANNEL  eCctCh,
tsCCTALK_OPERATION psCctPkt
[static]
 

After sending a packet wait for a reply from the cctalk server.

After sending a packet to the cctalk server wait for a reply to be received from the server.

Date:
02/11/04
Author:
Rod Boyce
Parameters:
eCctCh - the channel to wait for a reply on.
psCctPkt - pointer to a cctalk packet to store the reply in

History

Here is the call graph for this function:


Variable Documentation

tsCCT_OP asCctOps[] [static]
 

Initial value:

{
    { SR5_SIMPLE_POOL,                         10, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE)) ,      0, NULL },
    { SR5_READ_BUFFERED_CREDIT_OR_ERROR_CODES, 30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 11, 0, NULL },
    { SR5_MODIFY_INHIBIT_STATUS,               30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE)) ,      2, abCoinInhibit1 },
    { SR5_TEST_SOLENOIDS,                     600, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE)) ,      0, NULL },
    { SR5_CALCULATE_ROM_CSUM,                1600, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 4,  0, NULL },
    { SR5_GET_FRAUD_COUNTER,                   10, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 3,  0, NULL },
    { SR5_GET_REJECT_COUNTER,                  30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 3,  0, NULL },
    { SR5_GET_BUILD_CODE,                      30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 8,  0, NULL },
    { SR5_GET_CREATION_DATE,                   30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 2,  0, NULL },
    { SR5_GET_LAST_MODIFICATION_DATE,          30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 2,  0, NULL },
    { SR5_GET_AUDIT_INFORMATION,               40, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 29, 0, NULL },
    { SR5_GET_ALARM_COUNTER,                   30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 1,  0, NULL },
    { SR5_GET_THERMISTOR_READING,              30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 1,  0, NULL },
    { SR5_GET_COMM_REVISION,                   30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 3,  0, NULL },
    { SR5_GET_COMM_STATUS,                     30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 3,  0, NULL },
    { SR5_GET_MANUFACTURER_ID,                 60, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 17, 0, NULL },
    { SR5_GET_EQUIPMENT_CATEGORY_ID,           30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 13, 0, NULL },
    { SR5_GET_PRODUCT_CODE,                    30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 13, 0, NULL },
    { SR5_GET_SOFTWARE_REVISION,               30, 2,  ((eCCT_HEADER_SIZE)+(eCCT_CSUM_SIZE))  + 7,  0, NULL },

    { 0, 0, 0, 0, 0, NULL }
}


Generated on Thu Jan 20 16:13:00 2005 for Axis cctalk sub-system by doxygen 1.3.6