Captive Data's Bettordata Engine Version 2 for retail SubscriptionData.com users

Application Programmer Interface

The Captive Data Engine publishes an API interface in the form of a Windows DLL. The DLL cannot function without the engine resident so if it cannot communicate with the engine it will attempt to execute the engine minimized to the taskbar. The DLL and the engine must remain together as the DLL will only execute the engine if it is found in the same directory.

Once running the API gives access to all engine data including racesheets, results, meeting lists and the current bettordata system time. The interface is a very simple one that can be completely controlled by 19 function calls. These calls are:

There is also a table which lists in-channel error codes which can be returned by GetMeet(), GetRace(), GetQuinella(), GetAPN(), GetTime() and Result().

InitAPI

The InitAPI function is used by the API to initiate it's internal systems and determine whether the engine is online and available to access. If the engine is not resident it will attampt to load the engine and once again attempt to communicate with it. If it fails an error is returned.

Definition Syntax

	int InitAPI( void );

Example

	#include "api.h"
	
	if( InitAPI() != CDBDE_ENGINE_ONLINE )
	{
		MessageBox ( NULL, "The data engine is unavailable", "Error", MB_OK );
		exit(0);
	}
	
	//at this point we can call any other functions we desire
	//dont forget to call CloseAPI() and FreeLibrary() when done
	

Return Values

CDBDE_ENGINE_ONLINEThe engine is online and responding
CDBDE_ENGINE_UNAVAILABLEThe engine is offline and could not be automatically started

Remarks

InitAPI() must be called prior to calling any other functions of the API as this call initializes communications with the engine therefore no comms between the engine and API can be supported without a successful call to InitAPI(). The Auto-loading of the Engine by the API is triggered by InitAPI(). This function in cooperation with the CloseAPI function should also be used when a comms error causes a function to return the value CDBDE_COMMSERROR_INITAGAIN. Should you get this error condition returned byt any function, your program should call CloseAPI() followed by InitAPI() to re-initialize communications between the API and the engine.


CloseAPI

The CloseAPI() function has a single purpose, that of closing all previously established connections between the API and the engine.

Definition Syntax

	void CloseAPI( void );

Example

	#include "api.h"

	//assuming we have previously opened the API with a call to InitAPI()
	CloseAPI();
	

Return Values

None

Remarks

CloseAPI() must be called once all activity via the API has ceased and prior to the call to the windows FreeLibrary() to unload the DLL. This function should also be called and followed by a call to InitAPI() on reception of the error condition CDBDE_COMMSERROR_INITAGAIN from any API function. This function does not close the engine down, even if it was automatically loaded using IniAPI(), this is so that should a user close your program down, incoming data will not be lost while your application is offline.


GetMeet

The GetMeet() function returns an ASCII comma delimited list of meeting information formatted into one line per meeting. See the Data Definition for a detailed explanation of the data this call returns.

Definition Syntax


	int GetMeet(
		char *buf, 	//pointer to a buffer of sufficient size to accept the information
		int *len	//pointer to an integer which has be preset to the size of 'buf' above
	);

Example

	#include "api.h"
	
	char *buffer;
	int retval;
	int buflen=16384;	//reasonable amount of memory to allow for up to 50 meets
	
	if( ( buffer = (char *)malloc(buflen) ) == NULL)
	{
		MessageBox ( NULL, "Error Allocating Memory For The Meetings Buffer", "Error", MB_OK );
		exit(0);
	}
	
	if( ( retval = GetMeet( buffer, &buflen ) )!= CDBDE_COMMAND_COMPLETED ) //we have the data ?
	{
		free(buffer);
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling GetMeet()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling GetMeet()", "Error", MB_OK );
		return FALSE;
	}
    
	//Here the buffer contains the list of meets for the day.
	//Process the data into a meetings array, grid or other suitable container
	
	free(buffer);	
	return TRUE;

Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the buffer contains the meet.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request.

Remarks

GetMeets() must be preceded by a successful call to InitAPI(). See the section on Data Definition for a detailed description of the data deposited in the passed buffer. On return 'buf' contains the requested data if CDBDE_COMMAND_COMPLETED was returned from the call. On return 'len' is set to the length of the data contained in 'buf' if CDBDE_COMMAND_COMPLETED was returned from the call.


GetTime

The Gettime() function allows your software to accurately schedule events relative to the bettordata system time. Computer system clocks often vary from the true time and cannot be reliably used as even a couple of minute variation would render a time critical racing package useless.

Definition Syntax


	int GetTime(
		char *buf, 	//pointer to a buffer of sufficient size to accept the information
		int *len	//pointer to an integer which has be preset to the size of 'buf' above
	);

Example

	#include "api.h"
	
	char *buffer;
	int retval;
	int buflen=128;	//reasonable amount of memory to allow for the time to be returned
	
	if( ( buffer = (char *)malloc(buflen) ) == NULL)
	{
		MessageBox ( NULL, "Error Allocating Memory For The Meetings Buffer", "Error", MB_OK );
		exit(0);
	}
	
	if( ( retval = GetTime( buffer, &buflen ) )!= CDBDE_COMMAND_COMPLETED ) //we have the data ?
	{
		free(buffer);
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling GetTime()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling GetTime()", "Error", MB_OK );
		return FALSE;
	}
    
	//Here the buffer contains the 8 character text version of the time HH:MM:SS
	
	free(buffer);	
	return TRUE;

Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the buffer contains the time.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request.

Remarks

GetTime() must be preceded by a successful call to InitAPI(). See the section on Data Definition for a detailed description of the data deposited in the passed buffer. On return 'buf' contains the requested data if CDBDE_COMMAND_COMPLETED was returned from the call. On return 'len' is set to the length of the data contained in 'buf' if CDBDE_COMMAND_COMPLETED was returned from the call.


GetRace

The GetRace() function is the call used to deliver live race sheets from the engine.

