Art & ScienceUser Guide for D2000DLL,
|
Because this is a DLL, the programmer interface is very simple. Initialisation is done automatically when the DLL in invoked and shutdown when it is released. This extract from the header file, D2WIN.H explains the interface.
// do_asl_events
// -------------
/*
This is called in your main event loop. Call it frequently, that is, at least every half second and preferably more, as the characters appearing on the serial ports must be cleared.
The return code is negative for errors. Otherwise, check for a deal.
If the first field in the input buffer, handed over in d2_init, contains something, you have a deal. Otherwise, you have an ok but deal-free condition.
Example code*/
while (TRUE)
{
if ((k = do_asl_events ((LPD2DATA)&input_buf, (LPSTR)report_buf)) < 0) // check for d2 line events
{
// no more ERR=22.
// if input_buf.DataSource is set, you have data
sprintf (statline, "Error %d - %s", k, report_buf); // report no data if you wish
scrput (statline, YELLOW, ONRED);
}
else // you have a response!
{
if (input_buf.DataSource)
{
// got something
if (input_buf.DataSource < 100)
d2_data_parser ();
else
asi_data_parser ();
}
else // no data but could be a message from the DLL
{
if (report_buf [0])
{
scrput (report_buf, BLACK, ONGREEN);
// ASL log-to-screen routine
report_buf [0] = 0;
}
} // end of 'got something'
} // end of 'check for response'
} // end of 'while true' loop
short FAR PASCALdo_asl_events (LPD2DATA input_buf, LPSTR report_buf);
/*
you will need to build your program with the library, 'd2000dll' for 16 bit systems or 'd200032.dll' for 32 bit systems.
*/
// =============================================================
// error message types
ER_BCF Bad d2 configuration file
ER_FMT Bad message format
ER_D2000 D2000 not responding
ER_SERIAL port setup failed
ER_SP4 Disc full. Cannot open audit trail
ERR_PRO ASL programming error
ERR_GLC returned a bad message (Report to Reuters)
ERR_GDD D2000 Reuter task is dead
// =============================================================
Back to the Computer Services index page
Back to the Art & Science quick links page
Contact: Ken Baldry at Art & Science,
17 Gerrard Road, Islington, London N1 8AY
Head office:+44(0)20 7359 6294 or e-mail him
This page's URL: http://www.art-science.com/Computer/D2000DLL/ch5.html
Last revised 20/7/2002
Copyright: Art & Science 1998-2002 All rights reserved.