Professional Documents
Culture Documents
Programmer’s Guide
B006-6042-B000
March 2003
The product described in this publication is a licensed product of NCR Corporation.
This publication supports release 01.04.00 of the NCR APTRA Advance ADE product.
It is the policy of NCR Corporation (NCR) to improve products as new technology, components,
software, and firmware become available. NCR, therefore, reserves the right to change specifications
without prior notice.
All features, functions, and operations described herein may not be marketed by NCR in all parts of
the world. In some instances, photographs are of equipment prototypes. Therefore, before using this
document, consult with your NCR representative or NCR office for information that is applicable and
current.
To maintain the quality of our publications, we need your comments on the accuracy, clarity,
organization, and value of this book.
© 1998 - 2003
By NCR Corporation
Dayton, Ohio U.S.A.
All Rights Reserved.
Federal Communications
Commission (FCC) Radio
Frequency Interference
Statement
AT&T -- PROPRIETARY
Use pursuant to Company Instructions
AT&T -- PROPRIETARY
Use pursuant to Company Instructions
AT&T -- PROPRIETARY
Use pursuant to Company Instructions
AT&T -- PROPRIETARY
Use pursuant to Company Instructions
Contents
Preface
Preface ................................................................................xxv
About this publication ...............................................xxv
Abbreviations used in this Publication ..................xxvi
Who Should Read This Publication? ......................xxvi
What Is In This Publication? ....................................xxvi
How To Use This Publication ............................... xxviii
Conventions Used .....................................................xxix
Support Information .................................................xxix
Section 1
General
General
Chapter 1
Self-Service Terminal Software
Chapter 2
PC Development Environment
Overview............................................................................. 2-1
Development Environment.............................................. 2-2
Hardware and Software Requirements ................... 2-2
Development Environment Components ............... 2-2
Chapter 3
Extending Advance ADE Runtime Functionality
Overview............................................................................. 3-1
Why Extend? ...................................................................... 3-2
When to Extend.................................................................. 3-3
How to Extend ................................................................... 3-4
Types of Extension ...................................................... 3-4
BASIC Expressions...................................................... 3-5
External C Functions................................................... 3-6
Worker Classes ............................................................ 3-7
Section 2
External C Functions
External C Functions
External C Functions
Introduction.....................................External C Functions-v
Chapter 4
Developing External C Functions
Overview.............................................................................4-1
Introduction ........................................................................4-2
Description ...................................................................4-2
Development Process..................................................4-2
Designing a Function.........................................................4-3
Naming Conventions..................................................4-3
Data Types....................................................................4-7
External Data Types ....................................................4-9
UNICODE and Advance ADE ................................4-12
File Locations ....................................................................4-15
User-created Function Directories ..........................4-16
Implementing a Function................................................4-17
General ........................................................................4-17
Exporting a Function from a DLL ...........................4-17
Guidelines for Using a Character Array ................4-18
Memory Management ..............................................4-18
Building a DLL .................................................................4-20
Project Settings...........................................................4-20
Creating a Make File .................................................4-20
Build Process ..............................................................4-21
Output File Locations ...............................................4-21
Using the Advance ADE Class mString.................4-22
Registering a Function.....................................................4-23
Registration Entry Data Types ................................4-25
Registering External Data Types.............................4-28
DLL Transfer Locations ..................................................4-29
Single Application Functions...................................4-30
Chapter 5
External C Function Examples
Overview............................................................................. 5-1
Introduction........................................................................ 5-2
File Names.................................................................... 5-2
File Locations ............................................................... 5-3
Example 1: A Calculation Using a Computer
Worker .............................................................................. 5-4
The Requirement ......................................................... 5-4
Designing the Function .............................................. 5-5
Implementing the Function ....................................... 5-6
Building the DLL......................................................... 5-7
Registering the Function ............................................ 5-7
Testing the Function ................................................... 5-7
Example 2: Data Testing Using a Tester Worker .......... 5-8
The Requirement ......................................................... 5-8
Designing the Function .............................................. 5-9
Implementing the Function ..................................... 5-10
Building the DLL....................................................... 5-10
Registering the Function .......................................... 5-11
Testing the Function ................................................. 5-11
Example 3: Signal Generation Using a Selector
Worker ............................................................................ 5-12
Section 3
Advance ADE Worker
Classes
Overview of Development
Stages.................Advance ADE Worker Classes-vi
Chapter 6
Advance ADE Application Overview
Overview............................................................................. 6-1
Advance ADE Application Basics ................................... 6-2
Flow of Control............................................................ 6-2
Control Messages ........................................................ 6-3
Advance ADE Worker Class Names........................ 6-5
Data Messages ............................................................. 6-5
Chapter 7
Design and Implementation Guidelines
Overview............................................................................. 7-1
Designing a Worker Class ................................................ 7-2
Worker Class Concurrency........................................ 7-3
Advance ADE Metaclasses ........................................ 7-3
Worker Class Design Process .................................... 7-5
Defining Literal Types.............................................. 7-19
Implementing a Worker Class ....................................... 7-23
Implementation Guidelines ..................................... 7-23
Implementing Attributes ................................................ 7-25
Example of Attribute Implementation ................... 7-27
Chapter 8
Implementation of Worker Classes
Overview.............................................................................8-1
Implementing an Abstract Worker Class .......................8-2
Implementing a Doer Loner .............................................8-3
Doer Worker Types .....................................................8-4
Doer Worker Methods ................................................8-6
Activation .....................................................................8-8
Event Processing........................................................8-13
Deactivation ...............................................................8-16
Implementing a Second Thread ..............................8-21
Implementing a Getter Loner.........................................8-26
mStringGetter.............................................................8-28
mRealGetter................................................................8-28
mIntegerGetter...........................................................8-29
mHandleGetter ..........................................................8-29
Implementing a Putter Loner.........................................8-32
mStringPutter.............................................................8-34
mRealPutter................................................................8-34
mIntegerPutter...........................................................8-35
mHandlePutter ..........................................................8-35
Implementing a Doer Coordinator................................8-38
Activation ...................................................................8-41
Event Processing........................................................8-42
Deactivation ...............................................................8-44
Implementing a Getter Coordinator .............................8-47
Implementing a Putter Coordinator..............................8-49
Implementing a Work Group.........................................8-51
Creating a Getter or Putter Work Group Type .....8-52
Chapter 9
Building and Testing Guidelines
Overview............................................................................. 9-1
Directory Structure ............................................................ 9-2
Building a Worker Class ................................................... 9-3
Automating the Build Process................................... 9-3
Building a Subclass of a Worker Class..................... 9-4
Adding a Worker Class to the Advance ADE
Runtime............................................................................. 9-5
Removing a Worker Class ......................................... 9-8
Testing a Worker Class ..................................................... 9-9
Debugging a Worker Class ............................................ 9-12
Troubleshooting............................................................... 9-13
Problems When Running the Test Application .... 9-13
Possible Problem Sources ........................................ 9-13
Chapter 10
Advance ADE Worker Class Examples
Overview...........................................................................10-1
Introduction ......................................................................10-2
File Names ..................................................................10-2
File Locations .............................................................10-2
Adding Examples to the Advance ADE
Runtime ................................................................10-3
Example Classes ...............................................................10-4
Example 1: Trace........................................................10-4
Example 2: System Time ..........................................10-4
Example 7: Simple Signaller ....................................10-4
Example 3: Date Setter ..............................................10-4
Example 9: Get Date..................................................10-4
Example 4: Switcher..................................................10-5
Example 5: String Searcher ......................................10-5
Example 6: Eject Card ...............................................10-5
Example 8: Convert Handle TM..............................10-6
Example 10: Base String............................................10-6
Example 11: Convert To Upper ...............................10-6
Appendix A
Appendices ADI-2 Interfacing
Overview............................................................................A-1
Introduction .......................................................................A-2
ADI-2 Interfacing Guidelines ..........................................A-3
ADI-2 Interfacing Example..............................................A-5
Appendix B
Debugging Your Advance ADE Application with
Visual C++™
Overview.............................................................................B-1
Introduction........................................................................B-2
Debugging on the Development PC ...............................B-3
Build Final User Application.....................................B-4
Project Settings ............................................................B-4
Test & Debug Application .........................................B-4
Debugging on an SST........................................................B-6
Debugging on a Remote PC or SST.................................B-7
Locating Errors Using MAP files...................................B-10
Appendix C
Build Errors
Overview............................................................................ C-1
What Happens When a Build Error Occurs? ......... C-1
Types of Errors ........................................................... C-1
Error Entries................................................................ C-2
What To Do When You Get a Build Error .............. C-4
Common Build Errors ...................................................... C-5
Final Build Errors.............................................................. C-7
Worker Factory Build Errors........................................... C-8
Appendix D
Modifying Advance ADE Runtime
Overview............................................................................ D-1
Appendix E
Related Documentation
Overview............................................................................ E-1
Advance ADE Documentation ....................................... E-2
Other NCR Documentation............................................. E-5
Glossary
Glossary Glossary ................................................................ Glossary-1
Index
Index Index ............................................................................Index-1
List of Figures
Chapter 1
Self-Service Terminal Software
Chapter 2
PC Development Environment
Chapter 3
Extending Advance ADE Runtime Functionality
Chapter 4
Developing External C Functions
Chapter 5
External C Function Examples
Chapter 6
Advance ADE Application Overview
Chapter 7
Design and Implementation Guidelines
Chapter 8
Implementation of Worker Classes
Chapter 9
Building and Testing Guidelines
Chapter 10
Advance ADE Worker Class Examples
Appendix A
ADI-2 Interfacing
Appendix B
Debugging Your Advance ADE Application with
Visual C++™
Appendix C
Build Errors
Appendix D
Modifying Advance ADE Runtime
Appendix E
Related Documentation
List of Tables
Chapter 1
Self-Service Terminal Software
Chapter 2
PC Development Environment
Chapter 3
Extending Advance ADE Runtime Functionality
Chapter 4
Developing External C Functions
Chapter 5
External C Function Examples
Chapter 6
Advance ADE Application Overview
Chapter 7
Design and Implementation Guidelines
Chapter 8
Implementation of Worker Classes
Chapter 9
Building and Testing Guidelines
Chapter 10
Advance ADE Worker Class Examples
Appendix A
ADI-2 Interfacing
Appendix B
Debugging Your Advance ADE Application with
Visual C++™
Appendix C
Build Errors
Appendix D
Modifying Advance ADE Runtime
Appendix E
Related Documentation
Preface
Overview
Chapter 1
Self-Service Terminal Software
Figure 1-1
SST System Software
1
Application
Self-Service
Support
Windows NT or
Windows XP
Chapter 2
PC Development Environment
Overview 2-1
Overview
Overview 2
Development Environment 2
● Advance ADE
● Self-Service Support
Chapter 3
Extending Advance ADE
Runtime Functionality
Overview 3-1
Overview
Overview 3
Why Extend? 3
When to Extend 3
Uses 3
How to Extend 3
● BASIC expressions
● External C functions
● User-created Worker Classes
Figure 3-1 shows the comparative complexity of the
types of extension.
External C Functions
Worker Classes
High
Uses 3
When to use 3
Limitations 3
Development 3
Uses 3
When to use 3
Limitations 3
Development 3
Uses 3
When to use 3
Development 3
Overview
Introduction
Chapter 4
Developing External C
Functions
Overview 4-1
Introduction 4-2
Description 4-2
Development Process 4-2
Troubleshooting 4-35
Problems When Running the Test Application 4-35
Overview
Overview 4
Introduction 4
DLL.
The properties of the function are registered with
Advance ADE so that the function can be used as if it
was a BASIC Expression.
The expression is then set up in an instance of one of the
Worker Class types mentioned above and the function is
executed.
Designing a Function 4
FunctionName( ParameterList )
DayOfWeek%()
Parameters 4
UserOutputStruct *
UserFunction( UserInputStruct * )
UserFunction( UserStructure? )
File Locations 4
Figure 4-1
Directory Structure and Registry
4
File Location
userfuns.scr
Implementing a Function 4
Building a DLL 4
created as follows:
1 Copy a Make (.mak) file from one of the supplied
examples into the function subdirectory; see
“User-created Function Directories” on page 4-16.
2 Rename the Make file with the same file name as the
function source code file.
Debug Locations 4
Release Locations 4
Registering a Function 4
DLLName
FunctionName
AliasName
ReturnType
ArgumentTypeList
short short
integer int
long long
float float
double double
char char
uinteger
uinteger ByRef
ExternalDataTypeName ByRef
You should note that putting the name of the data type
in the Returns or the Argument expressions is important
since this is used by Advance ADE for type checking in
the external data class mHandle.
Figure 4-2
DLL Transfer Locations
4
Global
Functions
Single Application
Functions
Testing a Function 4
// Must include stdio.h for the test statements but should be removed after testing
#include <stdio.h>
:
:
extern "C" /* Prevents C++ compile mangling function name */
double /* Return data type */
__declspec(dllexport)/* Make function visible outside the DLL */
Interest( double rate, int period, double amount )
{
// open the debug file and write out parameter values
FILE * DebugFile = fopen( "\\WORKING\\DEBUG.OUT", "w" );
fprintf( DebugFile, "Rate %g Period %d Amount %g\n", Rate, Period, Amount );
:
:
//write out the result of the computation and close the file
fprintf( DebugFile, "Return %g\n", (pow((1 +( NewInterestRate/100.0 )), Period )*
Amount));
fclose( DebugFile );
Once the code has been added and the function built, it is
tested by calling the function from the Test Application
with known values of rate, period and amount and
checking them against the values written to the debug.out
file.
You can also check that the return value in debug.out is
the same as the value returned to the Application.
The Visual C++™ debugger can also be used. For more
information, see Appendix B, “Debugging Your
Advance ADE Application with Visual C++™”. If you
are using mString in the external C++ function then you
will require the following type of code to write its value
to a file.
:
// To use mString in your C++ function you must include the Advance ADE Runtime header
#include <mcore.h>
// Must include fstream.h for the test statements but should be removed after testing
#include <fstream.h>
:
:
// this is the required test code for an mString called TestString
// open debug.out
ofstream DebugOut ("\\WORKING\\DEBUG.OUT");
// get length of mString text and create buffer to hold it
unsigned int Length = TestString.GetLength();
char * Buffer = new char [ Length + 1 ];
// output the mString converted to an ASCIIZ string to debug.out and close the file
DebugOut << "mString Value ";
DebugOut << TestString.ExportASCIIZ ( Buffer, 0, Length );
DebugOut.close();
:
:
Debugging a Function 4
Troubleshooting 4
Chapter 5
External C Function Examples
Overview 5-1
Introduction 5-2
File Names 5-2
File Locations 5-3
Overview
Overview 5
Introduction 5
Figure 5-1
Location of External C Function
5
Example Files
efexamn.cpp
efexamn.mak
Example 1: A Calculation
Using a Computer Worker 5
TimePeriod
Total = 1 + --------------------------------- × InitialAmount
InterestRate
100
((1 + (InterestRate/100))^TimePeriod%)
*InitialAmount
InterestRate,TimePeriod%,InitialAmount
#include <math.h>
/*
Name : Interest
Description : Function to calculate total payable with compound interest
Parameters :
Rate compound interest in percent
Period time period in years
Amount initial amount
Return :
double the initial amount plus the total compound interest
*/
page 4-28.
/*
Name : WithinLimits
Description : Function to check whether value is within limits
Parameters :
TestValue value to be checked against the limits
UpperLimit to be within limits value must be less than this value
LowerLimit to be within limits value must be greater than this
value
Return :
int returns 1 if within limits, 0 otherwise
*/
extern "C" /* Prevents C++ compiler mangling function name, specifies C linkage
*/
int /* Return Type */
__declspec(dllexport) /* Make function visible outside the DLL.*/
WithinLimits( int TestValue, int UpperLimit, int LowerLimit )
{
int WithinLimitFlag = 0;
return( WithinLimitFlag );
}
page 4-28.
#include <stdlib.h>
#include <time.h>
/*
Name : GetMonth
Description : Function which returns the current month local time
Parameters :
None
Return :
int returns month as a value between 1 and 12
*/
#ifdef DEBUG
static int month=1;
return( ( month++ % 12 ) + 1 );
#else
/* return month */
return( LocalTimePtr->tm_mon + 1 );
#endif
}
page 4-28.
#include <stdlib.h>
#include <string.h>
/*
Name : Parse
Description : Function checks target for separator returning the substring
found before the separator. The substring up to the end of the
separator is removed from the target
Parameters :
Separator Null terminated separator string
Target Null terminated string that is parsed.
A new Target string is created and will contain either
an empty string if the separator is not found or
the original string less the returned substring and
separator.
Return:
char * Null terminated string the result of the search, can
be entire target if separator not found in target.
*/
extern "C" /* Prevents C++ compiler mangling function name, specifies C linkage
*/
/* Create new string area and store the pointer in the static */
NewTarget = (char*) malloc( strlen(*Target) + 1);
/* copy the substring into the new return buffer,(calloc fills buffer
with null)*/
ReturnString = (char *) calloc(sizeof(char), LengthOfString + 1);
strncpy(ReturnString, *Target, LengthOfString);
/* move the target substring from after the separator to the start of the
target string including the null terminator */
do
{
(*Target)[StringIndex] = (*Target)[StringIndex + LengthOfString + 1];
} while((*Target)[(StringIndex++) + LengthOfString] != '\0');
}
else
{
/* separator not found so copy all of the target string to the new Return
String buffer and put an empty string into the target */
ReturnString = (char *) calloc(sizeof(char), strlen(*Target)+ 1);
strcpy(ReturnString, *Target);
**Target = '\0';
}
return( ReturnString );
}
extern "C" /* Prevents C++ compiler mangling function name, specifies C linkage
*/
__declspec(dllexport) /* Make function visible outside the DLL.*/
void FreeParseMemory( void )
{
if ( ReturnString ) free( ReturnString );
if ( NewTarget )
free( NewTarget );
page 4-28.
ConvertTimeToString 5
and
ConvertTimeToString$(Time?)
Time?
#include <stdlib.h>
#include <time.h>
#include <string.h>
}
/*
Name : GetOurLocalTime
Description : Function which returns a pointer to a tm stucture which has
the current local time and date.
Parameters :
None
Return :
struct tm * returns a pointer to a tm stucture
*/
extern "C" /* Prevents C++ compiler mangling function name, specifies C linkage
*/
__declspec(dllexport) /* Make function visible outside the DLL.*/
struct tm * /* Return Type */
GetOurLocalTime( void )
{
struct tm * LocalTimePtr;
time_t Time;
py
/* get
if( memory to hold structure
ReturnLocalTimePtr */ )
!= NULL
ReturnLocalTimePtr
{ = (struct tm * ) malloc( sizeof( struct tm ) );
memcpy( ReturnLocalTimePtr, LocalTimePtr, sizeof( struct tm ));
/*
} copy time and data stucture into buffer*/
if( ReturnLocalTimePtr != NULL )
{/* return time and date pointer */
memcpy(
return( ReturnLocalTimePtr,
ReturnLocalTimePtr ); LocalTimePtr, sizeof( struct tm ));
} }
char * DateTimeString
if( Time == NULL ) ;
{
/* convertreturn
date and time
"Need to string
Handle store */
in the input of Assigner" ;
}
if( Time == NULL )
{DateTimeString = asctime(Time) ;
return "Need Handle store in the input of Assigner" ;
}
DateTimeString = asctime(Time) ;
/* return month */
return(ReturnStringPtr);
}
extern "C"
_declspec( dllexport )
void FreeTMStruct( void )
{
if(ReturnStringPtr)
{
free( ReturnStringPtr );
}
if(ReturnLocalTimePtr)
{
free( ReturnLocalTimePtr );
}
}
page 4-28.
Overview
Introduction
Chapter 6
Advance ADE Application
Overview
Overview 6-1
Overview
Overview 6
D D
C C
C D
BroadcastStart Message 6
BroadcastEvent Message 6
BroadcastStop Message 6
Get Message 6
Put Message 6
Chapter 7
Design and Implementation
Guidelines
Overview 7-1
Overview
Overview 7
All Worker Classes fall into one and only one of these
types, which are listed next:
Abstract 7
Input Sensor
Front Key
Loner 7
Sequencer 7
Grapher 7
Figure 7-1
Worker Class Definition Window
7
● Do
● Get
● Put
● Attribute Name
● Attribute ID
● Literal Type.
Attribute Name
Attribute ID
Default Value
Description
● Group Name
● Group Type ID
● Subworker Class
● Message Types
● Signal Consumer
● Group Type Class ID
● Maximum Groups
● Minimum Subworkers
● Maximum Subworkers
● Description.
Group Name
Group Type ID
Subworker Class
Message Types
Signal Consumer
Maximum Groups
Minimum Subworkers
Maximum Subworkers
Description
● Signal Name
● Signal ID
● Description
Table 7-8 String Type Name The name which will be used in
String Literal Type Definition the APTRA Author when you
Information access this String Type
Maximum Length The maximum number of
characters that the string can
contain
Description Describes the String Type in
terms an Advance ADE
application developer would
understand
Implementing Attributes 7
Float double
Enumerated int
String mString&
● File Reference
● Point
- User Name
● Attribute ID
- ExampleText
● Literal Type
- String
● Link Attribute
● Default Value
- Default String
● Description
{
public:
Example():Text(“Default String”) {};
void set_ExampleText (mString& TextString);
private:
mString Text;
}
// This is the example attribute method that sets the attribute when executed
void mExample::set_ExampleText(mString& TextString)
{
Text = TextString;
}
Chapter 8
Implementation of Worker
Classes
Overview 8-1
Overview
Overview 8
Implementing an Abstract
Worker Class 8
Simple 8
Simple Signaller 8
Event Signaller 8
Worker Class.
The mDoer class has three methods, Start, Stop and
ProcessEvent, which are defined as deferred methods
and must be implemented in subclasses.
These three methods provide the essential behaviour of a
Doer. They allow a Doer to be activated, deactivated, to
process events and to signal. These routines will always
have the execution sequence of activate, process event,
and deactivate with only process events being called
more than once before deactivate is called.
An example declaration of a Doer Loner called
ExampleDoer is shown in the following code fragment.
// In this case set the worker message to indicate whether the task succeed or not
// Note the WorkerMsg can be anything you want; it is interpreted
// only by your worker
WorkerMsg.Length = 1;
WorkerMsg.Data[0] = (BYTE) Result;
// PostEvent posts the user event WorkerMsg onto the Event Queue defined by
// aEventContext. The first parameter is the "this" of this worker. When the
// user event is checked in ProcessEvent and Stop, these methods will check
// for User events from "this" worker.
aEventContext->PostEvent( (mEvent*) new mUserEvent ( this, &WorkerMsg ));
};
// Stack size is dependent on your thread but 16K is the minimum allocation for Advance
ADE
unsigned StackSize = 16384;
As you can see from the code example, you are not
required to do anything except to pass the parameters to
the default Event handler and return any Signal it
generates.
// Define Signal ID
enum SignalIds {SUCCESS = 1};
// the message must be deleted by the worker who it was destined for but
// the user event must not be deleted.
delete WorkerMsg;
}
// Any other unrecognised event is passed to the default event handler and any
// signal generated is returned.
return( EventDefault(aEventContext, aWorkContext, aEvent);
};
As you can see from the code example you are not
required to do anything except return a NULL Signal
once this has been done your Doer is deactivated.
With this type of Doer, the Stop method checks for a late
User Event destined for itself from the Event Queue.
If there is a User Event it is processed, with a late Signal
being generated if required. If there is no late Event, a
NULL Signal is returned.
An example of the code required for this is as follows:
// Define Signal ID
enum SignalIds {SUCCESS = 1};
mSignal * mExampleDoer::Stop(mEventContext * aEventContext,
mWorkContext& aWorkContext )
{
// get any user event meant for this Doer from event queue
mUserEvent* aUserEvent = aEventContext->GetUserEvent(this);
// dispose of the User Event since it was meant for this Worker Class
// User Events should never be deleted only disposed of.
aEventContext->DisposeEvent(aUserEvent);
// This is the structure that contains the information which is passed to the second
// thread.
typedef struct
{
// pointer to the Event Context that can be used to post User Events to the
// Doer that activated the thread.
mEventContext * pEventContext;
// pointer to the Doer that activated the thread.
ExampleDoer * pSelf;
} ExampleThreadParams;
//mExampleDoer class
class mExampleDoer :
public mDoer,
public mConcreteWorker
{
public:
//
// In this part is all the normal public Doer Interface
//
// you define the thread function as a friend method which uses the
// _cdecl calling convention
friend void _decl ExampleThread(void * ThreadParams);
};
// In this case set the worker message to indicate whether the task succeed or not
// Note the WorkerMsg can be anything you want; it is interpreted
// only by your worker
WorkerMsg.Length = 1;
WorkerMsg.Data[0] = (BYTE) Result;
// Post the User Event with the message WorkerMsg onto the EventContext that is passed
// as a parameter from the Doer that created the thread.
// You do this so that the User Event is posted onto that Doer’s event queue.
// The first parameter is the pointer to the Doer that started the thread so that
// in your Doers ProcessEvent and Stop methods they will recognise as one of their
// User Events and process it.
(pParams->pEventContext)->PostEvent(
(mEvent*) new mUserEvent(pParams->pSelf,&WorkerMsg ));
mHandleGetter mStringGetter
mRealGetter
mIntegerGetter
mHandlePutter mIntegerPutter
mRealPutter
mStringPutter
GetData: Form 1 8
GetData: Form 2 8
This form of the function does not check that the Handle
ID is correct.
This is NOT a safe method of data transfer since type
checking is disabled.
GetID 8
Implementing a Doer
Coordinator 8
voidStart(mEventContext * aEventContext,
mWorkContext& aExecutingContext,
mWorkContext * aForwardContext);
mSignal* Stop(mEventContext * aEventContext,
mWorkContext& aWorkContext) ;
mSignal* ProcessEvent( mEventContext * aEventContext,
mWorkContext& aWorkContext,
const mEvent * aEvent);
};
As you can see from the code example, you are not
required to do anything, except pass the parameters on
to your Subworkers. However, you can add your own
code, so that the Coordinator has its own functionality.
As you can see from the code example, you must test the
Signal returned by the Subworkers, and if it is NULL
pass the event to the default event handler.
Then the Signal from the Subworkers or the default
event handler should be the returned as this is not a
Signal Consumer.
// Deactivate the active Doer Work Group and return a late signal
return ActiveDoerWorkgroup->BroadcastStop( aEventContext,
aWorkContext );
};
As you can see from the code example, you are not
required to do anything except pass the parameters on to
your Subworkers, and simply return any late Signal
generated since this is not a Signal Consumer.
If your Coordinator produces its own Signal it must
compare this with the late Signal returned by the
Subworkers and return the signal with the highest
priority.
Implementing a Getter
Coordinator 8
Once you have the address of the Getter, you can simply
call one of the methods defined in the Getter, to get the
data in the format that you require.
Thus, the code to get the data from an mStringGetter
Subworker which is the only Subworker in a particular
Work Group would be as follows:
// This is a section of code you would require to get data from a String Getter
If you wish, you could put the data that you get from the
Subworker through a validation process.
This section of code can be used anywhere in any of the
Coordinators.
Implementing a Putter
Coordinator 8
Then, when you have the address of the Putter, you can
simply call one of the methods defined in the Putter to
give the data in the format that you require.
Thus, the code to give the data to a mStringPutter
Subworker which is the only Subworker in a particular
Work Group would be as follows:
// This is a section of code you would require to give data to a String Getter
class mExampleClass...
{
public:
.
private:
// Create the Work Group pointer type data member
pmWorkGroup WorkGroupPointer;
.
};
// This is the class constructor which initialises the WorkGroupPointer to null
mExampleClass::mExampleClass(): WorkGroupPointer(NULL)
{
}
class mExampleClass...
{
public:
.
private:
// Create the array of Work Group pointer type data memeber
pmWorkGroup WorkGroupPointerArray[MAXIMUM_NUMBER_OF_WORK_GROUPS+1];
.
};
// This is the class constructor which initialises the WorkGroupPointerArray to null
mExampleClass::mExampleClass()
{
// null array of pointers to work groups
for(int i=0;i<=MAXIMUM_NUMBER_OF_WORK_GROUPS;i++)
{
WorkGroupPointerArray[i] = NULL;
}
}
class mExampleClass...
{
public:
.
mWorkGroup * Add_Format_WorkGroup(unsigned short WGId);
void Remove_Format_WorkGroup(unsigned short WGId);
private:
.
};
Chapter 9
Building and Testing
Guidelines
Overview 9-1
Troubleshooting 9-13
Problems When Running the Test Application 9-13
Possible Problem Sources 9-13
Overview
Overview 9
Directory Structure 9
Figure 9-1
Worker Class Directory Structure
9
Figure 9-2
Worker Class Runtime File
9
Locations
DLL files
.h files
LIB files
DLL files
.h files
LIB files
:
// Must include fstream.h for the test statements but should be removed after testing
#include <fstream.h>
// create the DebugOut stream
ofstream DebugOut;
// constructor
mSimpleDoer::mSimpleDoer()
{
// open the stream, and output that the class has been instantiated
DebugOut.open ("\\GLOBAL\\DEBUG.OUT");
DebugOut.setf(ios::unitbuf);
DebugOut << "Simple Doer instantiated \n";
}
// destructor
mDoerDoer::~mSimpleDoer()
{
DebugOut << "deleted \n";
DebugOut.close();
}
// start method
void mSimpleDoer::Start(mEventContext * aEC, mWorkContext &, mWorkContext * )
{
// write out that the start procedure is being executed
DebugOut << "Start \n";
:
// write out any user events being posted
DebugOut << "User Event " << USER_MESSAGE << "\n";
}
// stop method
mSignal * mSimpleDoer::Stop(mEventContext * aEC, mWorkContext & aWC )
{
//write out the stop procedure is being executed
DebugOut << "Stop \n";
:
//write out the late user event found
DebugOut << "Late Event \n";
:
// write out the late signal
DebugOut << "Late Signal " << "SUCCESS" << "\n";
:
}
// ProcessEvent method
mSignal* mSimpleDoer::ProcessEvent(mEventContext* aEC, mWorkContext& aWC,
const mEvent* aEvent)
{
// output that process event is being executed
DebugOut << "Process Event\n";
:
// output any signals that have occurred
DebugOut << "Signal " << "SUCCESS" << "\n";
:
}
Once the code has been added and the Worker Class
built, it is tested by executing the test Application.
The execution of the test Application is then
compared against what has been written to the
debug.out file.
Troubleshooting 9
This error occurs because you have not put the Worker
Class DLL in the <GLOBAL>\TEST\DLL directory.
● Message Types
● Metaclass
When you try and use your Worker Class, but it has
been entered incorrectly, you will find you cannot
use it as intended.
● Signals
● Work Groups
Chapter 10
Advance ADE Worker Class
Examples
Overview 10-1
Introduction 10-2
File Names 10-2
File Locations 10-2
Adding Examples to the Advance ADE Runtime 10-3
Overview
Overview 10
Introduction 10
Figure 10-1
Worker class Runtime File
10
Locations
wcexam1.cpp
wcexam1.h
wcexam1.mak
Example Classes 10
Appendix A
ADI-2 Interfacing
Overview A-1
Introduction A-2
Overview
Overview A
Introduction A
● You can use NVRAM interface calls but you will find
that the Advance ADE persistent stores are much
easier to use for any new code you develop.
● You may find that errors occur when you build the
source that uses the ADI-2 function calls. If these are
problems due to parameter types, try explicitly
typing the parameters.
For example:
ADI_LOOKUP_NAME((unsigned char*) "MCRW", &mcrw_sadd);
#define SEND_LENGTH 1
#define SEND_DATA 1
// define the structure for use in the ADI_SEND
struct WRITEDATA{
unsigned int LENGTH;
unsigned char DATA[SEND_LENGTH];
};
// define the command
struct WRITEDATA COMMAND = { SEND_LENGTH, SEND_DATA };
Appendix B
Debugging Your Advance
ADE Application with Visual
C++™
Overview B-1
Introduction B-2
Overview
Overview B
Introduction B
Debugging on the
Development PC B
with <GLOBAL>\test\support\system\apptest.exe as
the executable for debug and the SSDS_APP_DLL
Application component ID as the Program argument.
Additional DLLs B
Figure B-1
Local debugging —
B
Project Settings
Figure B-2
Local debugging —
B
Additional DLLs
Debugging on an SST B
Debugging on a Remote PC or
SST B
Figure B-3
Remote debugging
B
— Project Settings
Figure B-4
Remote debugging
B
— Additional DLLs
Appendix C
Build Errors
Overview C-1
What Happens When a Build Error Occurs? C-1
Types of Errors C-1
Error Entries C-2
What To Do When You Get a Build Error C-4
Overview
Overview C
Variables Meaning
You should only look for the first error message in out.txt
since this is the one listed in this appendix. Only if a
message could be ambiguous are there other error
messages.
If you were building a Worker Factory when the error
occurred, you must search through the Worker Factory
and Common Build Errors sections to find the error
message.
Similarly, if you were building a Final Application when
the error occurred, you should search through the Final
and Common Build Errors sections to find the error
message.
Once you have found the error message you will find a
list of possible causes and recommended actions. You
should go through this list, until you have found the
cause.
Perform the recommended action, and then try the build
again.
<GroupTypeID> has not been defined Check that <ClassID> has been defined
in <ClassInclude>. properly in <ClassInclude>.
Worker Class lib not found during Check that you have copied the
build. Worker Class lib to
<GLOBAL>\TEST\LIB.
<AttributeID> has not been defined in Check that <AttributeID> has been
<ClassInclude>. defined in <ClassInclude>.
There is a mismatch between the Check that <ClassID> is the same as the
<ClassID> defined in the Author and Worker Class ID defined in
the one defined in <ClassInclude>. <ClassInclude>.
The Class created in the Author Make sure that the source code for the
doesn’t have the corresponding source class for which the error occurred
code required. exists.
<GTClassID> has not been defined in Check that <ClassID> has been defined
<ClassInclude>. properly in <ClassInclude>.
You have mistakenly made <ClassID> Remove the Superclass from the
a subclass of the <SuperclassID> in the Worker Class’s Superclass list in the
Author. Author.
<GTClassID> has not been defined in Check that <ClassID> has been defined
<ClassInclude>. properly in <ClassInclude>.
“Error C2039:
‘Remove_<ClassID>::Remove_<GroupTypeID>_WorkGroup(unsigned short)’: is
not a member of <ClassID>”
Appendix D
Modifying Advance ADE
Runtime
Overview D-1
Overview
Overview D
ASCII/EBCDIC Conversion
Functions D
This array has 128 entries; one for each of the ASCII
values. Each entry is the EBCDIC equivalent of the
ASCII value.
0x40, /* 20 Space*/
nmake /f cfuns2.mak
Appendix E
Related Documentation
Overview E-1
Overview
Overview E
APTRA Advance ADE, PDF Describes how to install and use the
User’s Guide APTRA Author and Runtime
B006-6038 Components to design, develop
and maintain a self-service
application.
SST Device personaS SST Device Paper This publication describes how to
Simulator Simulator For Windows use the SST Device Simulator to test
NT™, User’s Guide a self-service application under
B006-6041 development.
Glossary
Index 0
ADI_SETUP_MONITOR A-3
ADI_TERMINATE A-4–A-5
ADI-2 Interfacing
example of a Worker Class using ADI-2 calls
Eject Card 10-5
introduction A-2
when to use the interface A-2
Advance ADE Data Types
see also data types 4-3
Advance ADE Metaclasses 7-3
Abstract 7-3
Grapher 7-4
Loner 7-4
Sequencer 7-4
Advance ADE Runtime
modifying D-1
Advance ADE System
description 8-3
Advance ADE Worker Classes 3-2
Application
data transfer in the Application 6-3
Application Layer of the Self Service Terminal Software 1-1
ASCIIZ string 4-26
Assigner Worker 4-2
parsing data using an external C function 5-16
Attribute Type 7-6
example implementation 7-27
class and function definition 7-29
example of use in the Worker Class, Trace 10-4
identify new Attribute Types 7-7
default value 7-10
description 7-10
ID 7-8
Link 7-10
Literal Type 7-8
Enumerated 7-9
File Reference 7-9
Float 7-9
Integer 7-9
Point 7-9
String 7-9
Name 7-8
implementing 7-25
defining the default value 7-25
note on responsibility for the declaration 7-26
return type 7-26
the Attribute method 7-25
defining the name 7-25
defining the parameters 7-25
example declaration 7-25
using the Attribute ID 7-25
Author Worker Class Definition 7-2, 9-7
BASIC Expressions
B comparison with other types of Runtime extension 3-5
_beginthread
Borland OS/2 C++ Function see thread 8-12
BroadcastEvent
use of 8-43
BroadcastEvent Message 6-4
BroadcastStart
use of 8-41
BroadcastStart Message 6-4
BroadcastStop
use of 8-45
BroadcastStop Message 6-4
build errors
final build C-1
Worker Factory C-1
Build Factory 9-7–9-8
development
building
DLL file location 4-15
debugging 4-34
design 4-3
implementation 4-17
registration
Registery File location 4-15
responsibility for registering 4-23
testing 4-31
using harness 4-31
using test Application 4-31
development introduction 4-2, 5-2
directory figure 4-15
example of function syntax 4-3
examples
Assigner Worker 5-16, 5-24
Computer Worker 5-4
Handle Store Worker 5-24
location of examples
figure 5-3
Selector Worker 5-12
Tester Worker 5-8
exporting function from DLL 4-17
external data type 4-9
example of function syntax 4-11
example of use 5-24
registering 4-28
using a Handle 4-10
using a String 4-10
function syntax 4-3
memory allocation and deallocation 4-12
naming convention 4-3
function alias 4-4
functions 4-3
naming conventions
function parameters 4-5
parameters and return types
values and references use same Advance ADE Data
Type 4-8
file locations
F external C function DLL 4-15
initial blank USERFUNS.SCR 4-16
out.txt Build Factory error file C-1
USERFUNS.SCR 4-16
wcexam1.mak used to automate the Worker Class build
process 9-3
Worker Class examples 10-2
File Reference Literal Type 7-9, 7-20
class equivalent, mString& 7-26
default extension 7-20
description 7-20
implementation notes 7-27
Name 7-20
final application
build errors C-1
building 9-8
float C/C++ data type
equivalent Advance ADE Data Type, Real 4-7
equivalent Registration Keyword, float 4-26
Float Literal Type 7-9, 7-20
C++ equivalent, double 7-26
description 7-20
minimum and maximum value 7-20
Name 7-20
significant digits 7-20
float* C/C++ data type
equivalent Advance ADE Data Type, Real 4-7
equivalent Registration Keyword, float ByRef 4-27
Get
G Data Message 6-6, 7-6, 8-26
GetNumWorkers
mTBasicWorkGroup member function 8-47, 8-49
use of 8-52
Getter 7-6
as a Getter or Putter Coordinator 7-17
data conversions 8-27, 8-33
diagram of the class hierarchy 8-27, A-5
implementing a subclass 8-26
mHandleGetter see mHandleGetter Worker
Class 8-29
mIntegerGetter see mIntegerGetter Worker Class 8-29
mRealGetter see mRealGetter Worker Class 8-28
mStringGetter see mStringGetter Worker Class 8-28
Worker Class ID 8-52
Getter Coordinator
can also be a Putter or Doer Coordinator 7-17
example of getting data from a Getter Subworker 8-48
example Worker Class
Date Setter 10-4–10-5
String Searcher 10-5
getting the address of a Subworker using GetWorker 8-47
inheritance
I direct 7-16
indirect 7-16
int C/C++ data type 4-8
equivalent Advance ADE Data Type, Integer 4-7
equivalent Registration Keyword, integer 4-26
int* C/C++ data type 4-8
equivalent Advance ADE Data Type, Integer 4-7
equivalent Registration Keyword, integer ByRef 4-27
Integer Advance ADE Data Type
equivalent C/C++ types
int 4-7
int* 4-7
long 4-7
long* 4-7
short 4-7
short* 4-7
unsigned int 4-7
unsigned int* 4-7
unsigned long 4-7
NVRAM 1-2
N
out.txt
O Build Factory error file C-1
test application
T for testing external C functions 4-31
troubleshooting 9-13
test harness
for testing external C functions 4-31
Tester Worker 4-2
example of data testing using an external C function 5-8
testing data using an external C function 5-8
thread 8-3
for a Worker Class that handles multiple threads see the
Multi-Thread Signaller Doer 8-5
implementing a second thread 8-21
example declaration of a thread function 8-22
example implementation of a thread function 8-24
minimum stack size 8-21
sending a User Event after the Doer is deactivated 8-21
starting the thread
example code 8-12
use _beginthread see also _beginthread 8-12
thread parameter structure
declaring the structure 8-22
initializing the values 8-12
using the values 8-24
main Application 8-41, 8-43, 8-45
main Application thread A-3
NCR welcomes your feedback on this publication. Your comments can be of great value in
helping us improve our information products.
You may send your comments to us electronically. See over for details.
Circle the numbers below that best represent your opinion of this publication.
Fold
Use the following address to send your comments to us electronically:
e-mail - user.feedback@scotland.ncr.com
Cut
If we may contact you concerning your comments, please fill in the information below:
Name
Organisation:
Company:
Address:
Phone: Fax:
Thank you for your evaluation of this publication. Fold the form where indicated, tape
(please do not staple), affix stamp and drop in the mail.
F8763-0695
Fold
Affix
Postage
Stamp
Here