Definition Syntax


	int GetRace(
		char *buf, 	//pointer to a buffer of sufficient size to accept the information
		int *len,	//pointer to an integer which has been preset to the size of 'buf' above
		int refstate,	//state which codes are being used as a reference in 'meet' below
		char *meet,	//meeting code or reference defining the race meeting or an automatic action to take (see below)
		char *race,	//race number (as a string) or automatic action to take (see below)
		int state,	//the state (TAB) to return approximate dividends or abstractions for
		int pool,	//the pool to return approximate dividends or abstractions for
		int updates,	//the number of update columns to include
		int summary	//flag whether to summarise updates into known intevals or provide actual updates
	);

Parameters

buf A pointer to a buffer of sufficient size to accept the information. As some records returned here can be quite voluminous. It is best too keep this around 16K to be sure larger races can be returned in full.
len Pointer to an integer which has been preset to the size of buf above. On return the integer pointed to will contain the number of bytes used. If this value remains the same upon successful return (ie the full size of buf), this indicates that the response may have been truncated.
Refstate Represents the state which codes are being used as a reference in the meet parameter below. These references include a range of automated references which can automatically return meetings based on next or last race to jump relative to the current time. These codes are:
FlagMeaning
CDBDE_REFCODE_TABCORPUse the Tabcorp code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tabcorp
CDBDE_REFCODE_TABLIMITEDUse the Tab Limited code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tab Limited
CDBDE_REFCODE_UNITABUse the UniTAB code passed in the meet parameter matching one of those in the table returned by GetMeets() for UniTAB
CDBDE_REFCODE_NEXT_TO_JUMPReturn a racesheet for the next race to jump across all meets.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MINReturn a racesheet for the next race to jump but pausing for 1 minute before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD2MINReturn a racesheet for the next race to jump but pausing for 2 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD3MINReturn a racesheet for the next race to jump but pausing for 3 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD4MINReturn a racesheet for the next race to jump but pausing for 4 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD5MINReturn a racesheet for the next race to jump but pausing for 5 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD6MINReturn a racesheet for the next race to jump but pausing for 6 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD7MINReturn a racesheet for the next race to jump but pausing for 7 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD8MINReturn a racesheet for the next race to jump but pausing for 8 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD9MINReturn a racesheet for the next race to jump but pausing for 9 minutes before switching.
CDBDE_REFCODE_LAST_TO_JUMPReturn a racesheet for the last race to have jumped previously.
CDBDE_REFCODE_2NDLAST_TO_JUMPReturn a racesheet for the 2nd last race to have jumped previously.
CDBDE_REFCODE_3RDLAST_TO_JUMPReturn a racesheet for the 3rd last race to have jumped previously.
CDBDE_REFCODE_4THLAST_TO_JUMPReturn a racesheet for the 4th last race to have jumped previously.
CDBDE_REFCODE_5THLAST_TO_JUMPReturn a racesheet for the 5th last race to have jumped previously.
CDBDE_REFCODE_6THLAST_TO_JUMPReturn a racesheet for the 6th last race to have jumped previously.
CDBDE_REFCODE_7THLAST_TO_JUMPReturn a racesheet for the 7th last race to have jumped previously.
CDBDE_REFCODE_8THLAST_TO_JUMPReturn a racesheet for the 8th last race to have jumped previously.
CDBDE_REFCODE_9THLAST_TO_JUMPReturn a racesheet for the 9th last race to have jumped previously.
meet This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to the 2 character race code used by each state to identify a meeting. This code often varies from TAB to TAB and should be matched to the codes returned for each TAB by the GetMeets() function. For example if GetMeets() returns a Tab Limited code for a meeting as "PR" this can be passed as the meets parameter if the value for refstate, is CDBDE_REFCODE_TABLIMITED.
race This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to either a race number in the range "1" to "12" or it refers to a special code which defines next or last race to jump of the meeting defined in the meets parameter. The special values and their meanings are:
FlagMeaning
"N0"Next race to jump at this meet
"N1"Next race to jump at this meet, pausing for 1 minute after the jump
"N2"Next race to jump at this meet, pausing for 2 minutes after the jump
"N3"Next race to jump at this meet, pausing for 3 minutes after the jump
"N4"Next race to jump at this meet, pausing for 4 minutes after the jump
"N5"Next race to jump at this meet, pausing for 5 minutes after the jump
"N6"Next race to jump at this meet, pausing for 6 minutes after the jump
"N7"Next race to jump at this meet, pausing for 7 minutes after the jump
"N8"Next race to jump at this meet, pausing for 8 minutes after the jump
"N9"Next race to jump at this meet, pausing for 9 minutes after the jump
"L0"Last race to jump at this meet
"L1"Last race to jump at this meet, assuming a pause for 1 minutes after the jump
"L2"Last race to jump at this meet, assuming a pause for 2 minutes after the jump
"L3"Last race to jump at this meet, assuming a pause for 3 minutes after the jump
"L4"Last race to jump at this meet, assuming a pause for 4 minutes after the jump
"L5"Last race to jump at this meet, assuming a pause for 5 minutes after the jump
"L6"Last race to jump at this meet, assuming a pause for 6 minutes after the jump
"L7"Last race to jump at this meet, assuming a pause for 7 minutes after the jump
"L8"Last race to jump at this meet, assuming a pause for 8 minutes after the jump
"L9"Last race to jump at this meet, assuming a pause for 9 minutes after the jump
state This parameter is required regardless of the setting of refstate This value defines which TAB to return dividends or abstractions for. There are currently 3 TABs to choose from:
FlagMeaning
CDBDE_STATE_TABCORPReturn dividends or abstractions for Tabcorp (Victorian TAB)
CDBDE_STATE_TABLIMITEDReturn dividends or abstractions for Tab Limited (New South Wales TAB)
CDBDE_STATE_UNITABReturn dividends or abstractions for UniTAB (Queensland & various other state TABs)
In the case of the parameter refstate specifying one of the next to jump or last to jump codes, the state selected here will define the code used in the returned data. In this case if you specify Tab Limited here, the race page returned will quote the Tab Limited code as the race code rather that it's usual behaviour of returning the code for the TAB selected by the refstate parameter.
pool This parameter is required regardless of the setting of refstate The value defines which pool you require the race sheets to quote, dividend pool or abstractions. There are currently 5 pools you can request data for:
FlagMeaning
CDBDE_POOL_WINReturn Win approximates for the TAB specified in state
CDBDE_POOL_PLACEReturn Place approximates for the TAB specified in state
CDBDE_POOL_QUINELLAReturn Quinella Abstractions for the TAB specified in state, check availability in Data Definition
CDBDE_POOL_EXACTAReturn Exacta Abstractions for the TAB specified in state, check availability in Data Definition
CDBDE_POOL_TRIFECTAReturn Trifecta Abstractions for the TAB specified in state, check availability in Data Definition
Check the section one Data Definitions for finer detail of the data returned for each pool and to check availability of exotics for each state as at time of writing, not all states supplied information on exotics.
updates This parameter is required regardless of the setting of refstate The value defines how many price update columns should appear to the right of the returned race sheet. The valid range is 3 to 30.
summary This parameter is required regardless of the setting of refstateThe value defines whether you require every actual update to be shown or whether you wish the updates to be summarised into known intervals. The values are:
FlagMeaning
CDBDE_MODE_NOSUMMARYDeliver just the last n updates as specified in the updates parameter
CDBDE_MODE_SUMMARIZEDeliver updates summarize into known intervals and specified in the Data Definition.
If the summary mode is CDBDE_MODE_SUMMARIZE, the maximum number or intervals returned is 13, all larger values set via updates will be truncated to 13.

