Using the cctalk PDF for the SR5 coin mechanism this code will perform some test functions on a SR5.
#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:

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 [] |
|
|
These are message identifiers that the SR5 coin mech understands.
|
|
|
Error codes that the SR5 coin mech can return.
|
|
|
Status codes returned by the SR5 coin mech can return.
|
|
|
|
Here is the call graph for this function:

|
||||||||||||
|
print a buffer is hex and ASCII Given a buffer print the buffer in hex and in ASCII form.
History |
|
|
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.
History |
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||
|
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.
History |
Here is the call graph for this function:

|
|
Send a lot of commands to a cctalk channel.
History |
Here is the call graph for this function:

|
|
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.
History |
Here is the call graph for this function:

|
||||||||||||
|
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.
History |
Here is the call graph for this function:

|
|
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 }
}
|
1.3.6