Example

	#include "api.h"
	
	//we use fixed stack based buffers this time
	char buffer[3][16384];
	int buflen[3]={ 16384,16384,16384 };	//reasonable amount of memory to allow for a full racesheet
		
	//comment in the ones you wish to try
	
	//standard race sheet for Tabcorp Win pool for the PR 3 (using the Tab Limited code)
	//retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_TABLIMITED, "PR", "3", CDBDE_STATE_TABCORP, CDBDE_POOL_WIN, 10, CDBDE_MODE_NOSUMMARY );
	
	//the same race sheet selected by Tabcorp's code instead
	//retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_TABCORP, "2R", "3", CDBDE_STATE_TABCORP, CDBDE_POOL_WIN, 10, CDBDE_MODE_NOSUMMARY );
	
	//the same meet but this time requesting next to jump rather than race 3
	//retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_TABCORP, "2R", "N2", CDBDE_STATE_TABCORP, CDBDE_POOL_WIN, 10, CDBDE_MODE_NOSUMMARY );
	
	//this time we are asking for the next to jump out of all meets, holding for 1 minute after the jump
	//retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MIN, "", "", CDBDE_STATE_TABCORP, CDBDE_POOL_WIN, 10, CDBDE_MODE_NOSUMMARY );
	
	//this time the same sheet but summarize the data into known intervals so we can do an interstate 
	//comparison of the prices at different stages of the market, each states request is shown.
	//retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MIN, "", "", CDBDE_STATE_TABCORP, CDBDE_POOL_WIN, 4, CDBDE_MODE_SUMMARIZE );
	//retval = GetRace( buffer[1], &buflen[1], CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MIN, "", "", CDBDE_STATE_TABLIMITED, CDBDE_POOL_WIN, 4, CDBDE_MODE_SUMMARIZE );
	//retval = GetRace( buffer[2], &buflen[2], CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MIN, "", "", CDBDE_STATE_UNITAB, CDBDE_POOL_WIN, 4, CDBDE_MODE_SUMMARIZE );
		
	//this time a plain Tabcorp place pool at known intervals so we can look ath the market trend for each runner
	//retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MIN, "", "", CDBDE_STATE_TABCORP, CDBDE_POOL_PLACE, 10, CDBDE_MODE_SUMMARIZE );
	
	//now to analyse overs between the win and trifecta pools we need to get 2 sheets and then process them to compare
	//retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MIN, "", "", CDBDE_STATE_TABLIMITED, CDBDE_POOL_WIN, 10, CDBDE_MODE_SUMMARIZE );
	//retval = GetRace( buffer[1], &buflen[1], CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MIN, "", "", CDBDE_STATE_TABLIMITED, CDBDE_POOL_TRIFECTA, 10, CDBDE_MODE_SUMMARIZE );
	
	//now back to the last race to jump on Melbourne Dogs using the UniTAB code and showing the Qld win Pool, last 20 updates
	retval = GetRace( buffer[0], &buflen[0], CDBDE_REFCODE_UNITAB, "VG", "L0", CDBDE_STATE_UNITAB, CDBDE_POOL_WIN, 20, CDBDE_MODE_NOSUMMARY );		
	
	if( retval!=CDBDE_COMMAND_COMPLETED ) //we have the data ?
	{
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling GetRace()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling GetRace()", "Error", MB_OK );
		return FALSE;
	}
    
	//Process the data however you wish
	
	return TRUE;
Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the buffer contains the racesheet.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request.

Remarks

GetRace() must be preceded by a successful call to InitAPI(). See the section on Data Definition for a detailed description of the data deposited in the passed buffer. On return 'buf' contains the requested data if CDBDE_COMMAND_COMPLETED was returned from the call. On return 'len' is set to the length of the data contained in 'buf' if CDBDE_COMMAND_COMPLETED was returned from the call.


Result

The Result() function is the call used to deliver live race sheets from the engine. The selection of parameters is very similar to those for GetRace().

Definition Syntax


	int Result(
		char *buf, 	//pointer to a buffer of sufficient size to accept the information
		int *len,	//pointer to an integer which has been preset to the size of 'buf' above
		int refstate,	//state which codes are being used as a reference in 'meet' below
		char *meet,	//meeting code or reference defining the race meeting or an automatic action to take (see below)
		char *race,	//race number (as a string) or automatic action to take (see below)
		int state	//the state (TAB) to return result for
	);

Parameters

buf A pointer to a buffer of sufficient size to accept the information. It is best too keep this around 2K to be sure larger results can be returned in full.
len Pointer to an integer which has been preset to the size of buf above. On return the integer pointed to will contain the number of bytes used. If this value remains the same upon successful return (ie the full size of buf), this indicates that the response may have been truncated.
Refstate Represents the state which codes are being used as a reference in the meet parameter below. These references include a range of automated references which can automatically return meetings based on next or last race to jump relative to the current time. These codes are:
FlagMeaning
CDBDE_REFCODE_TABCORPUse the Tabcorp code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tabcorp
CDBDE_REFCODE_TABLIMITEDUse the Tab Limited code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tab Limited
CDBDE_REFCODE_UNITABUse the UniTAB code passed in the meet parameter matching one of those in the table returned by GetMeets() for UniTAB
CDBDE_REFCODE_NEXT_TO_JUMPReturn a racesheet for the next race to jump across all meets.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MINReturn a racesheet for the next race to jump but pausing for 1 minute before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD2MINReturn a racesheet for the next race to jump but pausing for 2 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD3MINReturn a racesheet for the next race to jump but pausing for 3 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD4MINReturn a racesheet for the next race to jump but pausing for 4 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD5MINReturn a racesheet for the next race to jump but pausing for 5 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD6MINReturn a racesheet for the next race to jump but pausing for 6 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD7MINReturn a racesheet for the next race to jump but pausing for 7 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD8MINReturn a racesheet for the next race to jump but pausing for 8 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD9MINReturn a racesheet for the next race to jump but pausing for 9 minutes before switching.
CDBDE_REFCODE_LAST_TO_JUMPReturn a racesheet for the last race to have jumped previously.
CDBDE_REFCODE_2NDLAST_TO_JUMPReturn a racesheet for the 2nd last race to have jumped previously.
CDBDE_REFCODE_3RDLAST_TO_JUMPReturn a racesheet for the 3rd last race to have jumped previously.
CDBDE_REFCODE_4THLAST_TO_JUMPReturn a racesheet for the 4th last race to have jumped previously.
CDBDE_REFCODE_5THLAST_TO_JUMPReturn a racesheet for the 5th last race to have jumped previously.
CDBDE_REFCODE_6THLAST_TO_JUMPReturn a racesheet for the 6th last race to have jumped previously.
CDBDE_REFCODE_7THLAST_TO_JUMPReturn a racesheet for the 7th last race to have jumped previously.
CDBDE_REFCODE_8THLAST_TO_JUMPReturn a racesheet for the 8th last race to have jumped previously.
CDBDE_REFCODE_9THLAST_TO_JUMPReturn a racesheet for the 9th last race to have jumped previously.
Options for automatic next to jump are valid but have no relevance in the context of results as if the race has not jumped yet it is not possible that a result has been posted.
meet This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to the 2 character race code used by each state to identify a meeting. This code often varies from TAB to TAB and should be matched to the codes returned for each TAB by the GetMeets() function. For example if GetMeets() returns a Tab Limited code for a meeting as "PR" this can be passed as the meets parameter if the value for refstate, is CDBDE_REFCODE_TABLIMITED.
race This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to either a race number in the range "1" to "12" or it refers to a special code which defines next or last race to jump of the meeting defined in the meets parameter. The special values and their meanings are:
FlagMeaning
"N0"Next race to jump at this meet
"N1"Next race to jump at this meet, pausing for 1 minute after the jump
"N2"Next race to jump at this meet, pausing for 2 minutes after the jump
"N3"Next race to jump at this meet, pausing for 3 minutes after the jump
"N4"Next race to jump at this meet, pausing for 4 minutes after the jump
"N5"Next race to jump at this meet, pausing for 5 minutes after the jump
"N6"Next race to jump at this meet, pausing for 6 minutes after the jump
"N7"Next race to jump at this meet, pausing for 7 minutes after the jump
"N8"Next race to jump at this meet, pausing for 8 minutes after the jump
"N9"Next race to jump at this meet, pausing for 9 minutes after the jump
"L0"Last race to jump at this meet
"L1"Last race to jump at this meet, assuming a pause for 1 minutes after the jump
"L2"Last race to jump at this meet, assuming a pause for 2 minutes after the jump
"L3"Last race to jump at this meet, assuming a pause for 3 minutes after the jump
"L4"Last race to jump at this meet, assuming a pause for 4 minutes after the jump
"L5"Last race to jump at this meet, assuming a pause for 5 minutes after the jump
"L6"Last race to jump at this meet, assuming a pause for 6 minutes after the jump
"L7"Last race to jump at this meet, assuming a pause for 7 minutes after the jump
"L8"Last race to jump at this meet, assuming a pause for 8 minutes after the jump
"L9"Last race to jump at this meet, assuming a pause for 9 minutes after the jump
Options for automatic next to jump are valid but have no relevance in the context of results as if the race has not jumped yet it is not possible that a result has been posted.
state This parameter is required regardless of the setting of refstate This value defines which TAB to return results for. There are currently 3 TABs to choose from:
FlagMeaning
CDBDE_STATE_TABCORPReturn results for Tabcorp (Victorian TAB)
CDBDE_STATE_TABLIMITEDReturn results for Tab Limited (New South Wales TAB)
CDBDE_STATE_UNITABReturn results for UniTAB (Queensland & various other state TABs)
In the case of the parameter refstate specifying one of the next to jump or last to jump codes, the state selected here will define the code used in the returned data. In this case if you specify Tab Limited here, the race page returned will quote the Tab Limited code as the race code rather that it's usual behaviour of returning the code for the TAB selected by the refstate parameter.

Example

	#include "api.h"
	
	//we use fixed stack based buffers this time
	char buffer[2048];
	int buflen=2048;	//reasonable amount of memory to allow for a full result
		
	//get the result for Sydney Harness race 5 on UniTAB selected by the UniTAB code
	retval = Result( buffer, &buflen, CDBDE_REFCODE_UNITAB, "ST", "5", CDBDE_STATE_UNITAB);
	
	if( retval!=CDBDE_COMMAND_COMPLETED ) //we have the data ?
	{
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling Result()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling Result()", "Error", MB_OK );
		return FALSE;
	}
    
	//Process the data however you wish
	
	return TRUE;
Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the buffer contains the racesheet.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request.

Remarks

Result() must be preceded by a successful call to InitAPI(). See the section on Data Definition for a detailed description of the data deposited in the passed buffer. On return 'buf' contains the requested data if CDBDE_COMMAND_COMPLETED was returned from the call. On return 'len' is set to the length of the data contained in 'buf' if CDBDE_COMMAND_COMPLETED was returned from the call.


GetID

The GetID() function allows your software to access information about the current subscription status. In the case of a decoder it reveals the decoder's internal serial ID. For other delivery methods, should they become available, the GetID() call will deliver different information in some fields but expiry information and general format will remain unchanged. This function was added to accommodate requests from developers for a method of accessing something unique about a user's subscription to accommodate easy copyright protection as well as being able to inform users at an application level when their license will lapse.

Definition Syntax


	int GetID(
		char *buf, 	//pointer to a buffer of sufficient size to accept the information
		int *len	//pointer to an integer which has be preset to the size of 'buf' above
	);

Example

	#include "api.h"
	
	char *buffer;
	int retval;
	int buflen=128;	//reasonable amount of memory to allow for the time to be returned
	
	if( ( buffer = (char *)malloc(buflen) ) == NULL)
	{
		MessageBox ( NULL, "Error Allocating Memory For The GetID Buffer", "Error", MB_OK );
		exit(0);
	}
	
	if( ( retval = GetID( buffer, &buflen ) )!= CDBDE_COMMAND_COMPLETED ) //we have the data ?
	{
		free(buffer);
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling GetID()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling GetID()", "Error", MB_OK );
		return FALSE;
	}
    
	//Here the buffer contains the subscription information in the format
	//OK ID type,internal_id,valid,days_left
	//On decoders, type is always 1 to indicate a hardware decoder is in use.
    	
	free(buffer);	
	return TRUE;

Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the buffer contains the information.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request.

Remarks

GetID() must be preceded by a successful call to InitAPI(). See the section on Data Definition for a detailed description of the data deposited in the passed buffer. On return 'buf' contains the requested data if CDBDE_COMMAND_COMPLETED was returned from the call. On return 'len' is set to the length of the data contained in 'buf' if CDBDE_COMMAND_COMPLETED was returned from the call.


LoadShadow

The LoadShadow() function instructs the engine to load a dayfile containing all of the information for a full day of racing. This feature was added to accommodate requests from developers to be able to orchestrate the loading of information from the data CDs provided via SubscriptionData.com. Using this call a program can cycle through the files on the data CD and analyse as much as a year or more of data to test theories on past races. The call only expects a full pathname to the day shadow file to be loaded. The shadow files are identical to the file autoback.txt that the engine writes every few minutes to shadow it's contents to disk so that data is not lost in the case of a reboot. On the data CDs the files are renamed to the YYYYMMDD.txt format and the data within is standard ASCII text.

Definition Syntax


	int LoadShadow(
		char *filename 	//pointer to a null ended string containing a full path to the shadow file to load
	);

Example

	#include "api.h"
	
	if(LoadShadow("D:\\20040517.txt")==CDBDE_COMMAND_COMPLETED)
	{
	    //the file was loaded, access the data for 20040517 as required
	    
	}

Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the shadow file loaded.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request (ie the file wasn't found or could not be opened).

Remarks

LoadShadow() must be preceded by a successful call to InitAPI().


GetQuinella,GetExacta,GetTrifecta,GetFirstFour,GetDailyDouble,GetRunningDouble,GetQuadrella,GetQuadTrend

The GetQuinella(), GetExacta(), GetTrifecta(), GetFirstFour(), GetDailyDouble(), GetRunningDouble(), GetQuadrella() and GetQuadTrend() functions are the calls used to deliver live exotics snapshots from the engine. The selection of parameters is very similar to those for Result().

Definition Syntax


	int GetQuinella(
		char *buf, 	//pointer to a buffer of sufficient size to accept the information
		int *len,	//pointer to an integer which has been preset to the size of 'buf' above
		int refstate,	//state which codes are being used as a reference in 'meet' below
		char *meet,	//meeting code or reference defining the race meeting or an automatic action to take (see below)
		char *race,	//race number (as a string) or automatic action to take (see below)
		int state	//the state (TAB) to return exotics for	
	);	//note: same format for GetExacta, GetTrifecta,GetFirstFour,GetDailyDouble,GetRunningDouble & GetQuadrella

Parameters

buf A pointer to a buffer of sufficient size to accept the information. It is best too keep this around 16K as some exotic formats can be quite voluminous and you need to be sure larger responses can be returned in full.
len Pointer to an integer which has been preset to the size of buf above. On return the integer pointed to will contain the number of bytes used. If this value remains the same upon successful return (ie the full size of buf), this indicates that the response may have been truncated.
Refstate Represents the state which codes are being used as a reference in the meet parameter below. These references include a range of automated references which can automatically return meetings based on next or last race to jump relative to the current time. These codes are:
FlagMeaning
CDBDE_REFCODE_TABCORPUse the Tabcorp code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tabcorp
CDBDE_REFCODE_TABLIMITEDUse the Tab Limited code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tab Limited
CDBDE_REFCODE_UNITABUse the UniTAB code passed in the meet parameter matching one of those in the table returned by GetMeets() for UniTAB
CDBDE_REFCODE_NEXT_TO_JUMPReturn a racesheet for the next race to jump across all meets.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MINReturn a racesheet for the next race to jump but pausing for 1 minute before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD2MINReturn a racesheet for the next race to jump but pausing for 2 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD3MINReturn a racesheet for the next race to jump but pausing for 3 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD4MINReturn a racesheet for the next race to jump but pausing for 4 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD5MINReturn a racesheet for the next race to jump but pausing for 5 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD6MINReturn a racesheet for the next race to jump but pausing for 6 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD7MINReturn a racesheet for the next race to jump but pausing for 7 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD8MINReturn a racesheet for the next race to jump but pausing for 8 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD9MINReturn a racesheet for the next race to jump but pausing for 9 minutes before switching.
CDBDE_REFCODE_LAST_TO_JUMPReturn a racesheet for the last race to have jumped previously.
CDBDE_REFCODE_2NDLAST_TO_JUMPReturn a racesheet for the 2nd last race to have jumped previously.
CDBDE_REFCODE_3RDLAST_TO_JUMPReturn a racesheet for the 3rd last race to have jumped previously.
CDBDE_REFCODE_4THLAST_TO_JUMPReturn a racesheet for the 4th last race to have jumped previously.
CDBDE_REFCODE_5THLAST_TO_JUMPReturn a racesheet for the 5th last race to have jumped previously.
CDBDE_REFCODE_6THLAST_TO_JUMPReturn a racesheet for the 6th last race to have jumped previously.
CDBDE_REFCODE_7THLAST_TO_JUMPReturn a racesheet for the 7th last race to have jumped previously.
CDBDE_REFCODE_8THLAST_TO_JUMPReturn a racesheet for the 8th last race to have jumped previously.
CDBDE_REFCODE_9THLAST_TO_JUMPReturn a racesheet for the 9th last race to have jumped previously.
meet This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to the 2 character race code used by each state to identify a meeting. This code often varies from TAB to TAB and should be matched to the codes returned for each TAB by the GetMeets() function. For example if GetMeets() returns a Tab Limited code for a meeting as "PR" this can be passed as the meets parameter if the value for refstate, is CDBDE_REFCODE_TABLIMITED.
race This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to either a race number in the range "1" to "12" or it refers to a special code which defines next or last race to jump of the meeting defined in the meets parameter. The special values and their meanings are:
FlagMeaning
"N0"Next race to jump at this meet
"N1"Next race to jump at this meet, pausing for 1 minute after the jump
"N2"Next race to jump at this meet, pausing for 2 minutes after the jump
"N3"Next race to jump at this meet, pausing for 3 minutes after the jump
"N4"Next race to jump at this meet, pausing for 4 minutes after the jump
"N5"Next race to jump at this meet, pausing for 5 minutes after the jump
"N6"Next race to jump at this meet, pausing for 6 minutes after the jump
"N7"Next race to jump at this meet, pausing for 7 minutes after the jump
"N8"Next race to jump at this meet, pausing for 8 minutes after the jump
"N9"Next race to jump at this meet, pausing for 9 minutes after the jump
"L0"Last race to jump at this meet
"L1"Last race to jump at this meet, assuming a pause for 1 minutes after the jump
"L2"Last race to jump at this meet, assuming a pause for 2 minutes after the jump
"L3"Last race to jump at this meet, assuming a pause for 3 minutes after the jump
"L4"Last race to jump at this meet, assuming a pause for 4 minutes after the jump
"L5"Last race to jump at this meet, assuming a pause for 5 minutes after the jump
"L6"Last race to jump at this meet, assuming a pause for 6 minutes after the jump
"L7"Last race to jump at this meet, assuming a pause for 7 minutes after the jump
"L8"Last race to jump at this meet, assuming a pause for 8 minutes after the jump
"L9"Last race to jump at this meet, assuming a pause for 9 minutes after the jump
state This parameter is required regardless of the setting of refstate This value defines which TAB to return results for. There are currently 3 TABs to choose from:
FlagMeaning
CDBDE_STATE_TABCORPReturn results for Tabcorp (Victorian TAB)
CDBDE_STATE_TABLIMITEDReturn results for Tab Limited (New South Wales TAB)
CDBDE_STATE_UNITABReturn results for UniTAB (Queensland & various other state TABs)
In the case of the parameter refstate specifying one of the next to jump or last to jump codes, the state selected here will define the code used in the returned data. In this case if you specify Tab Limited here, the race page returned will quote the Tab Limited code as the race code rather that it's usual behaviour of returning the code for the TAB selected by the refstate parameter.

Example

	#include "api.h"
	
	//we use fixed stack based buffers this time
	char buffer[16384];
	int buflen=16384;	//reasonable amount of memory to allow for a full response
		
	//get the exacta table for Sydney Harness race 5 on UniTAB selected by the UniTAB code
	retval = GetExacta( buffer, &buflen, CDBDE_REFCODE_UNITAB, "ST", "5", CDBDE_STATE_UNITAB);
	
	if( retval!=CDBDE_COMMAND_COMPLETED ) //we have the data ?
	{
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling GetExacta()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling GetExacta()", "Error", MB_OK );
		return FALSE;
	}
    
	//Process the data however you wish
	
	return TRUE;
Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the buffer contains the racesheet.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request.

Remarks

GetQuinella(),GetExacta() and GetTrifecta() must be preceded by a successful call to InitAPI(). See the section on Data Definition for a detailed description of the data deposited in the passed buffer. On return 'buf' contains the requested data if CDBDE_COMMAND_COMPLETED was returned from the call. On return 'len' is set to the length of the data contained in 'buf' if CDBDE_COMMAND_COMPLETED was returned from the call.


GetAPN

The GetAPN function is used to deliver live APN snapshots from the engine. The selection of parameters is very similar to those for Result() and exotics except it does not require a state parameter to be specified as the APN is not state specific.

Realeased on beta - 20081208 in Version 2.1.2 of the Captive Data Engine available on request to support@subscriptiondata.com

Definition Syntax


	int GetAPN(
		char *buf, 	//pointer to a buffer of sufficient size to accept the information
		int *len,	//pointer to an integer which has been preset to the size of 'buf' above
		int refstate,	//state which codes are being used as a reference in 'meet' below
		char *meet,	//meeting code or reference defining the race meeting or an automatic action to take (see below)
		char *race	//race number (as a string) or automatic action to take (see below)
	);

Parameters

buf A pointer to a buffer of sufficient size to accept the information. It is best too keep this around 16K as some exotic formats can be quite voluminous and you need to be sure larger responses can be returned in full.
len Pointer to an integer which has been preset to the size of buf above. On return the integer pointed to will contain the number of bytes used. If this value remains the same upon successful return (ie the full size of buf), this indicates that the response may have been truncated.
Refstate Represents the state which codes are being used as a reference in the meet parameter below. These references include a range of automated references which can automatically return meetings based on next or last race to jump relative to the current time. These codes are:
FlagMeaning
CDBDE_REFCODE_TABCORPUse the Tabcorp code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tabcorp
CDBDE_REFCODE_TABLIMITEDUse the Tab Limited code passed in the meet parameter matching one of those in the table returned by GetMeets() for Tab Limited
CDBDE_REFCODE_UNITABUse the UniTAB code passed in the meet parameter matching one of those in the table returned by GetMeets() for UniTAB
CDBDE_REFCODE_NEXT_TO_JUMPReturn a racesheet for the next race to jump across all meets.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD1MINReturn a racesheet for the next race to jump but pausing for 1 minute before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD2MINReturn a racesheet for the next race to jump but pausing for 2 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD3MINReturn a racesheet for the next race to jump but pausing for 3 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD4MINReturn a racesheet for the next race to jump but pausing for 4 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD5MINReturn a racesheet for the next race to jump but pausing for 5 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD6MINReturn a racesheet for the next race to jump but pausing for 6 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD7MINReturn a racesheet for the next race to jump but pausing for 7 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD8MINReturn a racesheet for the next race to jump but pausing for 8 minutes before switching.
CDBDE_REFCODE_NEXT_TO_JUMP_HOLD9MINReturn a racesheet for the next race to jump but pausing for 9 minutes before switching.
CDBDE_REFCODE_LAST_TO_JUMPReturn a racesheet for the last race to have jumped previously.
CDBDE_REFCODE_2NDLAST_TO_JUMPReturn a racesheet for the 2nd last race to have jumped previously.
CDBDE_REFCODE_3RDLAST_TO_JUMPReturn a racesheet for the 3rd last race to have jumped previously.
CDBDE_REFCODE_4THLAST_TO_JUMPReturn a racesheet for the 4th last race to have jumped previously.
CDBDE_REFCODE_5THLAST_TO_JUMPReturn a racesheet for the 5th last race to have jumped previously.
CDBDE_REFCODE_6THLAST_TO_JUMPReturn a racesheet for the 6th last race to have jumped previously.
CDBDE_REFCODE_7THLAST_TO_JUMPReturn a racesheet for the 7th last race to have jumped previously.
CDBDE_REFCODE_8THLAST_TO_JUMPReturn a racesheet for the 8th last race to have jumped previously.
CDBDE_REFCODE_9THLAST_TO_JUMPReturn a racesheet for the 9th last race to have jumped previously.
meet This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to the 2 character race code used by each state to identify a meeting. This code often varies from TAB to TAB and should be matched to the codes returned for each TAB by the GetMeets() function. For example if GetMeets() returns a Tab Limited code for a meeting as "PR" this can be passed as the meets parameter if the value for refstate, is CDBDE_REFCODE_TABLIMITED.
race This parameter is only important if the value for refstate is CDBDE_REFCODE_TABCORP, CDBDE_REFCODE_TABLIMITED or CDBDE_REFCODE_UNITAB, otherwise it is ignored. This null ended string sting refers to either a race number in the range "1" to "12" or it refers to a special code which defines next or last race to jump of the meeting defined in the meets parameter. The special values and their meanings are:
FlagMeaning
"N0"Next race to jump at this meet
"N1"Next race to jump at this meet, pausing for 1 minute after the jump
"N2"Next race to jump at this meet, pausing for 2 minutes after the jump
"N3"Next race to jump at this meet, pausing for 3 minutes after the jump
"N4"Next race to jump at this meet, pausing for 4 minutes after the jump
"N5"Next race to jump at this meet, pausing for 5 minutes after the jump
"N6"Next race to jump at this meet, pausing for 6 minutes after the jump
"N7"Next race to jump at this meet, pausing for 7 minutes after the jump
"N8"Next race to jump at this meet, pausing for 8 minutes after the jump
"N9"Next race to jump at this meet, pausing for 9 minutes after the jump
"L0"Last race to jump at this meet
"L1"Last race to jump at this meet, assuming a pause for 1 minutes after the jump
"L2"Last race to jump at this meet, assuming a pause for 2 minutes after the jump
"L3"Last race to jump at this meet, assuming a pause for 3 minutes after the jump
"L4"Last race to jump at this meet, assuming a pause for 4 minutes after the jump
"L5"Last race to jump at this meet, assuming a pause for 5 minutes after the jump
"L6"Last race to jump at this meet, assuming a pause for 6 minutes after the jump
"L7"Last race to jump at this meet, assuming a pause for 7 minutes after the jump
"L8"Last race to jump at this meet, assuming a pause for 8 minutes after the jump
"L9"Last race to jump at this meet, assuming a pause for 9 minutes after the jump

Example

	#include "api.h"
	
	//we use fixed stack based buffers this time
	char buffer[16384];
	int buflen=16384;	//reasonable amount of memory to allow for a full response
		
	//get the APN racesheet for Sydney Harness race 5 selected by the UniTAB code
	retval = GetAPN( buffer, &buflen, CDBDE_REFCODE_UNITAB, "ST", "5");
	
	if( retval!=CDBDE_COMMAND_COMPLETED ) //we have the data ?
	{
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling GetAPN()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling GetAPN()", "Error", MB_OK );
		return FALSE;
	}
    
	//Process the data however you wish
	
	return TRUE;
Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully and the buffer contains the racesheet.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().
CDBDE_COMMSERROR_INVALIDThe engine responded with a negative response to the request.

Remarks

GetAPN() must be preceded by a successful call to InitAPI(). See the section on Data Definition for a detailed description of the data deposited in the passed buffer. On return 'buf' contains the requested data if CDBDE_COMMAND_COMPLETED was returned from the call. On return 'len' is set to the length of the data contained in 'buf' if CDBDE_COMMAND_COMPLETED was returned from the call.


EngineToSysTray,EngineFromSystray

The EngineToSysTray function is used to instruct the engine to minimize itself to the system tray. The EngineFromSysTray function is used to instruct the engine to pop itself from the system tray and become visible. If either fail an error is returned.

Definition Syntax

	int EngineToSysTray( void );
int EngineFromSysTray( void );

Example

	#include "api.h"
	
	int retval;
	
	//tell the engine to minimize itself to the system tray
	retval=EngineToSysTray();
	
	if( retval!=CDBDE_COMMAND_COMPLETED )
	{
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling EngineToSysTray()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling EngineToSysTray()", "Error", MB_OK );
		return FALSE;
	}    
	

Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().

Remarks

EngineToSysTray() and EngineFromSysTray() must be preceded by a successful call to InitAPI().


SuspendCapture,ResumeCapture

The SuspendCapture function is used to instruct the engine to cease the capture of data (without disconnecting if on internet) so that historic shadow files can be loaded and analysed. It is expected that once this activity is completed the application will then call ResumeCapture() and then AutoDownload()

If it fails an error is returned.

Definition Syntax

	int SuspendCapture( void );
int ResumeCapture( void );

Example

	#include "api.h"
	
	int retval;
	
	//tell the engine to cease capturing data 
	retval=SuspendCapture();
	
	if( retval!=CDBDE_COMMAND_COMPLETED )
	{
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling SuspendCapture()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling SuspendCapture()", "Error", MB_OK );
		return FALSE;
	}    
	

Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().

Remarks

SuspendCapture() and ResumeCapture() must be preceded by a successful call to InitAPI().


AutoDownload

The AutoDownload function is used to instruct the engine to download the latest data from the server. It is important to ensure that this is not executed too often as after 8 downloads in a 24 hour period any new requests will be rejected by the server. It is also not a good idea to do this close to the jump of a race you are likely to bet on as the download file is only generated evey 5 minutes so at the worst case you could miss or lose up to 5 minutes worth of the most recent updates. It is however well worth doing this at least once a day (preferrably well before the first jump) to ensure you get the early morning market information.

Definition Syntax

	int AutoDownload( void );

Example

	#include "api.h"
	
	int retval;
	
	//tell the engine to download the latest data
	retval=SuspendCapture();
	
	if( retval!=CDBDE_COMMAND_COMPLETED )
	{
		if( retval == CDBDE_COMMSERROR_INITAGAIN )
		{
			MessageBox ( NULL, "A Communication Error Has Occurred Calling AutoDowload()", "Error", MB_OK );
			CloseAPI();
			if( InitAPI() != CDBDE_ENGINE_ONLINE )
			{
				MessageBox ( NULL, "The Data Engine Is No Longer Available", "Error", MB_OK );
				exit(0);
			}			
		}
		else
			MessageBox ( NULL, "An Error Condition Was Returned From The Engine When Calling AutoDowload()", "Error", MB_OK );
		return FALSE;
	}    
	

Return Values

CDBDE_COMMAND_COMPLETEDThe request was answered successfully.
CDBDE_COMMSERROR_INITAGAINA comms error has occurred, you will need to re-initialize using CloseAPI() and InitAPI().

Remarks

AutoDowload() must be preceded by a successful call to InitAPI().


In Channel Error Table

Some soft errors generate an "In-Channel" error message. In this case the API call will appear to succeed but the contents of the buffer will contain an error message instead of the data you requested. The messages start with a numeric code followed by a human readable response. These responses are listed here:

OK HH:MM:SS or OK ?????? HH:MM:SSNo Error, data follows. ?????? is replaced by a request specific message in some cases
ER1 Unknown CommandThe command issued is unknown - this should not occur via the API
ER2 Result OverflowThe result of the command was too large to buffer in the space provided by the caller
ER3 Buffer FullThe communication buffer between the API and the engine is full. The request could not be processed
ER4 Command Too Long/Short (n/256)The command issued by the API was either zero bytes or more than 256 bytes - this should not occur via the API
ER5 Selector RejectedNow redundant
ER6 Invalid Parameter To CommandAn invalid parameter value was received
ER7 Meeting Not FoundThe meeting code you have supplied could not be successfully matched to a meeting on record
ER8 Race Not FoundThe race number you have supplied could not be successfully matched to a race at that meeting
ER9 State Code Not ValidThe state code you gave was not valid
ER10 Pool Code Not ValidThe pool code you gave was not valid
ER11 No Updates Available For This RaceWhile the race was found, no updates are available yet for this TAB
ER12 No Result Available Yet For This RaceWhile the race was found, no result is available yet for this TAB
ER13 No Shadow File Found Or File ErrorThe file you specified to load was not found
ER14 Quinella OverflowThe response from the command was too large to buffer in the space provided by the caller
ER15 No Quinella Information FoundWhile the race was found, no quinella information is available yet for this TAB
ER16 Exacta OverflowThe response from the command was too large to buffer in the space provided by the caller
ER17 No Exacta Information FoundWhile the race was found, no exacta information is available yet for this TAB
ER18 Trifecta OverflowThe response from the command was too large to buffer in the space provided by the caller
ER19 No Trifecta Information FoundWhile the race was found, no trifecta information is available yet for this TAB
ER20 MultiExotic OverflowThe response from the command was too large to buffer in the space provided by the caller
ER21 No MultiExotic Information FoundWhile the race was found, the exotic information requested is not available yet for this TAB
ER22 APN OverflowThe response from the command was too large to buffer in the space provided by the caller
ER23 No APN Information FoundWhile the race was found, the APN information requested is not available for this race.
ER999 Unknown Error (n)An undocumented error was generated, the error number is identified in brackets