Dokumen - Tips - Doc00310 Verix Evo Act Programmers Guide
Dokumen - Tips - Doc00310 Verix Evo Act Programmers Guide
VeriFone, the V eriFone l ogo, Verix eV o terminals are registered trademarks o f VeriFone. Other brand na mes o r trademarks
associated with VeriFone products and services are trademarks of VeriFone, Inc.
All other brand names and trademarks appearing in this manual are the property of their respective holders.
Comments? Please e-mail all comments on this document to your local VeriFone support team.
VeriFone Systems
2099 Gateway Place, Suite 600
San Jose, CA, 95110 USA
(800) VeriFone (837-4366)
www.verifone.com
VeriFone Part Number DOC00310, Revision B
CONTENTS
CHAPTER 1
Introduction Audience. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Manual Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Syntax Notation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Code Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
CHAPTER 2
Getti ng Started Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
wit h Verix eVo ACT Building Applications Referencing a Shared Library. . . . . . . . . . . . . . . . . . . 17
Library Resides in Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
CHAPTER 3
Programmers Function Calls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Quick Reference
CHAPTER 4
Ap pl icat io n Id le Integrating the AIE into an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Engine Programmer-Defined Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Application-Defined Idle Loop Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Handling CANCEL Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Slow Poll function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Fast Poll function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Application Idle Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Branch Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Function Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Event Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
System Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Periodic Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Application Idle Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
CHAPTER 5
Message/Data Message File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Entry Engine TXOFILE Utility. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
File Type and Compression Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Message File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Message/Data Entry Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
CHAPTER 6
ISO 8583 Message ISO 8583 Engine Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Interface Engin e ISO 8583 Bitmaps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Message Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
ISO 8583 Engine Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
C ONTENTS
Engine Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Engine Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Incorporating the Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Global Data and Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Global Defines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Global Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Typical Host/Terminal Packet Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Application Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Map Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Map Manipulation Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Field Table Construction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Variant Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Computed Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Convert Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Conversion Routines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Packet Assembly and Disassembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
ISO 8583 Message Interface Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 7
ISO 8583 Prot oco l ISO 8583 Protocol Engine Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Engine Programmer-Defined Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
mdm_tr_8583 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
def_valid_8583 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
prot_8583() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
check_8583_tpdu_msg_id() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
process_8583_request() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
CHAPTER 8
PIP Engine Compiling Source Code Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Programmer-Defined Functions/Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
PIP Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
PIP Engine and Application Construction Toolkit . . . . . . . . . . . . . . . . . . . . . 80
Modular Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
ISO 8583 Protocol. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
ISO 8583 Message Engine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
The Field Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
The Convert Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Variant Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Computed Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
ISO 8583 Protocol Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Protocol 8583 Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Programmer-Defined Setup Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Integrating the PIP Engine Into Your Application . . . . . . . . . . . . . . . . . . . . . . . . 89
AMEX Validation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
The Validation Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
PIP Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Troubleshooting PIP Application Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
PIP/ISO 8583 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
C ONTENTS
CHAPTER 9
Data Capture Keyed File System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Engine Application Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Data Capture Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Example Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
C H A P T E R 10
Modem Engine Modem Engine Functions and Macros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
MDM_READ_BLK() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
MDM_RESET_ERROR() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
MDM_STATUS(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
MDM_WRITE_BLK() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
XMODEM.H Listings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
XMODEM.H Structures and Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Modem Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Example Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
C H A P T E R 11
Report Formatter Incorporating the Report Engine in an Application . . . . . . . . . . . . . . . . . . . . . . 118
Conditional Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Report Conversion Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Report Format Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Report Format File Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Example Format File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Global Variables Declaration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Global #defines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Global Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Sample Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Report Formatter Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Example Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
C H A P T E R 12
Database Lib rary Database Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
File Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Database File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Index File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
File Storage Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
File Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Database Library Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
C H A P T E R 13
Printer Drivers Verix eVo Based Terminal ITPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Downloadable User Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Downloadable Printer Logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Printing Monochrome Bitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Printer Driver Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Example Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
C ONTENTS
CHAPTER 14
Function Calls AC Library Function Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
AC Library Function Calls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
act_kbd_pending_test() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
append_char(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
atox(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
beep() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
bitfun(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
card_parse() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
chars2int() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
chk_card_rdr(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
chk_luhn() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
CHK_TIMEOUT() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
clock_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
clock2int() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
ctons1() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
cvt_ym() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
delete_char(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
display() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
display_at() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
display_new() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
do_compression() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
dsp_strs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
ERR_BEEP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
f_dollar() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
fieldcnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
fieldfix() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
fieldray() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
fieldvar() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
set_chars_per_key_value(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
getkbd_entry(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
getxy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
insert_char() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
insert_decimal() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
int2str() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
julian_date() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
KBHIT() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
key_card_entry() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
keyin_amt_range() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
keyin_mapped() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
LEAP_YR() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
load_bmp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
long2str(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
MAX() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
MEMCLR() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
msg_display_at(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
msg_display_new() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
MIN() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
month_end() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
mult_strcat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
NORM_BEEP(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
ntocs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
C ONTENTS
p_set_baudformat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
pad() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
pause() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
prompt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
prompt_at() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
purge_char() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
range() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
range_vlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
scroll_buffer() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
set_itimeout() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
sgetf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
SLEEP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
sputf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
strn2int() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
str2digit(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
str2dsp_len(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
str2int() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
str2long(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
track_parse(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
view_buffer() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
DVLR Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
delete_dvlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
insert_dvlr(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
read_dvlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
seek_dvlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
write_dvlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
IVLR Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
delete_ivlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
insert_ivlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
read_ivlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
replace_ivlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
seek_ivlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
write_ivlr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
SVC Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
SVC_CLOCK() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
SVC_KEY_NUM(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
SVC_KEY_TXT() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
SVC_TICKS() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Application Idle Engine Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Application Idle Engine Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
aie_main(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
appl_idle_get_cancel_poll_time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
appl_idle_get_fast_poll_time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
appl_idle_get_idle_loop_time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
appl_idle_get_slow_poll_time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
appl_idle_set_cancel_loop_time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
appl_idle_set_fast_poll_time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
appl_idle_set_idle_poll_time() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
appl_idle_set_slow_poll_time(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Message/Data Entry Engine Function Calls. . . . . . . . . . . . . . . . . . . . . . . . . . . 234
msg_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
msg_select_file(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
C ONTENTS
C ONTENTS
DCE_PUTCFG_S(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Modem Engine Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
inInitModem() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
inOpenModem() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
vdCheckDataMode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
vdSetEchoMode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
xhayes_control() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
xhayes_display(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
xhayes_flush() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
xhayes_response() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
xhayes_send_cmd() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
xhayes_status() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
xmdm_check_status(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
xmdm_checkline(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
xmdm_clear() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
xmdm_close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
xmdm_dial_status() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
xmdm_failed_output_pending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
xmdm_flush() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
xmdm_get_line_dial() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
xmdm_hangup() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
xmdm_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
xmdm_input_pending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
xmdm_open() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
xmdm_output_pending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
xmdm_receive_data() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
xmdm_send_data(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
xmdm_set_attrib(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
xmdm_set_protocol() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Report Formatter Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Report Formatter Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
formater_close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
formater_line() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
formater_main() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
formater_open() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
formater_set_flags() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
formater_template() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Database Library Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Database Library Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
db_close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
db_delete() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
db_get_key(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
db_open() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
db_read() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
db_remove() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
db_seek_key() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
db_seek_record() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
db_write() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Printing Monochrome Bitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
print_image(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Print Pak 3700 Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
p3700_close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
C ONTENTS
p3700_dnld_char() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
p3700_dnld_font_file() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
p3700_dnld_graphic_file() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
p3700_id(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
p3700_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
p3700_mode(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
p3700_print(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
p3700_print_graphic(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
p3700_select_font() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
p3700_sel_tbl_dnld_char() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
p3700_status() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
A P P E N D I X A
Example Progr ams EXFIELD.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
EXTMOUT.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
EXTRANS.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Data Capture Engine Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Modem Engine Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Report Formatter Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
P3700 Example Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
CHAPTER 1
Introduction
This manual provides information on the Verix eVo ACT Library, including
modules supported within the library, function call descriptions, and example code
and applications.
Audien ce This manual is aimed at programmers using Verix eVo ACT to develop
applications for Verix eVo based terminals. To use this manual you should have
an understanding of the following:
• C programming concepts and terminology
• Windows 2000 or Windows XP or Windows Vista.
I NTRODUCTION
Re fe ren ce s
References Refer to the following set of manuals for additional information on the Verix eVo
OS or the Verix eVo TX OS:
• AMEX Express 3000 PIP Terminal Technical Specifications
In addition to VeriFone programming support manuals listed in the introduction
section of this manual, refer to the following industry manuals for PIP application
development:
• ISO 8583 Bank Card Originated Messages—Interchange Message
Specifications—Content for Financial Transactions (part number ISO 8583:
1987(E))
• AMEX Express 3000 PIP Terminal Technical Specifications
I NTRODUCTION
Ma nu al Conv en ti on s
Manual This section provides a quick reference to conventions, syntax notation, and
Conventions acronyms used in this manual, and discusses how to access the text files
associated with code examples.
Conventions The following conventions help the reader distinguish between different types of
information:
• The cour i er typeface is used for code entries, filenames and extensions, and
anything that requires typing at the DOS prompt or from the terminal keypad.
• The italic typeface indicates book title or emphasis.
• Text i n blue indicates terms that are cross-referenced. When the pointer is
placed over these references the pointer changes to the finger pointer,
indicating a link. Click on the link to view the topic.
NOTE
Note points out interesting and useful information.
CAUTION
Caution points out potential programming problems.
The various conventions used throughout this manual are listed in Table 2.
Table 2 Conventions
Ab br evi ati on Defini ti on
bps bits per second
KB KiloByte
MIN minimum (value)
ms Millisecond (one-thousandth of a second)
sec seconds
Syntax Notatio n This library reference uses the following syntax notation:
c har * f get s ( c har * s t r g, i nt n, The Cour i er typeface is used for
FI LE * st r m) ; source code, DOS commands, and
filenames.
%[ *] [ wi dt h] [ modi f i er ] Items in braces are optional, such as an
optional argument to a function.
( st r eam, f or mat [ , ar gument , . . . ] ) ; A series of three dots (either in a
column or in a line) signifies that an item
can be repeated any number of times.
S_I READ | S_I WRI TE A vertical bar separates optional
choices.
I NTRODUCTION
Ma nu al Co nv en ti on s
All source code characters are case sensitive. For example, f pr i nt ( ) and
FPRI NT( ) may not be the same facilities. All source code punctuation must be
included as shown.
I NTRODUCTION
Ma nu al Conv en ti on s
Code Examples Links to code example text files included on the Verix eVo ACT CD are provided
throughout this manual. The . t x t file opens in your specified default text editor.
NOTE
Writing your own applications is recommended.
Links are referenced by the underlined word Example; click on the following
section title to bring up a text file example:
I NTRODUCTION
Ma nu al Co nv en ti on s
Example
NOTE
So that the entire code example can be read on screen, ensure that the word-
wrap option is enabled in your preferred text editor.
CHAPTER 2
Verix eVo ACT is a collection of C code modules designed to reduce the effort
required to design and develop applications for VeriFone Verix eVo based
terminals.
Verix eVo ACT provides the following benefits:
• Reduces design, coding, and testing time. Commonly used functions and
procedures are simply incorporated into your new and existing applications
designs.
• Consistent methodology for common procedures. Using Verix eVo ACT
ensures that applications complete the same tasks in the same way. This
reduces the amount of effort to debug new code and eases the effort required
for quality control.
• Easier maintenance. One of the time consuming tasks of code maintenance is
the learning curve required when a new programmer must enhance or modify
an application. Verix eVo ACT provides code that the programmer can already
be familiar with and can concentrate on the unique aspects of the application.
• Optimization and error trapping. The Verix eVo ACT modules provide error
trapping and have been compiled with full optimization. This helps to provide
the most efficient code for the application programmer.
• Code leveraging. The application programmer can develop additional
specialized functions using the Verix eVo ACT modules as a base. This helps
control the size of the application by reusing code from the toolkit. The
components of the toolkit use this principle as the various engines call AC
Library (ACL) functions to complete their tasks.
Building This section explains the procedure for building an application using ACT as a
Ap pl ic ati on s shared library. Change the project make file (typically the SMK file) to build the
Referencing a terminal application for the shared version of ACT. For example, build the
Shared Library sample.c file with the shared version of ACT. The following is a sample . MAK file
with the changes required for using ACT as a shared library:
Library Resides in In the previous example, the sample application is built so that the shared ACL
Flash resides in the terminal flash memory. The following is an example download file,
where s et dr i ve. f designates the flash partition, set gr oup. 15 is the flash
memory partition, GI D 15, and s et dr i ve. i designates the RAM partition:
*go=sampl e. out
setgr oup. 15
- i act . l i b. p7s
s et dr i ve. f
- i act . l i b
s et dr i ve. i
setgr oup. 1
- i sampl e. out
- i sampl e. out . p7s
CHAPTER 3
Function Calls The functions listed in Table 4 are arranged by device or purpose. Refer to the
function description for associated parameters and valid error conditions, and
details on how and when to use the function. In the online version of this manual,
the page number can be clicked on to jump to the function description.
Table 4 Function Calls
Function Call Description Page
Modem Engine
Macros Function Calls
i nt MDM_READ_BLK Reads opened modem device communication 106
( i nt h_modem, st r uct Opn_Bl k mdm_bl k) ;
parameters into a Modem Opn_Blk structure.
i nt MDM_RESET_ERROR( h_modem) ; Resets the latched error conditions of parity, 106
framing, and data overrun.
i nt MDM_STATUS( i nt h_modem) ; Obtains the opened modem device 107
communication status and copies it to the global
structure s t at us _ i nf o.
CHAPTER 4
In a typical transaction environment, the terminal waits for an event (card swipe,
keypress, or incoming dialup) to continue the application. This is known as theidle
state. From the idle state, every application is required to execute tasks that are
triggered by such events. Other tasks, such as opening devices or setting flags,
are only required to execute during power up or on return from another code
module.
The Application Idle Engine (AIE) assists the application programmer in managing
the idle state; it acts as a traffic manager. When an event occurs at the idle state,
such as a keypress or card swipe, the engine references an application-defined
table to determine which function to execute. The format and functions of the
Application Idle tables are described in this manual.
A PPLICATION I DL E E NGINE
In te grat in g th e AIE in to an Appl ic at io n
SET TIMERS
IDLE LOOP TIMERS
SLOW POLL TIMER
FAST POLL TIMER
CANCEL KEY DETECT TIMER
DETECT EVENT
N
EVENT OCCURRED
N
TIMER EVENT
PROCESS TIMER
ACTIVA TE/ N
DEACTIVATE
EVENT
Y
HANDLE
ACTIVA TE/DEACTIVA TE
N
ANY OTHER EVENT
CLEAR TIMER
PROCESS EVENT
RESET TIMER
Fi gur e 1 A pp li cat io n Pr oc es si ng Fl ow Ch ar t
32 VERIX EVO ACT PROGRAMMERS GUIDE
A PPLICATION I DL E E NGINE
Ap plic at io n- De fi ne d Idle Lo op Func ti on
Programmer- Figure 1 shows functions in the application idle process that must be written by
Defined Functions the programmer. These functions allow the application to easily meet the specific
requirements within the framework of the AIE.
The application defines the mai n( ) of the program. The functionality defined by
appl _col dboot ( ) can be directly invoked by the application. Before calling
aie_main(), the application should typically execute tasks performed during
system initialization, such as:
• opening devices to be accessed by the application (card reader, modem, and
so on)
• setting or testing flags (such as a download-needed flag)
• performing file maintenance
• moving CONFIG.SYS data to a file
• setting up user passwords. If the cancel key trap is armed in this function, it is
overwritten (see Figure 1). In addition, this function must return TRUE (1). Any
other return value causes AIE to exit.
Applicat ion- The Idle Loop function is passed as a parameter to aie_main() and is the main
Defin ed Idle loop in the engine. It is called immediately after the timers are set, and then once
Loop Function per cycle. This function can be used for timed events, such as:
• print spooler management,
• automatic upload or download of data,
• idle display management,
• automatic settlement, and
• error processing.
Since this function is called once per cycle, the code must be very efficient.
Executing complex or time-consuming operations in this function delays event
processing of events.
Handling CANCEL Handling the cancel key is the responsibility of the application. Use the
Key KEY_CANCEL parameter of act_kbd_pending_test(), to determine if a cancel key
is pending and the appropriate action is taken. In the idle state, AIE periodically
checks (50 ms) for the cancel key and flushes the keyboard.
Slow Poll funct ion The Slow Poll function, defined by the application, is called by AIE once every
250 ms during the normal idle state. The programmer can create code to
determine if programmer-defined events have occurred and handle them.
Fast Poll fu nction The Fast Poll function, defined by the application, is called by AIE once every
50 ms during the normal idle state. The programmer can create code to determine
if programmer-defined events have occurred and handle them.
A PPLICATION I DL E E NGINE
Ap pl icat ion Id le Tabl es
Both the slow poll and fast poll functions can be used to perform any periodic
activity.
Applicat ion One powerful feature of the AIE is its ability to use tables to control event
Idl e Tables processing. Two tables are required by the engine: the Branch Table and the
Function Table. These must be passed as parameters to aie_main(), however,
create additional tables to meet the requirements of the application. To
understand the relationship between Branch Table and Function Table and how
they are used by the engine, refer to Figure 2.
Branch Table The Branch Table contains an index to function pointers defined in the Function
Table. Each time an event occurs in the idle state, the event processor accesses
the Branch Table to determine which function to process. Each entry in the Branch
Table has three members:
• The event to process (defined in APPLI DL. H)
• The index into the Function Table
• The current (new) Branch Table to access on return from the function
A PPLICATION I DL E E NGINE
Ap plic atio n Id le Tabl es
The Branch Table function increases flexibility and reduces code space by
allowing creation of a table-driven application. To do this, create two tables that
reference the events to process (refer to the idle_table[ ] and appl_table[ ]
examples) and the br anch_t abl e( ) function does the rest. After executing the
event, br anch_t abl e( ) returns a pointer to the next table used to process
events.
NOTE To switch to the new Branch Table, BRANCH_EXIT or any non negative value can
be returned from the event handler functions. The following example shows that
the KEY_CR event sets f unc_t abl e[ ] as the new Branch Table. After executing
the KEY_CR event handler function, f unc_t abl e[ ] becomes the active table
and waiting for events. func_table[] does not become the active Branch Table
unless the function referenced by FT_FUNC returns BRANCH_EXIT or any non
negative value. In this case, if any non negative value is returned from the handler
function, the event is processed in the active table ( f unc _t abl e[ ] ) and not in
the idle table.
Example The linked code example file demonstrates use of br anch_t abl e( ) .
NOTE
BRANCH_TBL_ENTRY is defined in APPLI DL. H (using typedef).
END_TABLE
This entry is required to truncate the table. It must be the last entry in the table. All
entries occurring below END_TABLE are ignored. In addition, this entry can be
used to process invalid application events, that is, events returned by the event
handler functions (callback functions) and not listed in the active Branch Table.
For example, in i dl e_ t abl e[ ] only KEY1 - KEY5 are mapped and event
handler functions are provided. If any of the event handler functions return KEY6
A PPLICATION I DL E E NGINE
Ap pl icat ion Id le Tabl es
which is not listed in the active table, the function associated with the
END_TABLE entry is processed. The END_TABLE function can be used for error
beep and display “INVALID KEY” etc. However it can still perform any other tasks
required by the application. The END_TABLE function will not get executed for the
system generated events which are not listed in the table. Refer to the Example
for more details.
COMMON_FUNC
This entry executes prior to any other event for example, used to display
messages or set transaction flags.
ENTRY_FUNC
This entry executes if Branch Table entry is called with the current event set to 0
(zero). After execution, ENTRY_FUNC must return the next valid event to process
(refer to APPLIDL.H) for example, use ENTRY_FUNC to display a menu. When
the user makes a selection from the menu, ENTRY_FUNC returns the keypress
as the next event to process.
ERROR_FUNC
This entry executes if the value returned by an event is a negative value, which is
then passed to ERROR_FUNC. The return values from ERROR_FUNC have the
following significance:
• Positive integers ( 0): Process the return as the next event within the same
table.
• Negative integers (< 0): Process the absolute value of the return as the next
event, under the next (branch) table, as indicated by the current table entry.
• BRANCH_EXIT: Exits with no new events; forces the engine under control of
the idle_table.
EXIT_FUNC
This entry executes prior to passing control to another table, or when
BRANCH_EXIT is returned under the current table. For example, it can be used to
hang up the phone, complete a print job, or perform other housekeeping tasks.
The previously described entries can be placed anywhere in the table (with the
exception of END_TABLE); however, the entries are always processed in the
following order:
1 COMMON_FUNC
2 ENTRY_FUNC
4 ERROR_FUNC
5 EXIT_FUNC
36 VERIX EVO ACT PROGRAMMERS GUIDE
A PPLICATION I DL E E NGINE
Ap plic atio n Id le Tabl es
Functi on Table The Function table is an array of pointers to integer functions. Each element in the
table is a name of an application-defined function written to process an event.
Every entry in the Branch Table must have a corresponding entry in the Function
Table.
NOTE To make referencing the function name to the corresponding table entry value
easier, include the #def i ne directive above the function name. The #def i ne
values must start at 0 (zero) and continue in ascending order.
#def i ne FT_VOI D 3
voi d_t r an,
#def i ne FT_FUNC 4
f unc_ mai n,
#def i ne FT_COMMON 5
i dl e_common,
#def i ne FT_EXI T 6
i dl e_ exi t ,
A PPLICATION I DL E E NGINE
Ap pl icat ion Id le Tabl es
#def i ne NO_KEY 8
not _avai l abl e,
A PPLICATION I DL E E NGINE
Even t De te ct io n
Event AIE detects events for all devices opened by the application.
Detection
WLN_IN WL AN event
NOTE
To avoid wasting system resources, do not set traps at the idle state for these
devices.
A PPLICATION I DL E E NGINE
Ap pl icat ion Id le Fu nc tion s
Applicat ion The application idle functions are described in the Application Idle Engine
Idle Functio ns Function Calls section.
CHAPTER 5
The Message/Data Entry Engine is a group of functions that control the display of
prompts and messages, and reads data from the keypad or card reader. This
library assists application development in the following tasks:
• retrieve messages,
• clear the display,
• display messages,
• set the cursor position,
• wait a specified time for a keypress, and
• accept input from the keypad or cardreader.
Other functions in this library support manual- or auto-scrolling through
messages, which is useful for displaying long messages or menus.
Mess age File The functions in the Message/Data Entry library are designed to retrieve prompts
and messages from a message file created by program called TXOFILE. The
format of the message file and instructions on how to create it are provided in this
section.
While other types of files are discussed, the Message Engine is designed to use
only message-type files that use any of the available compression types.
TXOFILE Util it y TXOFILE is a PC-based utility that allows quick and easy generation of TXO-
compatible files that can be downloaded to the terminal. Using a DOS program to
generate application modules provides two important advantages:
• The application code space is reduced because the data is stored in a file.
• This method provides greater flexibility since the data is not compiled as part
of the application. If the data in the file needs to be modified, only the file is
updated and downloaded to the terminal, rather than through the application.
Files generated by TXOFILE typically contain data that is not modified by your
application program (for example, prompts and messages). Although TXOFILE is
discussed here in conjunction with the Message/Data Entry Library, it also
supports additional file and compression types that allow you to generate binary
files, and so forth. The following sections list the file and compression types
supported by TXOFILE. Before you select a file and compression type, review the
file type and compression type considerations discussed later in this section.
Compression Types
File Types
• VLR
• CVLR
• DVLR
• Fixed
• Keyed
• Message (ASCII)
The input file should have the following string if two byte addressing is used. This
string should precede any valid messages.
"/ * Byte addr essi ng: 2 */ "
TXOFILE Syntax
t xof i l e [- opt i ons] i nput _f i l ename out put _f i l ename
TXOFILE Option s
The options are case sensitive. Each option must be preceded by a dash:
- p ( s pec i f i er ) ( f or mat - I nt el or Mot or ol a)
i Indicates that the input file uses two byte addressing and bytes need to be
swapped.
m Indicates that the output file should be generated for Motorola format, that is, the
bytes are not swapped.
0 No compression (default)
1 8-to-6 bit
3 BCD
- t ( speci f i er ) ( f i l e t ype)
c CVLR
d DVLR
f Fixed
k Keyed
m Message file (default)
v VLR
NOTE
The default values are no compression and message file.
Example Assume that input.txt has messages specified in two byte addressing. Add the
string “/ * Byt e Addr essi ng: 2 */ ” to i nput . t xt . This string should precede
the list of valid messages. Run t xof i l e. exe as follows:
t xof i l e - pi i nput . t xt out put . dat
The generated message file output.dat can be used with an application running on
a PC.
Recommended Usage
Run TXOFILE utility twice for the same input file; once with - pi option and once
without the - pi option.
This generates the message file for a terminal. Note the change in the file
extension for the two output files.
In the application, select the message file as follows:
#i f def _WI NDOWS
ms g_ s el ec t _ f i l e( f i l ename. i at )
#el se
msg_sel ect_f i l e( f i l aname. dat )
#endi f
You do not need to change the application for SDS compilation. You also do not
need to download *. i at files to the terminal.
File Typ e and The file type and compression type options you specify on the command line are
Compression determined by the type of data being stored in the file and how it is accessed by
Type your application. The following information explains how TXOFILE handles the
various file types.
Message Files
These include a two-byte header record. Byte 1 (0x02) indicates the length of the
header record. Byte 2 indicates the type of compression used. It is recommended
that you select 8-to 6-bit compression for message files.
TXOFILE supports hex, octal, and decimal values in a quoted string. For example,
\x0F is stored in the output file as one byte (0x0F). These values must be
preceded by \n where n is one of the following:
• x or X: The two letters/digits immediately following the \X or \x are treated as
two hex digits and are stored as one byte in the output file.
• 0–7: The three digits immediately following the \ are treated as three octal
digits and are stored as one byte in the output file.
• d or D: The three digits immediately following the \D or \d are treated as three
decimal digits and are stored as one byte in the output file.
NOTE
Values represented by hex, octal, or decimal cannot exceed 255 decimal.
Mess age File A message file is an ASCII file that contains one #def i ne directive for each
Format message (refer to the following example). The #def i ne is not required, however,
it allows you to relate the record number to the associated message.
#def i ne ENTER_CODE 1
/ * Message number f or " ENTER CODE" */
#def i ne PRI MARY_ PHONE 2
/ * Message number f or " PRI MARY PHONE#" */
#def i ne ALT_PHONE 3
/ * Message number f or " ALT PHONE #" */
#def i ne MERCHANT_ I D 4
/ * Message number f or " MERCHANT I D #" */
Each line in the message file must conform to the following format:
#def i ne [ name] [ val ue]
When TXOFILE processes the input file, the value becomes the record number
and the quoted string within the comment becomes the message text in the output
file.
NOTE In the message (quoted string), only include ASCII characters. Escape sequences
(for example, hex or decimal) are not valid unless they are indicated by \x0F, \187,
\d032, and so on.
Message/Data The message/data entry functions are described in Message/Data Entry Engine
Entry Function Calls.
Functions
CHAPTER 6
The ISO 8583 Message Interface Engine is an interface engine designed to aid in
the assembly and disassembly of data packets conforming to the ISO 8583
standard. The engine is beneficial for the application programmer by providing a
single routine to complete both assembly and disassembly.
The engine allows for the handling of computed fields, such as the MAC, whose
value is based on the preceding bytes in the ISO packet. Verix eVo ACT includes
two additional modules that rely on the ISO 8583 Message Interface Engine, the
ISO 8583 Protocol Engine, and the PIP Engine.
The PIP Engine is a specific ISO 8583 implementation using PIP. The ISO 8583
Protocol Engine assists the PIP Engine in building, sending, receiving, and
unpacking an ISO 8583 message. Other ISO 8583 applications can also use the
ISO 8583 Message Interface Engine and the ISO 8583 Protocol Engine.
Figure 3 illustrates how the ISO 8583 Message Interface Engine interfaces to the
ISO 8583 Protocol Engine.
NOTE
This engine can only be used with Verix eVo ACT, (VPN P006-212-02), for Verix
eVo terminals.
ISO 8583 Services of the financial industry include the exchange of electronic messages
Engine relating to financial transactions. The ISO 8583 international standard specifies a
Overview common interface by which bankcard-originated messages relating to financial
transactions can be exchanged between private systems. The standard has
nothing to do actual transmittance and receipt of data, but concentrates on the
construction of the data packets.
ISO 8583 Bitm aps The ISO 8583 standard identifies 126 possible fields that can be included in a
data packet. For each data packet, various combinations of these data fields are
included depending on the type of request or response represented by the data
packet. Each of these data fields is represented by a single bit in one of two
bitmap elements in the data packet.
The first bitmap field is always included in the data packet. The first bit is used to
indicate whether the second bitmap field exists. The ISO 8583 standard arranges
the various data fields so that the most common data packets can be formed
using only the first bitmap field, which reduces transmission size.
Each of the remaining 63 bits represents a particular data field as described in the
ISO 8583 standard. The application programmer must review the host interface
specification to ensure the correct fields are included for each message type. For
every data field included in the data packet, the corresponding bit in the bitmap is
set to one. Any unused fields must set their corresponding bit to zero. The bitmap
is completed as the data packet is assembled, and is used at the destination to
disassemble the data.
Figure 4 represents a partial first bitmap field.
Bitmap = i
Message Stru ctur e Each ISO 8583 message is constructed in the following sequence:
1 Message type identifier
ISO 8583 This engine is designed to be table driven. A single routine is used for the
Engine Desig n assembly and disassembly of ISO 8583 packets. The assembly and disassembly
of ISO 8583 packets is driven by the following structures:
Maps One or more collections of 64 bits that drive packet assembly and
indicate what is in a message.
Engine The ISO 8583 Interface Engine is divided into two major parts:
Components • A set of map manipulation and data conversion routines, and
• A set of routines to handle packet assembly and disassembly.
Engine Files The ISO 8583 Message Interface Engine consists of the following files:
Incorporating To incorporate this engine into an application, modify the APPL8583. C and
the Engine APPL8583. H files so that each has all the application variables required in the bit
map and set up the map properly. Compile APPL8583. C and link it with your
application and the ISO 8583 library.
Use the following procedures to transmit or receive an ISO 8583 packet using the
ISO 8583 Interface Engine:
To transmi t an ISO 1 Set data values in the application variables for those to transmit.
8583 pack et
2 Call the prot8583_main() routine.
This constructs the complete message and returns the number of bytes in
the constructed message.
3 Call wr i t e( ) to transmit the message.
This results in all fields being deposited into the application variables.
3 Use the values in the application variables.
NOTE The routines provided by this engine simplify the handling of bitmapped
messages. The determination of which message type to send and which fields to
include in that message is the responsibility of the application programmer.
Similarly, validation of a host response and the fields it provides is the
responsibility of the application.
Glob al Data
and Definitio ns
Global Defines The following #def i ne preprocessors are used by the 8583 Interface Engine and
can be found in I SO8583. H:
#def i ne BI T_MAP_SI ZE 8
#def i ne map_bytes( f n) ( ( ( ( ( f n) - 1) ( BI T_MAP_SI ZE* 8) ) /
+1) * BI T_MAP_SI ZE)
#def i ne bi t _map( name, f n) unsi gned char name[ map_byt es/
(fn)]
#def i ne STOP 0x8000
#def i ne SKI P 0x4000
#def i ne FI ELD_MASK 0x0f f f
#def i ne OFF 0x4000
#def i ne LEGAL_FI ELD( map, f n) ( ( f n) >= 1) &&( ( f n) <= ( map_s i ze( map) *
BI T_MAP_SI ZE) ) )
#def i ne LS_MAP_BI T 0x80
#def i ne ASC_ASC 0
#def i ne AV3_AV3 1
#def i ne BI T_BI T 2
#def i ne BCD_BCD 3
#def i ne BCD_ASC 4
#def i ne ASC_STR 5
#def i ne BCD_STR 6
#def i ne BCD_SNZ 7
#def i ne AV2_STR 8
#def i ne BV2_STR 9
#def i ne AV3_STR 10
#def i ne XBC_STR 11
#def i ne BI N_HST 12
#def i ne BI 2_HST 13
#def i ne BI 3_HST 14
The following global variables are used by the 8583 Interface Engine and can be
found in I SO8583. H:
conver t er s conver t _t abl e[ ] ;
unsi gned char *s r c_8583;
unsi gned char *dst _8583;
i nt f n_8583;
unsi gned char map_8583 [ ] ;
Global Structures The following global structures are used by the Interface Engine and can be found
in I SO8583. H:
t ypedef st r uct
{
i nt f i el d_num; / * 1st col - f i el d number */
i nt packet _sz; / * 2nd col - packet si ze */
i nt conver t _i dx;
/ * 3r d col - i ndex i nt o cover t t abl e */
voi d *r ef erence;
/ * 4t h c ol - poi nt er t o var i abl e or t abl e * /
i nt v ar _ s z ; / * 5t h c ol - var i abl e s i z e * /
} f i el d_ st r uc t ;
t ypedef st r uct
{
unsi gned i nt var i ant 1; / * 1st col - t ar get */
unsi gned i nt var i ant 2; / * 2nd col - t ar get */
i nt packet _sz; / * 3nd col - packet si ze */
i nt conver t _i dx; / * 4r d col - i ndex i nt o cover t t abl e */
voi d *r ef erence;
/ * 5t h c ol - poi nt er t o var i abl e or t abl e */
i nt v ar _ s z; / * 6t h c ol - var i abl e s i z e * /
} var i ant _st r uct;
where,
• ADR: is the HDLC (SDLC) poll address (normally 0x30).
• CB: is the HDLC control byte.
• TPDU: is the Transport Protocol Data Unit (see below).
• CRC: is the HDLC checksum (CCITT CRC).
The structure of the request message TPDU is:
where,
• TPDU ID: identifies TPDU type:
• 0x60 = Transactions
• 0x68 = NMS/TNMS
• DESTINATION ADDRESS: is the network international identifier
• ORIGINATOR ADDRESS–Identifies the individual terminal or process
originating the transaction.
The structure of the response message TPDU is:
where,
• TPDU ID: Identifies the TPDU type. This is the same value as in the request
message.
• DESTINATION ADDRESS: This is the same as the originator address from
the request message.
• ORIGINATOR ADDRESS: This is the same as the destination address from
the request message.
The structure of APPLICATION DATA is:
where,
• MESSAGE TYPE: is four BCD digits
• BIT MAP: 64 or 128 bits numbered from the left, starting with 1.
• DATA: The following rules apply:
• All data elements begin on a byte boundary.
• Fixed-length, n-type fields with an odd length are right-justified to a byte
boundary, and zero-filled on the left.
• All lengths for variable-length fields are represented in BCD, right-justified
to a byte boundary, and zero-filled on the left.
• The length indicator for a variable-length field is a count of data elements
to follow. It does not include itself in the count.
• Variable-length, n-fields with an odd length are left-justified within a field
and zero-filled.
Applicat ion When designing an application that uses the ISO 8583 Interface Engine, the
Design programmer must understand how to construct maps and field tables. The
following sections describe these two topics in detail.
Map Construc tion A map is one or more 64-bit collections used to define which fields to include in an
outgoing packet and to indicate which fields are present in an incoming packet.
There is a direct correspondence between the bits in the map and the order of the
data fields in the packet. The first bit that is on in the map (moving from bit 1 to
128) defines the number of the first data field. Bits 1 to 64 constitute the primary
bit map, while bits 65 to 128 make up the optional secondary bit map. Bit number
1 indicates the presence of the secondary bit map, with bit 65 indicating the
presence of a tertiary map. The current ISO 8583 standard only defines fields up
to 128, and hence it uses only two maps.
The application programmer typically creates a map for each packet which the
application is required to send. These maps may be handled in any one of the
following ways:
• Create a table of maps used by the application then refer to a particular map
with an index into this table.
• Use individually named maps.
• Create each map on the fly just before packet assembly.
• Use a mixture of the above methods.
The ISO 8583 Engine handles maps with up to 256 bits.
Map Manipulatio n In most cases, maps are created once for each particular message type and then
Routines used without change. Occasionally however, it can be necessary to manipulate
these maps. To assist in this process, the ISO 8583 Interface Engine provides the
following map manipulation functions:
• map_clear()
• map_test()
• map_set()
• map_reset()
• map_man()
Field Table Use the field table to define all fields required by the application and transmitted
Construction by the host. There are as many rows in the field table as there are unique fields.
Each row in the table has the following five fields:
Field Num The number of the field. Corresponds to the bit set in the bitmaps.
The number of units called for by the 8583 packet. These units could
8583 Size
be single bits, 4-bit BCD digits, or 8-bit bytes.
Convert An index into the Convert table, as explained in Variant Field Strategy.
Index
A pointer to the actual variable or place where the data resides within
Ap pl ic ati on
the application. May also point to a second table, as is the case for
Variable
variant fields.
Variable Number of units called for by variable.
Size
The header file, I SO8583. H, defines the following structure which is used for the
field table:
t ypedef st r uct {
i nt f i el d_num;
/ * 1st col - f i el d number */
i nt packet _sz;
/ * 2nd col - packet si ze */
i nt c onver t _ i dx;
/ * 3r d col - i ndex i nt o conver t t abl e */
voi d *r ef er ence;
/ * 4t h c ol - poi nt er t o var i abl e or t abl e * /
i nt var _ s z ;
/ * 5t h c ol - var i abl e s i z e * /
}
f i el d_ st r uct ;
If the application specified data length (8583 packet_sz) is less than the actual
data length, then it will fail returning an error (-4).
Correct the value of 8583 packet_sz to reflect the maximum length of the data
field and inspect 8583 packet_sz field while using the following conversions:
AV2_STR, BV2_STR, AV3_STR, HST_BI 2, HST_BI 3, STR_AV2, STR_BV2, STR_AV3,
BI 2_HST, BI 3_HST, and AV3_AV3
The following is an example of the field table:
f i el d_ s t r uc t f i el d_ t abl e [ ] =
{
/ * Fl d 8583 Conver t Var i abl e name and si ze */
/ * no. sz i ndex */
{ 0, 10, BCD_STR, VARI ABLE( t pdu) },
{ 0, 4, BCD_STR, VARI ABLE( message_i d) },
{ 2, 19, BV2_STR, VARI ABLE( pr i _acct _num) },
{ 3, 6, BCD_STR, VARI ABLE( proc_ code) },
{ 4, 12, BCD_SNZ, VARI ABLE( amount ) },
{ 11, 6, BCD_STR, VARI ABLE( sys_t r ace) },
.
.
.
{ 32, 11, BV2_STR, VARI ABLE( acq_i ns_i d) },
{ 35+ SKI P, 37, AV2_STR, VARI ABLE( di scar d) },
{ 37, 12, ASC_ASC, VARI ABLE( r et r _r ef _num) },
.
.
{ 43, 40, ASC_STR, VARI ABLE( car d_acc_ name) },
{ 44, 0, COMPUTE, FUNCTI ON( bui l d_44) },
{ 60+ STOP, 0, VARI ANT, TABLE( f i el d_60) },
};
This field table must define all fields that the host will send, including those not
used by the application. This is necessary to allow the engine to skip them.
However, to skip a field, the engine must know how long that field is. See field 35
in the example above.
Packets are assembled and disassembled from left to right, that is, from low field
number to high field number. During packet assembly, an index is used to
reference entries in the field table. This index increments to the next field called for
by the driving bitmap.
Use the following steps to construct the field table:
1 Create column one for each field used by the application or transmitted by the
host.
2 Fill in the values for the second column taken from your host interface
document.
Use the field sizes specified by the particular host with which the application
is communicating.
3 Make a list of the types of fields required by the ISO 8583 packets from the
host interface document.
4 Decide on the format the application will store and manipulate the data for
each field.
Give each of these types a descriptive name, as described in step 3. Use the
same name if the forms are the same. These are the symbolic names used
for the second part of the entries in the third column (the names to the right of
the underscore). There are also two special #def i nes , COMPUTE and
VARIANT, to use with computed or variant fields. Use one of the following
three defines for the fourth column: VARIABLE, TABLE, or FUNCTION:
• VARIABLE: if the data is stored in a simple program variable.
• TABLE: specifies variant fields.
• FUNCTION: specifies computed fields.
See Variant Fields and Computed Fields.
Variant Fields The 8583 specification defines fields 60–63 as private fields. This means that
these fields can be used by the application in any way. Following are several
possibilities for the usage of these fields:
• Always use them the same way to store the same type of data. If this is done,
these private fields be used as if they were defined fields and are no more
difficult to handle than any other field.
• Let their usage and contents to vary depending of the type of message. Since
there are only four of these fields andsince a lot of data simply does not fit into
the other defined fields, most applications are forced to think of these private
fields as variant fields. Accordingly, the ISO 8583 Interface Engine provides a
mechanism to manipulate variant fields. Note that this mechanism can be
ignored or modified by the programmer— this is only one method and works in
most cases.For completeness, two other schemes are provided that could be
used to handle variant fields.
• Define special conversion routines that use other application variables to
determine exactly what they should do.
VERIX EVO ACT PROGRAMMERS GUIDE 57
• Always move the field onto a C structure that uses a union to offer different
views of the data.
Refer the previous field table example and note the following for field 60:
{ 60+ STOP, 0, VARI ANT, TABLE( f i el d_60) },
Column three normally has an index into the convert table. The define VARIANT is
a special value defined to be one greater than the last valid index into the convert
table. If this value is used it simply tells the engine “the contents of this field
depend on the two additional integers”. These two integers can be the first two
digits of the processing code and the message type. Accordingly, the pointer in
the fourth column, instead of pointing at an application variable points at a table of
the following form:
var i ant _st r uct f i el d_60[ ] =
{
/ * Vari ant 1, Vari ant 2 8583 Si ze Conver t i ndex, var i abl e name and si ze
*/
{ 00, 0x0220, 12, BCD_STR, VARI ABLE( or i g_amount ) },
{ 02, 0x0220, 12, BCD_STR, VARI ABLE( or i g_amount ) },
{ 90, 0x0810, 6, BCD_STR, VARI ABLE( bat ch_num) },
{ 92+ STOP, 0x0500, 6, BCD_STR, VARI ABLE( bat ch_ num)
},
};
The format of a variant field table is simply that of the basic field table with two
new columns added to the left. When the interface engine encounters a variant
field, it moves to the variant field table and then sequentially searches for a row
where the integers specified by the first two columns match two integers provided
by the application.
If a match is not found, the engine aborts the assembly or disassembly and
returns an error code. Due to the sequential search, the variant field tables must
be ordered with the most-common definition first and the least common last.
Exactly what these two integers represent is up to the application, as they are
provided by two functions found in the file APPL8583.C. The above table uses the
first two digits of the processing code and the message . Accordingly, these two
functions are:
unsi gned i nt r et ur n_var i ant 1( )
{
unsi gned char x [ 3] ;
/ * Most si gni f i cant 2 di gi t s of pr oc_code */
st r ncpy( x, pr oc_code, 2) ;
r e t ur n at oi ( x) ;
}
unsi gned i nt r et ur n_var i ant 2( )
{
r et ur n at oi ( message_i d) ;
}
When the match is found, the interface engine proceeds to use the other columns
of the table just as with non-variant fields.
Computed A computed field is one whose value depends on either the partially assembled
Fields ISO 8583 packet or some other real time data. In other words, the value of the
field prior to calling the process_8583() routine to build the packet cannot be
determined. Such an example would be a MAC. The value of this field is
determined using the assembled ISO 8583 packet. The interface engine caters to
these types of fields by providing a mechanism whereby during assembly a call
will be made to a routine written by the user that will be responsible for providing
the value of the fields. This user-written routine should be included in
APPL8583. C and must be of the form:
/ *******************************************************/
/ * Exampl e of a comput ed f i el d. */
/ * Such a r out i ne must have f our par amet er s. */
/ * how - how= 0 = pack; how= 1 = unpack * /
/ * buf f er - Poi nt er t o wor ki ng buf f er . Copy of val ue
/* passed t o t he mai n pr ocess_8583 dr i ver . */
/ * psz - Number of uni t s i n packet . Must be set by */
/* t hi s r out i ne. * /
/ * vsz - Number of byt es i n var i abl e. Must be set by
/* t hi s r out i ne. * /
/ *****************************************************/
i nt comput e_f i el d ( how, buf f er , psz, vsz)
i nt how; unsi gned char *buf f er;
i nt * ps z; i nt * v sz ;
{
*psz = 19 / *val ue f r om second col umn of f i el d t abl e */
* vs z = s i z eof ( f i el d_ 02) ; / * s i z e of dat a i n appl i c at i on var i abl e * /
i f ( how == 0) / * We ar e bui l di ng a packet */
sr c_8583 = ( unsi gned char *) f i el d_02; / * Poi nt er t o
sour ce dat a */
el se
dst _8583 = ( unsi gned char *) f i el d_02;
/ * Poi nt er t o dest i nat i on dat a */
return
}
If a computed field is encountered while the interface engine is building a packet,
it will first call a user-written routine of the form shown above. This initializes the
data value, establishes the construction pointers, sets the sizes, and ultimately
returns the conversion type. The mechanism then has all the data as if it were
presented explicitly in the field table. The value will then be properly formatted into
the packet and the construction process will continue.
Conv ert Table The convert table contains pairs of pointers that point to simple routines used to
convert the data between the form required by the ISO 8583 packet and the
application. For example, it may be most natural for the C application to store the
expiration date as a null-terminated string. The packet, however, requires that it
be stored as four BCD digits. Therefore, two conversion routines are required:
One to change a null-terminated string to packed BCD, and one to do the reverse.
Scan column three of the field table to determine which conversion routines are
required. Each conversion results in a pair of routines: one named A_to_B() and
the other B_to_A(). The convert table contains as many rows as there are unique
conversion pairs. For example:
A #def i ne is created for each row in the convert table, which is then used in
column 3 of the field table. For example:
#def i ne BCD_STR 1 / * t hi s t ype of def i ne */
/ * f ound i n I SO8583. H */
#def i ne BCD_ASC 2 / * t hi s t ype of def i ne */
/ * f ound i n I SO8583. H */
The ISO8583.H file contains the #def i nes for conversion types, and the ISO
8583 library contains the routines that perform the following conversions:
Tab le 5 ISO 8583 L ib rar y Co nv er si on Ro ut in es
Convert
Description
Index
0 Fixed-size ASCII to same.
1 3-digit ASCII counted to same.
2 Fixed-size bits to same.
3 Fixed-size BCD to same.
4 Fixed-size BCD to ASCII with same number of digits.
5 Fixed-size ASCII to null-terminated string.
6 Fixed-size BCD to null-terminated string.
7 Fixed-size BCD to null-terminated string (drop lead zeros).
8 2-digit ASCII counted to null-terminated string.
9 2-digit BCD counted to null-terminated string.
10 3-digit ASCII counted to null-terminated string.
11 Fixed-size “signed” (C/D) BCD to null-terminated string.
12 Fixed-size binary to ASCII hex.
In addition, the following global variables are available to the conversion routine
and can be used as necessary:
f n_8583 Current field number being worked on.
map_8583 Copy of current working map.
Conversion The following routines are included in Verix eVo ACT to perform all data
Routines conversions required to format ISO 8583 packets. Refer to ISO 8583 Message
Interface Engine Function Calls for details about these routines.
• asc_to_asc() copies n bytes from source to destination. It then advances the
global pointers dst_8583 and src_8583 by n.
Packet Assembly The routine used for the assembly and disassembly of ISO 8583 packets is
and Disassembl y process_8583(). It accepts five parameters from the caller. These parameters are
as follows:
• how: An integer type that determines if the function should assemble or
disassemble a packet. 0 indicates assembly; a 1 indicates disassembly.
• f i el d_ t bl : A pointer to a struct field_struct that is the field table.
• map: An unsigned char pointer that points to the map defining the packet being
processed. This parameter is ignored when disassembling an incoming
packet.
• buf f er : An unsigned char pointer that points to a buffer area used in both
assembling and disassembling a packet.
• l i mi t : An integer type that denotes the maximum size for the packet being
processed.
The function prototype is as follows:
i nt pr ocess_8583( how, f i el d, map, buf f er , l i mi t )
i nt how;
f i el d_ st r uct * f i el d_ t bl ;
unsi gned char *map;
unsi gned char *buf f er ;
i nt l i mi t ;
Success: >= 0: Assembly: Number of bytes placed into the buffer. Use for writes.
Disassembly: Number of bytes in the buffer not yet processed. Should be
zero.
Failure: -1: Field not defined in the field table. The variable fn_8583 contains the
field in error.
The following global variables are used in this function and are defined in the
ISO8583.H header file:
ext er n unsi gned char * sr c_8583; / * Sour ce poi nt er * /
ext er n unsi gned char *dst _8583; / * Desti nati on poi nt er */
ext er n i nt f n_8583; / * Fi el d number */
ext er n unsi gned char map_8583[ ] ; / * Map */
ISO 8583 The ISO 8583 message interface functions are described in ISO 8583 Message
Message Interface Engine Function Calls.
Interface
Functions
CHAPTER 7
The ISO 8583 Protocol Engine builds and sends ISO 8583 packets to a host. To
accomplish this, it interfaces with the ISO 8583 Message Engine. The ISO 8583
Protocol Engine adheres to all requirements in the ISO 8583 standard.
The ISO 8583 Protocol Engine interfaces to the programmer defined validation
function used to determine if an appropriate response was received. This engine
interfaces to the programmer-defined communication function used to transmit
and receive request and response messages. It processes reversals as specified
in the ISO 8583 standard.
The PIP Engine requires the ISO 8583 Protocol Engine, but the ISO 8583
Protocol Engine does not require the PIP Engine. It does, however, require the
ISO 8583 Message Engine.
Although this engine was written to support the PIP Engine and the ISO 8583
process, it could be used to interface to any engine that uses ISO 8583 packets
for processing. This section treats the ISO 8583 Protocol Engine as a generic
module. See PIP Engine for specific implementation of the ISO 8583 Protocol
Engine
This engine can only be used with Verix eVo ACT, (VPN P006-212-02), for Verix
eVo based terminals.
ISO 8583 The ISO 8583 Protocol Engine requires a data structure to provide information
Protocol and application data variables. By using a structure to contain this information, the
Engin e Data interface to the ISO 8583 Protocol Engine is simplified. The protocol 8583 data
Structure structure is defined in the PROT8583.H header file.
Parameters
p_ f l d_ t a bl e The ISO 8583 Protocol Engine calls the ISO 8583 Message
Engine to assemble and disassemble messages for each
transaction. The p_ f l d_ t a bl e member is a pointer to the
applications field table that contains all the required information.
comm_handl e A pointer to the communications device. This handle is passed to
the communications routine as required.
comm_t i meout A time-out value specifying the length of time to wait for a
response from the host. This parameter is passed to the
communications routine as required.
wai t _ f or _ c ar r i er A time-out value passed to the communications routine to
specify the period of time to wait if the carrier is not present. In
applications where the call to the host is initiated early in the
transaction, the carrier may already be present when the
message is available for transmission. In other cases, it is
necessary for the communications routine to wait for carrier to
indicate the connection to the host is complete.
map A pointer to the completed bitmap for the transaction. This
bitmap can be constructed by the application in various ways or
at various times, including as a file.
val i dat i on A function pointer called after receiving a response to a request
message. The function should return a 0 if the response is valid,
or -1 to -14 if the validation routine fails. Any positive return value
is taken as a request to wait for a new response packet. The
return value is, therefore, the number of seconds to wait for the
next response. The #def i ne RETRY_CURRENT_TIMEOUT
may be returned to request a new response packet using the
current time-out value.
Two parameters are passed to this function: a pointer to the
validation structure, and the result of an internal validation of the
TPDU and response message ID by the Protocol 8583 Engine
(refer to check_8583_tpdu_msg_id() for a list of valid values for
this parameter).
base_ name String used to construct a separate reversal file. The file
extension . REV is appended to base_ name when the reversal is
created. This allows the ISO 8583 Protocol Engine to support
different hosts and separate reversal files.
r ev_msg_i d[ 5] Like all other ISO 8583 messages, reversals require a message
ID. The ISO 8583 Protocol Engine must be able to create a
reversal for any transaction at any time. r ev_msg_i d[ ] must
be loaded with the appropriate reversal message ID for the host.
state Flag to determine the processing state of the ISO 8583 Protocol
Engine. Uses TRAN_REQ (transaction request), REV_REQ
(reversal request), or NEW_REV_REQ (new reversal), as
defined in PROT8583. H. The state is included in the control
structure so that the application can determine the current
transaction being processed. This is useful in controlling the
types of messages displayed during communications. The
application treats this as a read-only parameter.
Programmer- Although the ISO 8583 Protocol Engine provides interfaces to the validation and
Defined communications functions, the programmer is responsible for writing these
Functions functions. This allows programmers to meet their application-specific
requirements within the framework of the ISO 8583 standard. For examples on the
user routines and how they should look, see the example file t xrx8583. c
supplied with the Verix eVo ACT library.
mdm_tr_8583
A user-defined function that transmits and receives ISO 8583 packets. See the
TXRX8583. C file in the Verix eVo ACT library.
Prototype i nt mdm_t r _8583( i nt h_devi ce, i nt mode, unsi gned char *r eq_buf , unsi gned
r eq_si ze, unsi gned char *r cv_buf , unsi gned r cv_l i mi t ,
unsi gned t i meout , unsi gned carr i er _t i meout ) ;
Parameters
h_devi ce Device handle.
mode Transmit, receive, or TX/RX mode of modem.
r eq_buf Buffer containing request packet.
r eq_ s i z e Size of request packet.
r cv_buf Buffer to hold received packet.
r c v_ l i mi t Maximum size of receive packet.
t i meout Maximum wait period to wait for receive packet.
car r i er _t i meout Maximum wait period for the carrier to become active.
Retur n Values The following returns inform the ISO 8583 Protocol Engine that a specific transmit/
receive failure occurred.
def_valid_8583
Parameters
par ms Parameter used by the routine.
com_r esul t Result of the return from the communications call.
Return Values
Success: 0
Failure: Positive: Wait the number of seconds specified in the return value.
Negative: Failure.
prot_8583()
Transmits and receives a transaction using the ISO 8583 protocol. The PIP
Engine of Verix eVo ACT is in compliance with the ISO 8583 Messaging
standard, manage a potential power failure by creating a reversal file (when
applicable) immediately before the transaction request is sent, and delete the
reversal upon appropriate (non-reversal) return from the communication function.
NOTE
The application variables must all be loaded prior to calling this function.
A valid field table must be declared and all appropriate information loaded. The
standard global variables for transmit, receive, store, sizes, limits, and so on must
be declared and appropriate for the packets being built. The modem engine is
expected to be available if the provided communication routines are to be used.
The ISO 8583 engine for packet assembly/disassembly must be available.
Parameters
cont r ol _dat a Protocol engine structure for this transaction.
r ev_opt Reversal option:
• REV_OFF,
• REV_ON,
• or REV_ONLY.
Retur n Values Returns a negative return value if the function fails. errno is set with the actual
error code.
check_8583_tpdu_msg_id()
Checks the current TPDU address. Validates the message ID and TPDU in the
response message against the TPDU and message ID from the request message.
The return value is passed to the validation function for processing.
Parameters
cont r ol Protocol engine structure for this transaction.
or i g_t pdu Request TPDU.
ori g_msg_i d Request message ID.
Return Values
Success: 1: TPDU and message ID match.
process_8583_request()
Sends and receives an 8583 request. Unpacks the response, validates the TPDU
address, the message ID, and calls the users validation routine. A validation
function must be provided by the user. This routine calls process_8583_request()
and if successful, calls check_8583_tpdu_msg_id(). The return value of a
successful call is the return value of the user-defined validation function.
Prototype i nt pr ocess _8583_r equest ( COMM_8583_DATA *cont r ol _dat a, i nt mode, unsi gned
cur r ent _t i meout , BYTE *r equest _buf , unsi gned
r equest _si ze, BYTE *t pdu_buf , BYTE *msg_i d_buf ) ;
Parameters
cont r ol _dat a Protocol data structure for this transaction.
mode Transmit, receive, or TX/RX mode of modem.
cur r ent _t i meout Passed to user TXRX8583 routine as a time-out.
r equest _buf Buffer containing packet to send.
r equest _si ze Size of packet to send.
t pdu_buf TPDU address for this transaction.
msg_ i d_buf Message ID for this transaction.
Retur n Values
Success: Value of validation routine.
Failure: PROT_8583_UNPACK_ERROR.
CHAPTER 8
PIP Engine
NOTE
To ensure a successful PIP implementation, be familiar with the terminology,
protocol, and processing requirements of each host the application must support.
This engine can only be used with the Verix eVo ACT, (VPN P006-212-02), for
Verix eVo based terminals.
Compiling Most of the PIP Engine is provided in library form. Certain files, such as the
Source Code communications example TXRX8583 are provided in source form. This example
Modules code can be incorporated into the application and modified as necessary to meet
the applications communications requirements.
The source files must be compiled and linked with the application in the same
manner as all other application files. These files become, in effect, another
application file and should be processed in the same way.
Overview The PIP Engine (and associated components) provides the ability to perform the
following:
• ISO 8583 message assembly and disassembly
• ISO 8583 protocol processing (including reversal management)
• AMEX host protocol processing (including advice management)
NOTE
The AMEX host protocol processing component can be adapted for other hosts.
PIP E NGINE
Overview
Each PIP host incorporates the ISO 8583 protocol from the application
construction engine. This protocol was originally developed for communications
between financial institutions and has been adapted for use in the POS
environment. It is generally used in conjunction with SDLC communications links.
ISO 8583 defines the request/response and error processing scenarios.
Adherence to these rules ensures that independently developed applications can
communicate with each other.
The main component of the ISO 8583 protocol is the message. Each message
(either a request or response) is passed between the originator and the processor.
The message is composed of a TPDU, message ID, bitmap, and a variable
number of data fields. The key to the message is the bitmap. Each field that
appears in a message is explicitly defined and assigned a number. When a field
occurs in the message, the bit corresponding to the field is set in the bitmap. In
this way, the number of fields in each message can vary. This allows the message
to contain only those fields necessary for the type of request or response being
processed.
The PIP Engine relies on various ISO 8583 engines and application-specific code
to provide the functionality required to support PIP. By allowing specific
processing to be completed by the application programmer, much more flexibility
is gained in application design, communications device management, displays,
and data storage.
Figure 3 illustrates how the PIP Engine interfaces to both the application program
and various ISO 8583 engines.
PIP E NGINE
Programmer-Defined Functions/Data
The PIP Engine interfaces to the application program and the ISO 8583 Protocol
Engine. The ISO 8583 engines can be used to interface to other ISO 8583-based
hosts. The ISO 8583 Protocol Engine interfaces to the ISO 8583 Message
Engine, a validation function that validates the host response message, and
communications functions that transmits and receive messages (both of these
functions must be provided by the application). The communications function
interfaces to a communications module that processes communications to and
from the host computer. Although the ACL is not illustrated in the diagram, it is
also used at a lower level by both the PIP and Protocol 8583 Engines.
Figure 3 does not illustrate the supporting data structures. These structures are
crucial to the implementation of the PIP and ISO 8583 Engines. The application
must declare and properly initialize these data structures. Many of the
requirements of PIP are satisfied by simply completing the data declarations and
initialization. However, other requirements must be considered when planning
code requirements.
Programmer- Several data structures and five functions must be completed to support the PIP
Defined Engine. This manual clearly defines the data structures and the purpose of their
Functions/Data members. PIP does not dictate the form in which data must be managed. The
application requirements, by engine, are listed in the following table.
• Communications Function
PIP Files Some files are created and maintained by the PIP and ISO 8583 Protocol
Engines. Each host that uses the ISO 8583 Protocol Engine and supports
reversals requires a file to store the pending reversal. This file is managed by the
ISO 8583 Protocol Engine and is deleted once the reversal is sent to the host.
The PIP Engine creates two files for every host that supports advice. Advice is a
transaction sent to the host to inform it of some previous action or offline
transaction. On occasion, AMEX uses a stand-in host. All transactions approved
by the stand-in must be forwarded to the capture host in the form of an advice
message. One file is an index file and the other file contains the actual advice
transactions. These files are completely managed by the PIP Engine and must not
be altered.
VERIX EVO ACT PROGRAMMERS GUIDE 79
PIP E NGINE
Mo du la r De sign
PIP Engine and The PIP Engine is a modular component in a larger application. The interface
Ap pl icat io n requirements are defined and must be strictly adhered to. The PIP Engine also
Construction requires additional modular components in Verix eVo ACT.
Toolkit
PIP requires that application include the following components from Verix eVo
ACT:
• ACL
• ISO 8583 Message Engine
• ISO 8583 Protocol Engine
There are several options available to complete interface requirements of the PIP
Engine. Recommendations and examples are provided in this manual. Feel free
to employ other techniques that are compatible with the overall application design,
provided that the application meets the stated interface requirements.
Modular A modular design approach enhances the flexibility of ISO 8583 programming and
Design the PIP Engine. Many applications may require support for one or more hosts
based on the ISO 8583 protocol. However, the requirements of these hosts may
vary greatly.
ISO 8583 Prot oco l Virtually any ISO 8583 host can be supported by making calls directly to the ISO
8583 Protocol Engine level rather than at the PIP level. In fact, the ISO 8583
Protocol Engine can be used in applications that do not require PIP-level
processing.
Communications
ISO 8583 The ISO 8583 Message Engine supports the message processing requirements
Message of the ISO 8583 Protocol. The functionality provided by this engine includes:
Engine • Assembly and disassembly of packets based on the ISO 8583 standard
• Management of the bitmap that defines the valid fields in each packet
• Conversion of data packet fields in request and response messages
PIP E NGINE
ISO 85 83 Me ssa ge En gi ne
The ISO 8583 Message Engine uses a field table, a variant field table, and a
converter table.
NOTE Although the ISO 8583 Message Engine is being discussed in the context of PIP, it
can be used in any application that is required to support the ISO 8583 standard.
For more information about the ISO 8583 Message Engine, refer to ISO 8583
Message Interface Engine.
The Field Table The field table is a master table that lists every data field that can be included in
any request or response packet. This is necessary to provide the engine with the
required information to access the application data elements, as well as complete
the necessary data conversion.
The field table describes every field that can be included in any request or
response packet. This table is used by the ISO 8583 Message Engine to
assemble and disassemble packets. Each table entry contains the field number,
the length of the field in the packet, an index into the conversion table for
converting the packet fields to and from the application data types, a pointer to the
application data variable, and the size of the application data element.
The table is an array of the following structure:
t ypedef st r uct
{
i nt f i el d_num;
i nt packet _sz;
i nt conver t _i dx;
voi d *r ef erence;
i nt var _ s z;
} f i el d_ st r uct ;
NOTE
The field table structure is defined in the ISO8583.H file.
PIP E NGINE
IS O 85 83 Me ssag e Engi ne
Parameters
f i el d_ num The field number corresponds to a bit position in the bitmap for the
ISO 8583 packet. When a packet is assembled or disassembled, the
bitmap indicates the next field to assemble or parse. The first ISO
8583 field is bit two, as bit one is used as a bitmap extension
indicator.
There must be a minimum of two elements in the field table array: the
TPDU and the message ID. Each of these fields is expected to be
packed BCD values and must be loaded into the appropriate
application variables by the s et _ t r ans _ f i el ds ( ) function. In
addition to the field number, the following two special entries can be
used in this field:
• SKIP indicates that the engine should skip over this field, because
it is being sent by the host but is not used by the application.
• STOP indicates that this is the last field in the table.
Note: The stop entry must be included in the table.
packet _sz Specifies the length of the field (or the maximum length for variable
length fields) in the ISO 8583 message. To determine the correct field
length, refer to the host documentation.
conver t _i dx Each field in an ISO 8583 message is required to be in a specific data
format. The ISO 8583 Message Engine includes a variety of
conversion functions that convert the data format defined for the field
to the required ISO 8583 data format (for example, BCD to string).
The convert index is an index into the convert table (see The Convert
Table) that indicates what conversion function pair to use for the
message field.
In addition to the convert index, the following two special entries can
be made in the convert index field:
• VARIANT indicates that the field varies depending on the
message. In this case, a variant field table is used as the
application variable. The ISO 8583 Message Engine accesses the
variant field table to determine the conversion required for the field.
• COMPUTE indicates that the contents of the field are calculated at
the time the message is assembled/disassembled. The application
variable field becomes a pointer to a function that performs the
required calculation.
r ef er ence Contains a pointer (variable name) to the application variable, variant
field table, or compute function required for the field. These variables
are usually character arrays (for example, char xxx[ xx] ; ) when
using the standard ISO 8583 conversion functions. Conversion
functions (for example, long to BCD) must be written and included in
the convert table when using a data format for variables other than a
character array.
var_sz Specifies the size of the application variable for this field. This
performs limits checking when disassembling messages.
An example of a completed field table follows. For more information
about how to construct the field table, refer to ISO 8583 Message
Interface Engine.
PIP E NGINE
ISO 85 83 Me ssa ge En gi ne
Applications specifying a value for 8583 sz smaller than the actual data length to
be converted may have been successful with earlier versions. Such applications
will now fail, returning an error value (-4). Programmers should correct the value
of 8583 sz to accurately reflect the maximum length of the data field.
Carefully inspect the 8583 sz field when using the following conversions:
AV2_STR, BV2_STR, AV3_STR, HST_BI2, HST_BI3, STR_AV2, STR_BV2,
STR_AV3, BI2_HST, BI3_HST, and AV3_AV3.
f i el d_ st r uct f i el d_ t abl e [ ] =
{
/ * Fi el d Packet Conver t Var i abl e Var i abl e */
/ * # Si ze I ndex Name Si ze */
{ 0, 10, BCD_STR, ( voi d *) t pdu, si zeof ( t pdu) },
{ 0, 16, BI T_BI T, ( voi d *) t _msg_i d, si zeof ( t _msg_i d) },
{ 3, 24, BI T_BI T, ( voi d *) t _pr oc_code, si zeof ( t _pr oc_code) },
{ 4, 12, BCD_SNZ, ( voi d *) t _amount , si zeof ( t _amount ) },
{ 5+ SKI P, 12, BCD_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{10+ SKI P, 8, BCD_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{11, 6, LNG_BCD, ( voi d *)& t _sys_t r ace, si zeof ( t _sys_tr ace) },
{12, 6, BCD_STR, ( voi d *) t _t i me, si zeof ( t _t i me) },
{13, 4, BCD_STR, ( voi d *) t _dat e, si zeof ( t _dat e) },
{14, 4, BCD_STR, ( voi d *) t _car d. exp, si zeof ( t _car d. exp) },
{15+ SKI P, 4, BCD_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{21+ SKI P, 4, BCD_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{22, 3, BCD_STR, ( voi d *) t _posem, si zeof ( t _posem) },
{23+ SKI P, 3, BCD_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{24, 3, BCD_ STR, ( voi d * ) t _ ni i , s i z eof ( t _ ni i ) },
{25, 2, BCD_STR, ( voi d *) t _poscc, si zeof ( t _poscc) },
{26+ SKI P, 2, BCD_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{34+ SKI P, 28, AV2_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{35, 37, BV2_STR, ( voi d *) t _car d. t r ack, si zeof ( t _car d. t r ack) },
{36+ SKI P, 104, AV2_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{37, 12, ASC_STR, ( voi d *) t _key. r r n, si zeof ( t _key. r r n) },
{38, 6, ASC_STR, ( voi d *) t _aut h_code, si zeof ( t _aut h_code) },
{39, 2, ASC_STR, ( voi d *) t _r esp_code, si zeof ( t _r esp_code) },
{40+ SKI P, 3, ASC_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{41, 8, ASC_STR, ( voi d *) t _host _dat a. t i d, si zeof ( t _host _dat a. t i d) },
{42, 15, ASC_STR, ( voi d *) t _host _dat a. mi d, si zeof ( t _host _dat a. mi d) },
{43+ SKI P, 40, ASC_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{44, 2, AV2_STR, ( voi d *) t _add_r esp, si zeof ( t _add_r esp) },
{45, 79, AV2_STR, ( voi d *) t _car d. t r ack, si zeof ( t _car d. t r ack) },
{46+ SKI P, 999, AV3_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{53+ SKI P, 16, BCD_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{54, 12, AV3_STR, ( voi d *) t _t i p, si zeof ( t _t i p) },
{55+ SKI P, 999, AV3_STR, ( voi d *) di scar d, si zeof ( di scar d) },
{59+ SKI P, 999, AV3_STR, ( voi d *) di scar d, si zeof ( di scar d) },
PIP E NGINE
IS O 85 83 Me ssag e Engi ne
The first two elements, the TPDU and message ID, have special meaning. These
elements must always be present in the field table. Each of these elements has a
field number of 0, which means they do not have bitmap assignments. More
information about each of these special fields follows.
The TPDU
The Transport Protocol Data Unit (TPDU) routes the SDLC message. It consists
of a transaction type identifier, an originator address, and a destination address.
For AMEX transactions, the transaction type identifier is either 0x60 for application
messages or 0x68 for NMS/TNMS transactions. The typical application only uses
0x60.
NOTE
Refer to Typical Host/Terminal Packet Structure for a diagram of each of the host/
terminal packet formats.
The originator and destination addresses are each two bytes. The TPDU should
be provided by the host. The TPDU is the only SDLC component that must be
provided (other than opening the port in SDLC mode).
NOTE In a request message, the destination address occurs before the originator
address. In a response message, the originator address occurs before the
destination address. This distinction is important.
PIP E NGINE
ISO 85 83 Me ssa ge En gi ne
The Message ID
The message ID indicates the type of message and message function. The
message ID is an ISO 8583 requirement, not an SDLC requirement. The message
ID is four digits and is compressed to two bytes when placed in an ISO 8583
packet. A description of each of these digits is in the following table.
Position Description
First Digit The version number (always 0).
Second Digit Message class. This variable depends on the requested transaction.
The following list identifies valid values for the message class. A host
may not use every message class.
• 1 = Authorization
• 2 = Financial capture
• 3 = File update
• 4 = Reversals
• 5 = Reconciliation
• 8 = Maintenance
Third Digit Message function. This identifies a particular operation for a message
type (as in a request for authorization or a financial capture response).
Valid values are:
• 0 = Request
• 1 = Response to a request
• 2 = Advice
• 3 = Response to an advice
• 4 = Notification
• 5–9 = These codes are reserved for ISO use
Fourth Digit Transaction originator. This position is always 0 for requests and
responses.
PIP E NGINE
IS O 85 83 Me ssag e Engi ne
The Convert Table The convert table contains pairs of pointers to functions that allow the ISO 8583
Message Engine to convert application data to packet data and vice versa. The
PIP Engine includes a standard set of conversion routines and a standard convert
table, which provide all the conversions needed for processing AMEX
transactions.
NOTE The ISO 8583 Message Engine Reference section contains instructions for
adding additional conversions to support other host packet requirements. The
function references for each of the conversion functions are located in the ISO
8583 Message Interface Engine Function Calls section.
The convert table must contain all the pairs are used by the application to convert
the data. Do not change the name of this table, conver t _t abl e. Entries may be
added to the end of this table. However, do not modify existing entries
conver t er s conver t _t abl e [ ] =
{
{asc_t o_asc, asc_t o_asc}, / * ASC_ASC 0 */
{av3_t o_av3, av3_t o_av3}, / * AV3_AV3 1 */
{bi t _ t o_ bi t , bi t _ t o_ bi t }, / * BI T_ BI T 2 * /
{bcd_t o_bcd, bcd_t o_bcd}, / * BCD_BCD 3 */
{asc_ t o_bcd, bcd_t o_asc}, / * BCD_ASC 4 */
{st r _t o_asc, asc_t o_st r }, / * ASC_STR 5 */
{st r _t o_bcd, bcd_t o_st r }, / * BCD_STR 6 */
{st r _t o_bcd, bcd_t o_snz}, / * BCD_SNZ 7 */
{st r _t o_av2, av2_t o_st r }, / * AV2_STR 8 */
{st r _t o_bv2, bv2_t o_st r }, / * BV2_STR 9 */
{st r _t o_av3, av3_t o_st r }, / * AV3_STR 10 */
{st r _t o_xbc, xbc_t o_st r }, / * XBC_STR 11 */
{hst _t o_bi n, bi n_t o_hst }, / * BI N_HST 12 */
{hst _t o_bi 2, bi 2_t o_hst }, / * BI 2_HST 13 */
{hst _t o_bi 3, bi 3_t o_hst }/ * BI 3_HST 14 */
};
Variant Fields Variant fields depend on the type of message being sent and the function of that
message. An example of a variant field might be the private fields 60 to 63. These
fields can be any length up to 999 bytes, and can be used for any purpose agreed
upon by the host and requesters.
The field table allows a special entry, VARI ANT, in the convert index to indicate that
a variant field table exists to further define this field. When the ISO 8583 Message
Engine encounters this entry, it selects the indicated field table and continues to
process the field entry for the message.
NOTE To use variant fields, you must create two functions: unsigned int return_variant1()
and unsigned int return_variant2(). For more information on how to write these
functions, refer to PIP Engine and Application Construction Toolkit.
PIP E NGINE
ISO 85 83 Pro toco l En gine
Computed Fields In some cases, a field may need to be computed. This computation may depend
on other fields in the packet, other application variables, the entire packet (such
as, a checksum), or other types of calculations.
The field table allows a special entry, COMPUTE, in the convert index to indicate that
a computed field table exists to further define this field. When the ISO 8583
Message Engine encounters this entry, it calls the function pointed to in the field
table entry and accepts the result as the contents of the packet field.
NOTE
Computed fields are not currently required to interface with the AMEX host. This
information is included in the event an alternate host requires this type of field.
ISO 8583 In addition to assembling/disassembling data packets (as described in the ISO
Protocol 8583 Message Engine section), the application must support the ISO 8583
Engine protocol. The ISO 8583 Protocol Engine was developed to provide this support.
This engine includes:
• an interface to the ISO 8583 Message Engine to assemble and disassemble
packets,
• an interface to the programmer-defined validation function that determines if
an appropriate response was received,
• an interface to the programmer-defined communications function that
transmits and receives request/response messages, and
• processes reversals as specified in the ISO 8583 Messaging standard.
PIP Engine has the following power-fail recovery mechanism:
• Determines if reversals are allowed, and that a transaction request is to be
generated. Create a contingent reversal file for that transaction request just
prior to the internal call to the programmer-supplied communication and
validation functions.
• On successful return of the programmer-supplied communication and
validation functions, or on return of any error not considered a reversal
condition, delete this contingent reversal file.
If a power failure occurs during this period of vulnerability, an internal routine
checks for a reversal file at the beginning of the next transaction request session.
If this file exists, it sends a reversal request as appropriate. No intervention by the
application is necessary.
PIP E NGINE
IS O 85 83 Pro to co l Engi ne
Protocol 8583 Data The ISO 8583 Protocol Engine uses the following data structure (defined in
Structure PROT8583. H) to provide information and application data variables.
t ypedef st r uct c8583dat
{
f i el d_ s t r uc t * p_ f l d_ t a bl e;
i nt *comm_handl e;
unsi gned comm_t i meout ;
unsi gned wai t _f or _car r i er ;
unsi gned char *map;
i nt ( * val i dat i on) ( ) ;
voi d *v_ par ms;
unsi gned v_par ms_ si ze;
i nt ( * t r ans cei ver ) ( ) ;
unsi gned char * t r ansmi t ;
unsi gned i nt t r ansmi t _si ze;
unsi gned tr ansmi t _l i mi t ;
unsi gned char * r ecei ve;
unsi gned r ecei ve_si ze;
unsi gned r ecei ve_l i mi t ;
unsi gned char *r ever sal ;
unsi gned r ever sal _si ze;
unsi gned r ever sal _l i mi t ;
unsi gned char *base_Pur posef name;
unsi gned char r ev_msg_i d [ 5] ;
i nt s t at e;
} COMM_8583_ DATA;
Programmer- To use the PIP Engine, write a function called s et _ t r ans _ f i el ds ( ) . This
Defined Setup function is called at the beginning of the PIP Engine and must set up the following
Function information:
• the processing code,
• the message ID,
• the TPDU, and
• the bitmap.
This information is used to build the request packet. In addition, this information
must be preserved as a structure to ensure that it is not overwritten by the data
included in the host response.
NOTE
For more information on how to write this function, refer to Integrating the PIP
Engine Into Your Application.
PIP E NGINE
Inte gr atin g th e PI P En gi ne In to Your Ap pl ic at io n
Integrating t he Integrating the PIP Engine and its associated modules into the application is a six-
PIP Engi ne Into step process:
Your 1 Plan and define all required tables and data structures.
Applicat ion
2 Write and test the r et ur n_var i ant 1( ) and r et ur n_var i ant 2( ) functions.
Step 1 - Plan and Declare the data elements required by each of the following engines:
define all required
Field table
tables and data ISO 8583
structures Variant field tables (if required)
Message Engine
Convert table
ISO 8583 COMM_8583_DATA structure
Protocol Engine Validation structure
Declarations and examples can be found with the engine files (when appropriate).
In addition to declaring the tables and data structures listed above, also declare a
variable named gu_cl r _st at e ( unsi gned i nt ) and initialize it to 0. This
variable can be used to support clear key processing in the pip_trans() and
prot_8583() functions. Each of these functions aborts processing and returns to
the caller if this variable is set to any value other than 0 (zero). This is a
convenient way to interrupt the function processing when the clear key is pressed.
Step 2 - Develop t he Variant field tables use two additional pieces of information to determine the
return_variant1 and description of the field. The functions r et ur n_var i ant 1( ) and
return_variant2 r et ur n_var i ant 2( ) must return values that are compared to entries in the
functions
variant field tables to indicate if the current entry in the field table is to be used, or
if the message engine should continue to process the variant field table. The ISO
8583 Message Engine provides functions for r et ur n_var i ant 1( ) and
r et ur n_var i ant 2( ) used to access the variant field tables constructed for the
AMEX host. These functions are generally useful in processing any ISO
8583-based host.
PIP E NGINE
In te grat in g the PIP En gine Into Your Appl ic at io n
When processing the field tables, the ISO 8583 Message Engine calls
r et ur n_var i ant 1( ) and r et ur n_var i ant 2( ) , then compares these values to
the values in the first two positions of each array element of the variant field table.
The convert index, variable name, and variable size fields have the same function
as their counterparts in the field table.
The following examples show the r et ur n_var i ant 1( ) and r et ur n_var i ant 2( )
functions and two sample variant field tables for fields 60 and 63. In these
examples, r et ur n_var i ant 1( ) returns the first two digits of the processing code
and r et ur n_var i ant 2( ) returns the message ID (each converts the data to
integer form).
/ * I f var i ant f i el ds ar e used, t hi s i nt eger val ued f uncti on must r et ur n a
val ue whi ch wi l l be used t o mat ch agai nst t he val ues i n t he f i r st f i el d of
var i ant f i el d t abl es . * /
unsi gned i nt r et ur n_var i ant 1( )
{
unsi gned char x [ 3] ;
MEMCLR ( x, 3) ;
/ * Most si gni f i cant 2 di gi t s of pr oc_code. */
SVC_UNPK4 ( x, t _pr oc_code, 1) ;
r e t ur n ( s t r 2i nt ( x) ) ;
}
PIP E NGINE
Inte gr atin g th e PI P En gi ne In to Your Ap pl ic at io n
{
/ * Var i - Var i - Pack Conver t Var i abl e Var i abl e ant 1 ant 2 Si ze I ndex
Name Si ze * /
{ 00, 320, 37, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 02, 320, 37, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 22, 320, 37, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 09, 320, 37, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 29, 320, 37, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 92, 500, 6, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 96, 500, 6, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 97, 500, 6, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 92, 510, 12, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 96, 510, 12, AV3_STR, ( voi d *) or _msg, si zeof ( or _msg) },
{ 00, 420, 22, AV3_STR, ( voi d *) ah_dat. dcp_or i g_msg, si zeof
( ah_dat . dcp_or i g_msg) },
{ 02, 420, 22, AV3_STR, ( voi d *) ah_dat. dcp_or i g_msg, si zeof
( ah_dat . dcp_or i g_msg) },
{ 22+ STOP, 420, 22, AV3_STR, ( voi d *) ah_dat . dcp_or i g_msg, si zeof
( ah_dat . dcp_or i g_msg) },
};
Step 3 - Writ e the Write a s et _ t r ans _ f i el ds ( ) function (an example is provided with the PIP
set_trans_fields Engine files). When this function call ends, the following must be complete:
function
• the system trace number is properly set (increment as needed),
• the processing code is loaded,
PIP E NGINE
In te grat in g the PIP En gine Into Your Appl ic at io n
t _s ys_t r ace++;
/ * The val i dat i on st r ucture f or t hi s appl i cat i on cont ai ns t he addr ess of
t he syst ems t r ace number and the or i gi nal val ue of t he t r ace number . Thi s
makes val i dat i on easi er . */
i nput _val _st r uct . p_t r ace = &t _sys_tr ace;
i nput _val _st r uct. b_t r ace = t _sys_t r ace;
PIP E NGINE
Inte gr atin g th e PI P En gi ne In to Your Ap pl ic at io n
/ * Some t r ansacti ons, such as adj ust ment s, r equi r e t he RRN of t he or i gi nal
t r ansact i on be sent as a f i el d i n t he r equest . Thi s appl i cat i on saves t he
val ue of t he request RRN si nce t he val ue i n t he f i el d t abl e wi l l be
overwr i t t en when t he response i s processed. */
i nput _val _st r uct. p_t i d = ( unsi gned char *) t _host _dat a. t i d;
return(1);
} / * end s et _ t r ans _ f i el ds ( ) * /
Step 4 - Writ e the The user-defined communications function (also called the transceiver function)
communications ensures that no restrictions are placed on the way communications are
function accomplished. The ISO 8583 Protocol Engine makes no assumptions about how
the application communicates and permits processing through a serial port,
modem, and so on.
The calling syntax and return values are defined (refer to the following table). This
interface definition allows the ISO 8583 Protocol Engine to correctly call the
communications routine, as well as return meaningful results on the success or
failure of the communications process.
Use #def i nes (listed in PROT8583.H) when writing the communications
function. This ensures that the proper values are used, makes the source code
more readable, and is easier to remember.
The function can have any name. The name of the function is placed in the
transceiver member of the COMM_8583_DATA structure. The function can also
be called directly by the application to complete other communication
requirements. The example provided is named mdm_ t r _8583( ) .
PIP E NGINE
In te grat in g the PIP En gine Into Your Appl ic at io n
TR_CLR_KEY (-47): Clear key press (no reversal). This value should not
be returned once the request has been sent.
i nt mdm_t r _8583 ( i nt h_devi ce, i nt mode, unsi gned char *r eq_buf , unsi gned
r eq_si ze, unsi gned char *r cv_buf , unsi gned rcv_l i mi t , unsi gned t i meout ,
unsi gned carr i er _t i meout ) ;
{
i nt r et _val = TR_SUCCESS;
unsi gned car r i er_ del ay;
unsi gned l ong r ecei ve_del ay;
char mdm_s t at us [ 5] ;
/ * Car r i er del ay i s i n seconds == 50 ms * 20 * del ay. */
car r i er _del ay = car r i er _t i meout * 20;
/ * Wai t f or car r i er t o be avai l abl e onl y i f t he mode i s TXRX. */
whi l e ( ( 0 == ( r et _val = mdm_check_ st at us ( h_devi ce, MDM_DCD) ) ) && TXRX ==
mode)
{
PIP E NGINE
Inte gr atin g th e PI P En gi ne In to Your Ap pl ic at io n
i f ( 0 < r et _ val )
{
/ * I f mode 0, t hen send r equest . */
i f ( TXRX == mode)
{
/ * Send t he r equest message. */
i f ( r eq_si ze ! = ( r et _val = wr i t e ( h_devi ce, r eq_buf , r eq_si ze) ) )
{
/ * Wr i t e f ai l t o devi c e, ei t her por t er r or , no buf f er s , or * not
enough char act er s wr i t t en */
err no = r et_ val ;
r et _val = TR_WR_FAI L;
}
}
/ * End t r ansmi t . */
PIP E NGINE
In te grat in g the PIP En gine Into Your Appl ic at io n
Step 5 - Writ e the Validation refers to verifying that the response received for a request is
validation function appropriate. This, of course, varies from one host to host. The ISO 8583 Protocol
Engine always validates the TPDU and message ID, and passes the result of the
validation to the validation routine of the application for further processing. The
ISO 8583 Protocol Engine will not abort the transaction, even if the TPDU and
message ID are both invalid. The engine relies on the validation of the application
to determine if the response is to be accepted or rejected.
The results of the validation are application dependent. Several options are
possible. The value returned by the validation routine dictates the action to take. A
positive return value indicates that the ISO 8583 Protocol Engine should call the
communications routine to wait for another response packet using the return value
as the time out in seconds. The validation routine may also return the #def i ne
RETRY_CONTROL_TIMEOUT (-15) to request another response message using
the time out in the ISO 8583 Protocol Engine data structure. The validation routine
may also return CREATE_REVERSAL.
PIP E NGINE
Inte gr atin g th e PI P En gi ne In to Your Ap pl ic at io n
AMEX Validat io n The ISO 8583 Protocol Engine provides two example validation functions that
Functions properly validate AMEX host transactions: amex_val i dat i on_l ow( ) and
amex_val i dat i on_hi gh( ) .
Since these functions are provided on the distribution diskette in source form, they
must be modified to support additional hosts. The functions can be used as is for
AMEX transaction processing. If the application is interfacing to other hosts, write
validation function(s) for each host.
amex_validation_low() Function
AMEX can respond with one of two special messages: The “Please Wait”
message means that the host is processing the request and the terminal should
allow another time period (usually 60 seconds) for the response. The “Hang Up”
message means that there is a problem processing the request (the host is not
available) and the terminal should abort the transaction request.
amex_val i dat i on_l ow( ) is responsible for detecting each of these response
messages. This function, called from amex_val i dat i on_hi gh( ) , either
processes one of these two messages as indicated or continues to validate the
response.
amex_validation_high() Function
The second validation routine is amex_val i dat i on_hi gh( ) . This function is used
as the validation routine in the ISO 8583 Protocol Engine data structure. This
function calls the amex_val i dat i on_l ow( ) function. If the response is “Please
Wait” or “Hang UP”, it is processed accordingly. Validation continues for all other
responses.
The Validation The next step in the validation process is to determine the proper validation
Process parameters. Reversals are processed prior to actual transactions. When a
reversal exists, two transactions are pending when the validation routine is called.
The validation routine tests the state in the COMM_8583_DATA structure to
determine if the validation is for a transaction request or a reversal. If the request
is for a reversal, the reversal parameters are copied from the beginning of the
reversal buffer to the local validation structure; otherwise, the transaction
validation parameters are used.
PIP E NGINE
In te grat in g the PIP En gine Into Your Appl ic at io n
The transaction amount, systems trace number, and terminal ID are now
compared. The transmitted and received values must match. The
amex_val i dat i on_hi gh( ) routine pads the amounts to a minimum of three
characters to ensure proper comparison. The validation routine expects the
systems trace number to be a global long, and it expects the terminal ID and
amounts to be strings. If other data types are used, change the comparisons in
amex_val i dat i on_hi gh( ) accordingly.
Another special case occurs if a DCP response is received for a reversal request.
The PIP Engine must create an advice message that is forwarded to the AMEX
host at a later time. The amex_val i dat i on_hi gh( ) function tests for this by
comparing the message ID to 0400, the reversal message ID. If the response is
for a reversal, then the value of field 44 is tested. If this field is 02, then a DCP
response was received for the reversal and the validation routine returns
AMEX_DCP_REVERSAL. Upon receiving this return code, the advice is created.
The validation routine returns a 0 if the response is valid for the request. This is
accepted by the ISO 8583 Protocol Engine, and the value either returns to the
caller, or processes the transaction request. This scenario varies with previous
transaction activity.
The ISO 8583 Protocol Engine includes a validation structure used with the
provided validation routines. Again, this structure may be modified as needed.
You are responsible for ensuring that the application meets AMEX validation
criteria.
The validation structure is listed below, followed by an explanation of its members.
t ypedef st r uct
{
unsi gned char b_amount [ 13] ;
unsi gned char b_t i d[ 9] ;
l ong i nt b_t r ace;
unsi gned char b_r r n[ 13] ;
unsi gned char *p_amount ;
unsi gned char *p_t i d;
l ong i nt *p_t r ace;
unsi gned char *cur r _key;
COMM_8583_DATA *comm_st r uct ;
} VALI DATI ON_STRUCT;
These parameters are loaded with the data for the current transaction. This
amounts to a backup of the transaction data, since an inbound message must be
disassembled and the original transaction data is overwritten.
PIP E NGINE
PIP Functions
The pointers in the validation structure are there to simplify the references to the
data in the field table. The same addresses could be accessed using the pointer
to the field table in the COMM_8583_DATA structure.
unsi gned char *cur r _key;
Pointer to the application variable containing the key used for the advice file. This
should be the ROC for AMEX host transactions.
COMM_8583_DATA *c omm_st r uct ;
Step 6 - Writ e the After completing the required table and functions described in steps one through
application five, integrate the PIP Engine into the application. Refer to the \TONLINE and
functions to call the \TPRO8583 subdirectories on the installation diskettes for examples of how to call
PIP Engin e
the ISO 8583 and PIP functions.
PIP Func tio ns The PIP functions are described in PIP Engine Function Calls.
PIP E NGINE
Troubleshooting PIP Application Modules
Solution • The application must set the bitmap of the RRN field even though
RRN does not exist.
PIP E NGINE
PIP/ISO 8583 Glossary
PIP E NGINE
PIP/ISO 8583 Glossary
CHAPTER 9
The Data Capture Engine provides programmers working in the Verix eVo
operating environment an easy way to manage the transfer of application data to
and from keyed data files. By using the Data Capture Engine, the programmer
eliminates the need to design, code, and test the functionality provided by this
engine.
Using a standard engine also provides the benefit of application maintenance.
Programming with the Data Capture Engine requires less time to implement
enhancements and make other required changes to the application.
The Data Capture Engine relies on the functionality provided by the Verix eVo
standard C Library and the ACL. By making use of these two library sources,
further leverage is gained by reusing functions, thereby further reducing test
efforts and application size.
Keyed File The design of the Data Capture Engine is based on the use of the keyed file
System system provided by Verix eVo. Keyed files contain records identified by a
programmer-specified name or key. This key writes and reads data to and from
the file allowing random access to the individual data records. The Verix eVo
operating system uses compressed variable length records (CVLR) for keyed
files. This introduces two limitations:
• Keyed files employ a data compression mechanism. This limits the type of
data that can be stored in the file. The compression technique converts any
lowercase alphabetic character to its uppercase equivalent, and packs ASCII
digits “0” through “9” into four bits. This limits the data being stored to bytes of
0x5F or less. Bytes greater than 0x5F return a different character when read
from a keyed file.
• The second limitation pertains to the length of the record. The data portion of
each record contains a byte indicating the length of the data as its first byte.
This length includes the length byte. This limits the number of characters that
can be written to a maximum of 254 characters (254 data characters + length
byte = 255); however, these are compressed bytes. Depending on the number
of consecutive numeric character pairs in the data portion of the record, up to
508 characters can be stored (if all characters are numeric).
Keyed files can be opened by the application prior to their use, but this is not
required. The file must exist, however. If a specified file is not open at the time
access is required, the file is opened, the requested operation completed, and the
file is closed. There must be a file handle available for the operation to proceed. If
the file does not exist or a file handle is not available, an error value returns.
Applicat ion Most application data is integer, long integer, character, or string data types. This
Data data, residing in RAM, must be stored and retrieved from data files to ensure that
it is not lost in the event of a power failure or similar event. The access of this data
is also random in nature.
The keyed file mechanism provides random access, but the data must be
converted to a compatible format (ASCII) for storage and converted again when
retrieved. These required conversions are accomplished by the Data Capture
Engine.
Data Capt ur e The data capture functions are described in Data Capture Engine Function Calls.
Functions
Example A data capture example program can be found in the Data Capture Engine
Program Example Program section.
CHAPTER 10
Modem Engine
Modem Engi ne The Modem Engine is made up of 27 functions and five macros. These functions
Functions and and macros are general-purpose routines that ease the use and management of
Macros the modem device. Function prototypes, macro definitions, structure declarations,
and #def i nes for many return and error codes are contained in the XMODEM. H
header file (see XMODEM. H Li st i ngs).
M ODEM E NGINE
MD M_ READ_B LK()
MDM_READ_BLK()
Parameters
h_ modem Opened modem device handle.
Opn_Bl k mdm_bl k Communication parameters.
Return Values
Success: SUCCESS: No errors occurred.
MDM_RESET_ERROR()
Resets the latched error conditions of parity, framing, and data overrun. These
conditions remain active until the modem device is reset. This function clears
errors that sometimes occur during connection or resets an error that occurs
during communication.
Parameters
h_ modem Opened modem device handle.
Return Values
Success: SUCCESS: No errors occurred.
M ODEM E NGINE
MDM_ STATU S()
MDM_STATUS()
Obtains the opened modem device communication status and copies it to the
global structure s t at us _ i nf o.
Parameters
h_ modem Device handle for opened modem.
Retur n Values
NOTE
If 0 returns, the modem status is copied to the global structure s t a t us _ i nf o.
The last element of the status array m_st at and contains the current signal
information bit settings set up as follows:
M ODEM E NGINE
MD M_ WRITE_ BLK()
MDM_WRITE_BLK()
Parameters
h_ modem Opened modem device handle.
Opn_Bl k mdm_bl k Structure containing communications parameters.
Return Values
Success: SUCCESS: No errors occurred.
NOTE
For Opn_Blk parameters, refer to the target terminals programmers manual.
Example The linked example code file demonstrates use of MDM_WRI TE_ BLK( ) .
M ODEM E NGINE
XMOD EM .H Li stin gs
XMODEM.H Table 6 lists the descriptions of return codes, function parameter constants,
Listings unions, and structures found in XMODEM.H.
Table 6 XMODEM.H Err or Ret urn Codes
#define Value Meaning
E_LATCH -5 Check latched error.
E_ READ_CMD -6 read() function failed.
E_ FW_READ_CMD -6 Modem is opened, read() firmware error
occurred at modem device initialization.
E_ FW_ONLY_ CR -7 Modem opened, firmware status initialize
reply is only <CR>.
E_ONLY_ CR -7 Hayes response returned only a <CR>.
E_HR_TI MEOUT -8 Hayes response function timed out.
E_ FW_TI MEOUT -8 Hayes response firmware time expired.
E_ FW_STATUS -9 Modem opened, Hayes “ERROR” returned
on firmware initialization.
E_WRI TE_ CMD -10 Unsuccessful write(); write() returned -1.
E_NOCARRI ER -11 DCD not present.
E_MI _READ_CMD -14 Modem opened; CONFIG.SYS *MI variable
contains an invalid Hayes command causing
read() to return -1.
E_MI _ONLY_ CR -15 Modem opened; *MI = <CR> as the only
Hayes response during the open.
E_MI _TI MEOUT -16 Hayes response *MI wait timed out during
modem open.
E_MI _STATUS -17 Modem opened; Hayes “ERROR” response
to *MI initialize during the open; invalid
Hayes command in *MI.
E_I NVALI D_RESP -18 Invalid modem response received during
read().
E_ STATUS_CMD -19 Get modem device status failed; ioctl()
returned -1.
E_READ -23 Error reading modem buffer; read() returned
-1.
E_I NPUT_PENDI NG -24 Input waiting at modem.
E_OUTPUT_FAI LED -25 Closing modem device failed due to output
pending from a previous write() to modem.
E_READ_BLK -26 Error reading modem parameters; ioctl()
returned -1.
E_WRI TE_BLK -27 Error writing modem parameters; ioctl()
returned -1.
E_H_FLUSH -28 Error trying to flush Hayes command path.
E_M_FLUSH -29 Error trying to flush modem data path before
the close() device call.
E_CLOSE -31 Failure to close modem device; close()
returned -1.
M ODEM E NGINE
XM OD EM.H Li stin gs
M ODEM E NGINE
XMOD EM .H Li stin gs
M ODEM E NGINE
XM OD EM.H Li stin gs
M ODEM E NGINE
XMOD EM .H Li stin gs
M ODEM E NGINE
XM OD EM.H Li stin gs
NOTE
This is applicable only for Vx670 terminal. For more information, refer to the
Silicon Laboratories Reference Manual.
Table 10
z
Latched Modem Device Data Error Conditions
#define Value Meaning
E_PARI TY 1 Parity error on data received.
E_ OVERRUN 2 Data overrun error on data received.
E_PARI TY_ OVERRUN 3 Parity and data overrun error on data received.
E_FRAMI NG 4 Framing error on data received.
E_PARI TY_FRAME 5 Parity and framing error on data received.
M ODEM E NGINE
XMOD EM.H Str uc tu res an d Un io ns
XMODEM.H The following structures and unions are used by functions and macros to set or
Structures and retrieve mode device parameters.
Unions
M ODEM E NGINE
Mo de m Func ti on s
struct reject_struct The reject record structure used by MDM_RESET_ERROR() macro while calling
ioctl().
s t r uc t r e j ec t _ s t r uc t
{
char *buf _addr ;
/ * Locat i on t o stor e rej ect queue recor d */
i nt buf _ s i z e;
/ * Si ze of r ej ect queue r ecor d st or age l ocat i on */
};
struct stat_struct The modem status structure used by ioctl() during xmdm_check_status(),
xmdm_input_pending(), xmdm_failed_output_pending() and
xmdm_output_pending() to store the current modem status.
struct stat_struct
{
unsi gned char m_st at [ 4] ;
unsi gned char max_sl ot s;
};
Modem The modem functions are described in Modem Engine Function Calls.
Functions
Example A Modem Engine example program can be found in the Modem Engine Example
Program Program section.
CHAPTER 11
Report Formatter
R EPORT F ORMATTER
In co rpor at in g th e Re po rt En gi ne in an Appl icat io n
In addition, the output initializer function should perform any device initialization.
Sample output initializer functions are provided with the report engine. These
sample functions initialize direct output through an Application Construction
printer driver to the ITP of the terminal.
Incorporating The following steps show how to use the report conversion utility and report
the Repor t formatter.
Engine in an 1 Create an ASCII report format file and corresponding GVARS.H file.
Applicat ion
All variables referenced in the report format file must be defined in GVARS. H.
GVARS. H may also contain other variables not referenced in the report
format file. See the global variables declaration file.
2 Run the report engine conversion utility, FORMCVT, to convert the ASCII
Report Format file to a binary template file.
FORMCVT generates a variable index file, APPLI C. H.
An output initializer function initializes the variables that specify functions
interfacing with the output device; it also opens and initializes the output
device. The output initializer functions listed in step four are provided with the
report engine for a direct interface to the following printers: P150DIR.C,
P250DIR.C, and so on.
4 Use the following functions to generate a report from the application:
R EPORT F ORMATTER
Conditional Printing
For instance, an application can consist of one . OUT file and four template
files. To download this application:
a Create an ASCII text file called DOWNLD. SYS. The contents of the file can
be:
I AMEX001. OUT
I SPOT. FRM
I EOD. FRM
I EOF. FRM
I RECEI PT. FRM
In this example, AMEX001. OUT is the downloadable application, the rest are
report template files.
b Type the following command at DOS prompt:
DDL - FDOWNLD. SYS
Conditional The AC report engine supports conditional printing. At report generation, the
Printing report engine formatter determines which lines are printed by comparing a user-
defined condition variable (see Report Formatter Example Program) with
corresponding conditional codes in the template file. If the conditions evaluate to a
Boolean true value, the line prints. This allows a variety of reports to be generated
using a single template.
Report This utility is a stand-alone program running under the DOS operating system.
Conversion The command line FORMCVT syntax is as follows:
Utility FORMCVT I NPUT_FI LE[ . TXT] [ - f TEMPLATE. FRM] [ - hTEMPLATE. H]
• I NPUT_FI LE is the ASCII report format file that contains the report format. If
the extension is omitted, it defaults to . TXT.
• - f specifies an alternate binary output filename. If this option is omitted, the
template filename is the same as the input file name with a . FRMextension.
• - h specifies an alternate output variable index filename. If this option is
omitted, FORMCVT generates an index filename APPLI C. H. This file is used
by the report engine functions; do not change these functions.
R EPORT F ORMATTER
Re po rt Form at File Gu id el in es
FORMCVT also requires the input variable definition file GVARS. H. FORMCVT
assumes this file exists in the current directory. GVARS. H contains the definitions
of all variables referenced in the report format file. If an application uses multiple
binary template files, GVARS. H contains the cumulative definitions for all the
global variables used in these reports.
NOTE
GVARS. H and APPLI C. H must be included the application at compile time.
Repor t Format A report format file is a FORMCVT ASCII input file that defines the layout,
Files variables and print characteristics for a report. FORMCVT then generates the
corresponding binary file used by the report engine formatter during report
generation.
Some examples of report layout commands are “center a literal string” and “left
justify a variable”. Examples of print characteristic commands are “print in red”
and “print in compressed mode”. All commands supported by FORMCVT are
listed in Report Format File Guidelines.
To include global variable values in a report, the variable names must be
referenced in the report format file. These variables must also be provided to
FORMCVT in GVARS. H. At report generation, the report engine formatter formats
these variable values in the report.
The report format file and GVARS.H can include the following types of variables:
• character (char)
• string (character array)
• integer
• long integer
• structure elements (the structure path must be provided)
• array (of any type)
Floating point and double types are not supported. To include floating point values
in a report, declare the report variable as a string and format the floating point
value in the string before calling the report engine formatter.
Repor t Form at The following rules apply to the format and content of each line of the ASCII report
File Guidelines format file. References are made to the example format file.
1 Start each report line with a line number.
Valid line numbers range from 1 to 127. Leading zeros are not required, but
can be added for text alignment.
Line numbers do not have to be sequential, but each must be greater than or
equal to previous line number. Skipped line numbers can be printed as blank
lines or simply ignored.
R EPORT F ORMATTER
Re po rt Form at File Gu id el ines
In the Example Format File, note that line 3 has been skipped. A parameter
in the call to f or mat er _l i ne( ) within the application specifies how lines 3,
9, 14, and 17 are printed: either as blank lines or skipped.
At report generation, the report engine formatter can be instructed to print
one line or a number of lines. Lines can also be reprinted any number of
times.
2 The character immediately following the line number must be a colon (:), an
ampersand (&), or an equal sign (=).
Both the ampersand and the equal sign indicate that the line is conditional,
and they are followed by a value defining this condition. The colon signals
the end of the conditional portion and the beginning of the text portion of the
line.
&X000A
&B1010
&D0010
All values are numerically right justified, making these values also equivalent
to:
&X00000001
&X000001
&X1
When multiple conditionals are defined for a given line number, the first one
evaluating to true prints. At this point, the report engine formatter begins
processing the next sequential line number in the sequence.
NOTE
A line number followed only by a colon always evaluates to true.
R EPORT F ORMATTER
Re po rt Form at File Gu id el in es
Acceptable:
i nt i t em; / * I t em Pur chase Number * /
Unacceptable:
/ * I t em Pur chase Number * / i nt i t em;
In the report format file, a comment must occupy the entire line. Embedded
comments are not allowed.
Acceptable:
/ * The next l i ne i s l i ne one */
01&X0001: 1. 40, \ Cmer chant
Unacceptable:
01&X0001: 1. 40, \ Cmer chant / * l i ne 1 */
For ease of reading, white space characters (blank lines, spaces, tabs, and
so on) can be used in these files.
NOTE
In the GVARS. H file, variable declarations must start in column one.
R EPORT F ORMATTER
Re po rt Form at File Gu id el ines
The first field begins immediately after the colon that terminates the
conditional value. Subsequent fields are separated by semicolons (;). Each
line can contain multiple fields.
In the example, Example Format File, line 2 uses only the first field, while line
10 uses the first and second fields.
Only one data element can be specified per field. This can be either of the
global variables defined in GVARS. H or a string constant.
The value of t emp is centered on the first line of the report starting in column
one and ending in column 13.
01: 1. 13, \ Ct emp; 20. 30, " \ W\ CTESTI NG"
The string TESTING prints double-wide (\W) and centered in the field (\C)
between columns 20 and 30.
NOTE The starting and ending column numbers must be separated by a period and must
be in range for the printer device used. A comma (,) must follow the ending
column number.
5 Starting and ending column numbers must be specified for every field.
If the width of a field exceeds the width defined by the starting and ending
columns, the field is truncated.
R EPORT F ORMATTER
Re po rt Form at File Gu id el in es
6 Special print characteristics and layout commands are expressed in the form
of a two-character string, “\X”, where X is any one of the following:
A: Print the following string or variable in Arabic.
B: Print the following string or variable in black.
C: Center the following string or variable in the specified column range
preceding this command.
D: Print the following string or variable in red.
E: Turn off printing in red.
F: Set the character size to 5 x 7 and enable underline printing.
G: Print logo file.
H: Print the following string or variable in double height.
I: Reinitialize the printer.
J : Set the character size to 7 x 7.
L: Left justify the following string or variable in the specified column
range preceding this command.
N: Restore the printer to normal printing mode.
P: Eject six blank lines in the printer.
R: Right justify the following variable or string in the specified column
range preceding this command.
S: Enable printing in compressed mode.
T: Select font size and font table.
W: Print the following string or variable in double width.
X: Hexadecimal printing using the selected font table.
Z: Use ASCII character set.
%(percent) Specifies the pad character to use when printing variables. The
default pad character is a space (ASCII 32). This character pads the
width of the field regardless of justification.
These special print characters can be specified in or out of the literal strings.
In the example, line 1 centers and prints the contents of the global variable
merchant in double width.
Line 13 of the example prints the literal string “TOTAL: $”, also in double
width.
Errors If FORMCVT detects any errors, it displays an error message and aborts the
parsing operation.
R EPORT F ORMATTER
Ex am pl e Fo rmat Fi le
Example An example demonstrating the use of conditional lines is given in the sample
Format File format file.
Global All the variables shown in the Example Format File must be declared in the global
Variables variables declaration file GVARS.H.
Declaration Each line in this file should contain only one variable declaration, and each
File declaration must start in column 1. C-style comments are allowed in this file, with
the exception that comments cannot be placed in front of variables.
/ * decl ar at i ons f or gl obal var i abl es used i n t he repor t */
i nt i t em;
char amount [ 13] ;
char t i p[ 13] ;
char t ot al [ 13] ;
char mer chant [ 20] ;
char dat e_t i me[ 20] ;
char t _car d_acct[ 30] ;
char t _card_exp[ 5] ;
char t _aut h_code[9] ;
char t _i nvoi ce[ 7] ;
Data Structures The following Global #defines table, defines the global variables found in file
APPLIC.H.
Global Structures The following structure is used by the report formatter to store the information
about all global variables used in the report generation process.
t ypedef st r uct
{
voi d *addr ;
i nt t ype;
} g_dat a;
g_dat a data[ ] ;
The address of the variable is stored in the first element of this structure and the
type, as shown in the Global #defines section above, is stored in the second
element, t ype. The number of elements in dat a[ ] is application dependent.
R EPORT F ORMATTER
Re po rt Form at te r Fu nc tion s
Sampl e Outp ut The following sample receipts demonstrate the use of conditional true and
conditional false output, and are based on the examples provided on the
preceding pages.
Report The report formatter functions are described in Report Formatter Function Calls.
Formatter
Functions
Example A report formatter example program can be found in the Report Formatter
Program Example Program section.
CHAPTER 12
The Database Library supports database file operations (for example, open, read,
write, and delete) with key-based search of data records.
The Database Library provides function calls to create and manipulate a
database. This library is based on an index (keyed) file system to allow specified
search key(s) to access individual records in the database. These search keys
provide random access to the database. There are two major advantages in using
this keyed file system:
• A structure can be defined for an index (key) file. The structure contains the
list of search keys required to access the database records (for example, card
number and server ID). Utilization of search keys provides a fast access
method into the database.
• Database records can be compressed externally to save system memory.
File Formats Database and index file formats are discussed in this section.
Database Fil e The database contains variable length records. Each record is composed of a
Format forward length component, the actual data, and a backward length component.
This record format is referred to as Double Variable Length Record (DVLR). The
DVLR format allows searching the database in both directions, forward and
backward.
D A TA B A SE L IBRARY
File Storage Structure
Index File Format Each time a database file is open (create) using the API call db_open(), a
corresponding index (keyed) file is created. Each index file record includes the
search keys used to access records in the database. The minimum requirement
for each index file record is a field of LONG used to store the offset address of the
associated database record. The index record format can be expanded by adding
fields to define each search key. The following example illustrates an index file
record structure:
t ypedef st r uct
{
l ong r ec_ num;
shor t whi ch_t r ack; / / 0 = Manual ent r y, 1 = Track 1, 2 =
Tr ack 2
char host no[ 3] ; / / Host number
c har s er ver [ 4] ; / / Ser ver I D
char t i cket [ 29] ; / / Ti cket number , aut o_downl oad f i el d
char Card_t ype[3] ; / / Two charact er car d t ype
}DB_I DX_KEY
When calling db_ open( ) , si zeof ( DB_I DX_KEY) should be used as the parameter
for key length.
File Storage Figure 5 shows the file storage structure. Header, Rec1, Rec2, and Rec3
Structure represent the index records. Data Rec 1, 2, and 3 represent the data portion of the
records. Each data record consists of FLEN, Data Rec, and BLEN. Each index
record stores the offset for a particular data record.
For example, Rec1 stores an offset value of 0. Assume the length of Data Rec 1 is
21, then,
FLEN+Length of Data Rec 1+BLEN = 25 or (2+21+2 = 25)
where, FLEN = BLEN = 2 bytes.
Now, Rec2 stores an offset value of 25. Similarly, if the length of Data Rec 2 is 50,
Rec3 stores an offset value of 25+(2+50+2) = 79. So, if a data record is deleted in
the database, the corresponding data and index records are removed and only
the offsets are recomputed.
D A TA B AS E L IBRARY
Da taba se Li brary Fu nc ti on s
NOTE
The record numbers start at zero. The delete operation slows down the application
as the offsets must be updated.
File Compression Although the Database Library can read and write compressed records, a
compression function is not provided in this library. Compress or decompress
database records prior to calling any of the Database Library functions.
Database The Database Library functions are described in Database Library Function Calls.
Library
Functions
D A TA B A SE L IBRARY
Da ta ba se Li brary Fu nc ti on s
CHAPTER 13
Printer Drivers
The printer driver provides an easy way to manage printing and use various
printer attributes provided.
Various types of printing supported by the printer driver are as follows:
• LOGO type printing
• Printer Font Type printing (PFT)
• Printing monochrome bitmaps
Veri x eVo The ITP is a thermal array printer that communicates with the host terminal
Based Termin al through the RS-232 port. The data format of the ITP is fixed at 8 bits, no parity, 1
ITPs stop bit (8N1) at 19200 bps. It has 64 font tables used to download user-defined
fonts for printing.
The ITP has the following additional features:
• Downloadable user fonts
• Downloadable user logo
Downloadable Lists the sizes of the fonts that can be downloaded to the Verix eVo based
User Fonts terminal ITPs.
Table 13 Font Sizes
Bytes Per Font Tables
Font Resolution Font Size
Character Required
5X8 2 8 1
8X14, 42 column modea 3 14 2
8X14, 32 column mode 4 14 2
16X16 1 32 4
24X24 5 72 9
32X32 6 128 16
48X48 7 288 36
64X64 8 512 64
a. Indicates the default font when the printer is powered on.
P RINTER D RIVERS
Do wn load ab le Pri nt er Lo go
Downloadable The ITP can handle logos of various sizes, with a maximum dimension of 384
Printer Logo horizontal dots by 240 vertical dots (384X240). Only one image can be
downloaded at a time to the ITP.
NOTE
Downloading a new logo into the ITP erases the any other logo stored in flash.
NOTE
The printer ID for the Vx520 and Vx680 will be P.
Printing This feature enables printing of monochrome bitmaps independent of the printers.
Monochrome This feature is supported in Verix eVo terminals.
Bitmap • Printing Monochrome Bitmap
Printer Driver The printer driver functions are described in the following section:
Functions • Print Pak 3700 Function Calls
P RINTER D RIVERS
Ex ampl e Program
P RINTER D RIVERS
Ex am pl e Progr am
CHAPTER 14
Function Calls
F UNCTION C A L L S
AC Librar y Fu nc ti on Cate go ries
AC L ibrar y The functions in this library are organized into one of four functional groups:
Function • string,
Categories
• console I/O,
• device, and
• utility.
The level for each group indicated in the following table, refers to the functional
level of the routine. The AC Library is self-referencing, meaning that some
functions in the library depend on other functions also in the library. Understanding
function levels helps to show the relationship of one function to others in the
library. The four groups are as follows:
Level Description
0 Macros that do not depend on any ACL function.
1 Compiled C functions that can use level 0 macros.
2 Functions that use at least one function from level 1.
3 The most complex functions in the ACL — can use ACL functions from any
level.
Each function in the AC Library is listed by category and level in Table 14.
Table 14 Verix eVo ACT Library Functions by Category
Function Level Function Level Function Level
Consol e I/O
File Functi ons
Functions
delete_dvlr/ivlr 3 scroll_buffer 2
do_compression 3
insert_dvlr/ivlr 3 beep 1
read_dvlr/ivlr 3 bitfun 1 str2dsp_len 1
seek_dvlr/ivlr 3
write_dvlr/idvlr 3 display 1 view_buffer 3
Device
Functions
card_parse 3 display_at 2 String
Functions
chk_card_rdr 1 append_char 1
CHK_TIMEOUT 0 display_new 2 atox1
clock2int 3 2 chars2int 1
clock_data 3 dsp_strs 2 chk_luhn 2
ERR_BEEP 0 ctons1 1
p_set_baudformat 1 getkbd_entry 3 delete_char 1
3 f_dollar 2
set_itimeout 2 1 fieldcnt 1
F UNCTION C A LL S
AC Libr ary Fu nc tion Cate go ries
F UNCTION C A L L S
AC Librar y Func ti on Call s
AC L ibrar y This section describes the following AC library function calls:
Function Calls
• act_kbd_pending_test() • fieldfix() • NORM_BEEP()
F UNCTION C A LL S
act_kbd_pending_test()
act_kbd_pending_test()
Parameters
t arget code Character key code to be checked by the function. Valid values are:
• KEY_ CANCEL
• KEY0 to KEY9
• KEY_a to KEY_g
Retur n Values
Success: 1: The target character is present in the keyboard buffer.
append_char()
Parameters
s t r i ng Buffer with null-terminated string.
c Character to append.
NOTE
Bounds checking are not performed. The calling routine is responsible for
ensuring that space is available for the additional character.
Example The linked example code file demonstrates use of append_char(). Also see the
example in the EXTRANS.C section.
F UNCTION C A L L S
atox()
atox()
Parameters
charact er Character to convert.
Return Values
Success: 0–15: Successful operation.
beep()
Activates the beep feature of the terminal. Based on thet ype parameter, beep( )
produces one of two types of beeps, both can occur on a conditional or
unconditional basis.
A conditional beep is based on the value of the *BP parameter in the system
CONFI G. SYS file. If the *BP value is zero or empty, the beep executes, therefore,
default allows a conditional beep. A non-zero value prevents a conditional beep.
Return Values The function returns on completion of the beep. No value is returned.
F UNCTION C A LL S
bitfun()
bitfun()
Parameters
map Pointer to an unsigned integer bitmap.
bi t Bit to manipulate: 0–15, counting from the right.
set Action to take on bit:
F UNCTION C A L L S
card_parse()
card_parse()
Accepts data from the card reader and parses it to the selected track data.
Parameters
track Card reader data.
par sed Parsed output.
or der Track selection order.
Return Values
Success: 1,2,3: Track number that was read (successful).
Failure: TK_NOT_FOUND (-1): None of the tracks specified in or der contained a
valid data status byte.
INVLD_ORDER (-2): The order contains a character that is not 1, 2, or 3.
BAD_READ (-3): An attempt to parse a track field in the card read data
fails.
INVLD_FORMAT (-4): Invalid format.
ACT_FRAMING_ERROR (-6): Track status byte from card read is 2, 3, or
4. Parsed track is still stored in structure TRACK , and errno contains the
parsed track.
where,
• [ C] is a single byte representing the length of the string containing the track
data, including the count byte.
• [ S] is a one byte status of the read for the track.
• [ t r ack dat a] is the complete track read of the track (if available). This field
is omitted for tracks not available on the terminal; however, the count byte and
status are provided for all three tracks.
Three of these fields are read from the card device regardless of how many
physical tracks are read by the terminal. The tracks appear in order from track 1 to
track 3, for example,
[ C1] [ S1] [ t r ack1] [ C2] [ S2] [ t r ack2] [ C3] [ S3] [ t r ack3]
F UNCTION C A LL S
card_parse()
F UNCTION C A L L S
card_parse()
F UNCTION C A LL S
card_parse()
Not all fields are available on all tracks; the following table indicates the fields
available after parsing. This function clears all fields in the structure prior to
parsing. Any fields not used for a particular track are zero-filled.
The track field is an exact copy of the data portion of the track field of the card
read. This can be used for inclusion in packets or additional parsing, if required.
The actual parsing of the track field is accomplished by calling the ACL routine
track_parse().
For tracks 1 and 2, if discretionary data is not available, card_parse() returns
success and the discretionary field is null.
NOTE
Data must be formatted as read from card reader.
F UNCTION C A L L S
chars2int()
chars2int()
Parameters
s_buf f er Pointer to a buffer containing the string to convert.
i _num Number of characters in the buffer.
Return Values
Success: Converted integer.
CAUTION This is an integer function. Be sure to convert values in the correct range. If the
string exceeds five characters, it is truncated on the right. For example, -12345
convert to -1234.
Any invalid string character is ignored. For example, 1A2B3 converts to 123.
F UNCTION C A LL S
chk_card_rdr()
chk_card_rdr()
Checks if data is available from the card reader port. This function is similar to the
keyboard function KBHIT().
NOTE
Use of this function on platforms where no magnetic card device exists will always
return 0.
Parameters
h_car d Handle of card reader port.
Retur n Values
Success: 0: Data is available.
NOTE This function reads the card data and writes the data back to the card reader. So
the complete data read from the card can not exceed the value of CARD_SI ZE as
defined in ACLDEV. H (the amount of space allocated for the read). If the bytes
read are less than one, no write to the card reader is executed. The card reader
device must be open.
F UNCTION C A L L S
chk_luhn()
chk_luhn()
Accepts a null-terminated string containing digits, and verifies that the last digit in
the string is the correct MOD 10 check digit for the preceding digits in the string.
Parameters
buf f er String to check.
Return Values
Success: 1: The MOD 10 check digit is valid.
-1: The string has no character, more than 25 characters, or less than 2
characters.
Calls SVC_MOD_CK( ) to complete the check and returns the result of
SVC_MOD_CK( ) .
NOTE
String limits are 25 maximum and 2 minimum.
Example The linked example code file demonstrates use of chk_l uhn( ) .
F UNCTION C A LL S
CHK_TIMEOUT()
CHK_TIMEOUT()
Uses the i oct l ( ) function to compare a value specified by t i me_val to the
current clock tick value. CHK_TIMEOUT() returns TRUE(1) if the comparison
value is greater than the current clock tick value.
Parameters
h_cl ock Clock handle.
t i me_val Time value in ticks.
Retur n Values
Success: 1: Time out not expired.
Example The linked example code file demonstrates use of CHK_TI MEOUT( ) .
F UNCTION C A L L S
clock_data()
clock_data()
Parameters
c l oc k Clock handle.
i _ t y pe Type of action to perform with clock:
• 1 = set clock
• 0 = get clock data
cl ock_buf f er Command string defining the desired clock output string. Only
used on get clock data operations ( i _ t y pe = 0). The
command should have a combination of punctuation (spaces,
commas, slashes, and so on) and command codes from the
following table.
Clock
G A or P A.M. = A
P.M. = P
F UNCTION C A LL S
clock_data()
Retur n Values
Success: 1: No problems.
F UNCTION C A L L S
clock2int()
clock2int()
Converts a date-time string to the equivalent integer values. The date-time string
can be provided to the function or obtained by reading the clock device.
Parameters
h_cl ock Clock handle, used only when buffer is null.
buf f er Date-time string to convert. If null, current time is read.
If date-time is provided in buffer, it must be in the format yyyymoddhhmissw,
• where, yyyy is the year,
• mo is the month,
• dd is the day,
• hh is the hour,
• mi is the minutes,
• ss is the seconds, and
• w is the day of week.
Day-of-week values range from 0 to 6, with Sunday being 0. If the date
value provided in buf f er is not properly formatted, the results are
unpredictable.
year Converted year.
mont h Converted month.
day Converted day.
hour Converted hour.
mi n Converted minutes.
sec Converted seconds.
wday Converted weekday.
Return Values
Success: > 0: Success.
F UNCTION C A LL S
ctons1()
ctons1()
NOTE It is important to remember that the length of a counted string is indicated by the
length byte rather than a null at the end. One advantage of the counted string is
that it contains data that can contain nulls. When using counted strings, be
extremely careful about using C functions designed to operate on null-terminated
strings.
The memory space for a counted string and a null-terminated string are the same.
Allocate one byte for each data character, plus one byte for either the null or the
count byte.
Parameters
s t r i ng String to convert.
Zero in string[0] is invalid. ctons1() treats this condition as an empty null-
terminated string and does not modify the string.
If s t r i ng[ 0] is 1, the counted string contains only the count byte. In this
case, s t r i ng[ 0] is set to 0 creating an empty null-terminated string.
Retur n Values This function returns a pointer to the converted null-terminated string.
A counted string must have a minimum length of one (the count byte).
F UNCTION C A L L S
cvt_ym()
cvt_ym()
Computes the total number of months from the year 0000 A.D. to the time given in
a buffer in yyyymm format.
NOTE
The year must be between 1969 and 2068.
Parameters
ym Year and month for conversion in yyyymm format.
Return Values
Success: Positive: Number of months.
delete_char()
Deletes a single character from a null-terminated string. The length of the string is
decremented by one. The del _pos parameter specifies the characters offset into
the string, with zero being the beginning of the string.
Parameters
s t r i ng String from which to delete a character.
del _pos Zero-based position of the character to delete.
Return Values
Success: 0: Length of the modified string.
Failure: -1: pos was larger than the allowable string length or the position value was
negative.
Example The linked example code file demonstrates use of del et e_char ( ) .
F UNCTION C A LL S
display()
display()
Parameters
di s pl ay_ s t r i ng Null-terminated string.
Retur n Values
Success: 0: Number of characters actually written to the display. This return
value is the actual return value from wr i t e( ) .
F UNCTION C A L L S
display_at()
display_at()
Repositions the cursor by column and line number before displaying a string and
optionally, clears the display.
The cursor is repositioned using the got oxy( ) function. Applications written for
single-line displays should always specify line 1 as the line number; however, the
col umn parameter can be useful to position displays.
Multiline applications should provide a line number appropriate for the intended
platform. Refer to the programmers manual for the target terminal.
Parameters
col umn Display column.
l i ne Display line position.
di s pl ay_ s t r i ng Null-terminated string.
cl ear Clear display option.
The following three cl r options are available and are defined in
ACLCONIO.H:
• CLR_LINE: Clears the entire line selected for the display
operation.
• CLR_EOL: Writes the display message, and then clears to the
end of the line.
• NO_CLEAR: Does not clear any portion of the display or any
other value.
Return Values
Success: 0: Number of characters actually written to the display. This return
value is the actual return value from wr i t e( ) .
NOTE
Column and line values are not checked to ensure they are appropriate for the
terminal.
Example The linked example code file demonstrates use of di spl ay_at ( ) .
F UNCTION C A LL S
display_new()
display_new()
Displays the message in column one of the current line, then clears the display to
the end of the line. The message must be null-terminated.
Parameters
mes sage Pointer to the buffer containing the null-terminated message to display.
Retur n Values Positive number indicates the number of characters actually written to the display.
This is the value returned from wr i t e( ) .
Success: 0:
Example The linked example code file demonstrates use of di spl ay_new( ) .
F UNCTION C A L L S
do_compression()
do_compression()
Parameters
mode Mode to execute:
• COMPRESS_RECORD; Size of compressed data.
• UNCOMPRESS_RECORD; Size of uncompressed data.
Return Values
Success: 0:
F UNCTION C A LL S
do_compression()
Example The linked example code file demonstrates use of do_compr essi on( ) .
F UNCTION C A L L S
dsp_strs()
dsp_strs()
Accepts one or more null-terminated strings and displays the string on the
STDOUT device.
This routine calls the write() function once for each string parameter. The display is
not cleared and the function uses the current line and column for the start of the
display.
Parameters
va_ al i s t Argument prototype for display string(s).
Return Values
Success: 0: Number of characters actually written to the display for the last string.
This return value is the actual return value from the wr i t e( ) function.
CAUTION
The final argument must be a null. The behavior of the function is undefined if the
parameters are not null-terminated strings or the trailing null is omitted.
ERR_BEEP()
Activates the beep feature of the terminal. The function produces an error beep,
that is lower in pitch than a normal beep.
Retur n Values The function returns before completion of the beep. No value is returned.
This function is implemented as a macro.
F UNCTION C A LL S
f_ doll ar()
f_dollar()
NOTE f _ dol l ar ( ) is not bound by an internally allocated buffer. The only string size
limitation is that the data buffer must be large enough to accommodate the input
data with all format characters.
Parameters
data_pt r Pointer to the I/O buffer.
pr ec Number of decimal digits.
dol _ f l ag $ format flag. Valid values are defined in ACLSTR.H as follows:
dol _f or mat Radix and separator format. Valid values are defined in ACLSTR.H as
follows:
Value Define Radix Separator
F UNCTION C A L L S
fi el dc nt ()
fieldcnt()
Copies the nth counted field from a source buffer specified in buf . f i el dcnt ( )
starts the first counted field at the position specified by s t a r t and moves down to
the field specified by count . The string is then copied to the destination buffer.
Counted fields are defined by a count byte and a series of data bytes. The value
of the count byte is the length of the data string plus the count byte. Counted fields
can contain null characters.
Offset values begin at 0 for the first position in the source string. If the return value
is 0 or -1, a null character is returned in the destination buffer.
Parameters
buf Pointer to source buffer.
start Offset of counted fields.
count Field number to copy.
dest Destination buffer.
Return Values
Success: 0: Actual number of characters copied.
Failure: -1: The field does not exist, a parameter was out of range, or a count byte
was zero.
NOTE IA null character is appended to the destination buffer. Since the counted field can
also contain null bytes, the first null byte is not necessarily the end of the data.
Verify the return value by the actual number of characters in the field.
F UNCTION C A LL S
fi el df ix ()
fieldfix()
Parameters
buf Source buffer.
start Starting offset (0-based).
s i ze Number of characters to copy (1-based).
dest Destination buffer.
Retur n Values
Success: 0: Number of characters in destination buffer; zero if no characters were
copied.
Failure: -1: Start offset was beyond the data string length or the offset was negative.
NOTE
This function does not perform error checking. The destination buffer must be
large enough to contain the field data to copy and a null character.
Example The linked example code file demonstrates use of f i el df i x( ) . Also see the
EXFIELD.C example program.
F UNCTION C A L L S
fi el dray ()
fieldray()
Copies a data string from a source buffer to a destination buffer. It starts at a fixed
offset specified in s t a r t and copies up to a stop character specified in stop, or
the end of the buffer. If the end of the buffer is reached before copying all the
characters indicated by the delimiter, a partial copy is performed.
The function returns the actual number of characters being copied or an error
code (-1). If the return value is -1 or zero, a null character is returned to the
destination buffer. Otherwise, a null character is appended to the data in the
destination buffer.
Parameters
buf Source buffer.
start Starting offset (0-based).
stop Stop character at which copying terminates (this character is not copied
to the destination buffer).
dest Destination buffer.
Return Values
Success: 0: Number of characters being copied.
Failure: -1: Start offset was beyond or before the data string length.
NOTE
This function does not perform error checking. The destination buffer must be
large enough to accommodate the data.
F UNCTION C A LL S
fi el dv ar()
fieldvar()
Copies nth variable data field separated by a field delimiter. The first variable data
field starts at the beginning of the source buffer and ends at the first encountered
delimiter. If the end of the buffer is reached before copying all the characters
indicated by the delimiter, a partial copy is performed.
The function returns the actual number of characters copied or an error code (-1).
If the return value is minus one or zero, a null character is returned in the
destination buffer. Otherwise, a null character is appended to the end of the
destination buffer.
Parameters
buf Buffer with message to scroll.
f l dnum Field number to copy (1-based).
sep Field separator.
dest Destination buffer.
i nc Scroll increments.
val i d_keys Valid key map (Refer Table 15 for valid keys)
Retur n Values
Success: 0: Number of characters being copied; zero if no characters were copied.
NOTE
This function does not perform error checking. The destination buffer must be
large enough to contain the field data to copy, plus one null character.
NOTE
When the parameter ending with a delimiter is passed to fieldvar() API, it assumes
that there is another variable present and returns zero.
F UNCTION C A L L S
set_chars_per_key_value()
set_chars_per_key_value()
Gets the number of characters per key map from the user and sets the new value
in the library.
User needs to call this API if the default characters per key (Five) provided by
library does not suit their requirement. User needs to call this API before calling
getkbd_entry(), key_card_entry(), and SVC_KEY_TXT().
Once this API is called, the new value is retained for the life of the application. If
the user wants to change to a different value or default value, this API needs to be
called with a new value.
If the user calls this API with a value 7, the key map buffer should be as shown
below:
char sz KeyMap[ MAX_ALPNUM_KEYS] [ 7] ={"0- +%_" , " 1QZ. \ / " , " 2ABC&a" ,
" 3DEF%d", " 4GHI *g" , " 5J KL/ j " , " 6MNO~m" , " 7PRS^p", " 8TUV[ t " , " 9WXY] w" ,
" * , ' \ " : " , " #=: $? ! " };
Users can define their own characters set in each array element. If the value for
character per key is set to 7, an array char
szKeyMap[ MAX_ALPNUM_KEYS] [ 7] has to be defined. Only 6 chars can be
provided and one char is used for NULL.
It is the responsibility of the application to provide the array szKeyMap[][CHAR
PER KEY] passed to the Verix eVo ACT library functions. The value of CHAR
PER KEY can be modified, but the array should be in accordance with the
modified value of CHAR PER KEY. If the value and the array size mismatches,
then the results are unpredictable.
NOTE
set _char s_per _key_val ue( ) function allows the user to set any positive
value. It gets set to default value (6), when 0 or any negative value is given.
Parameters
short shCharPerKey Application-defined number of chars per key
F UNCTION C A LL S
getkbd_entry()
getkbd_entry()
Provides display and keyboard entry functions for a variety of input applications.
This function combines the display, delay, key detection, data input, and data
validation routines.
Parameters
h_cl ock Clock device handle.
msg Message to display.
out buf Where to hold the return data.
wai t Wait time, in 10-ms increments.
t ype Type of data entry desired, valid values are:
• NUMERI C
• ALPHANUM
• NUMERI C| PASSWORD
• ALPHANUM| PASSWORD
• AMOUNT
• KEYMAP l ong va_al i st
Variable arguments that depend on t ype:
• If t ype is NUMERI C, ALPHANUM, NUMERI C| PASSWORD or
ALPHANUM_PASSWORD:
getkbd_ent r y(h_cl ock, msg, out _buf , wai t , t ype, char
SzKeyMap[ ] [ CHAR_PER_KEY] , i nt KeyMapSi ze, i nt max, i nt
mi n) ,
i nt max maxi mum number of di gi t s ( max= 9)
i nt mi n mi ni mum number of di gi t s ( mi n=0)
• If t ype is KEYMAP:
get kbd_ent r y( h_cl ock, msg, out _buf , wai t , t ype,
SzKeyMap, KeyMapSi ze, er r _wai t , er r _msg, keys)
i nt er r _ wai t = length of time to display er r _msg, in half-
second increments.
char *er r _msg = error message displayed for invalid entries
long keys bitmap of the keys that can be entered.
• If t ype is AMOUNT:
get kbd_ent r y( h_cl ock, msg, out _buf , wai t , t ype,
sz KeyMap[ ] [ CHAR_PER_KEY] , KeyMapSi ze, f r ac, max, mi n)
l ong max = maximum value allowed.
l ong mi n = minimum value allowed.
i nt f r ac =number of decimal places desired.
F UNCTION C A L L S
getkbd_entry()
sz KeyMap [ ] Key map specifying the mapping of the logical alphanumeric keys
{CHAR_PER_KEY] to the physical keys on the keypad.
char szKeyMap[ MAX_ALPNUM_KEYS] [ CHAR_PER_KEY] =
{" 0- +%" , " 1QZ. \ \ " , "2ABC&", " 3DEF%" , " 4GHI *" ,
"5J KL/ ", "6MNO~", "7PRS^", "8TUV[ ", "9WXY] ", "* , ' \ ": ",
" #=: $?" };
For Vx680 terminal, the key map specifying the mapping of the
logical alphanumeric keys to the physical keys on the keypad is:
char szKeyMap[ MAX_ALPNUM_KEYS] [ CHAR_PER_KEY_VX680] =
{"0- +%" , " 1QZqz. \ \ " , " 2ABCabc&" , " 3DEFdef %" ,
" 4GHI ghi *" ,
" 5J KLj kl / " , " 6MNOmno~", " 7PRSpr s^" , " 8TUVt uv[ " ,
"9WXYwxy] ", "*, ' \ ": ",
" #=: $?" }
By default, in the Verix eVo ACT library, CHAR_PER_KEY is
defined as 6 and for V x680 terminals, the
CHAR_PER_KEY_VX680 is defined as 8. Hence the application
can have five chars per key in the key-mapping array. User can
modify this value by calling set_chars_per_key_value(). Based on
the value set by the user, the szKeyMap array should be passed to
the library APIs. There is no validation done on the array size by
the library.
KeyMapSi ze Size of the specified key map.
va_ al i s t One or more null-terminated strings to concatenate. The argument
list is null-terminated (defined in STDIO.H).
Retur n Values
Success: > 0: Length of string stored in out _ buf .
Failure: 0: Time out occurred.
-1: Device read error.
-2: Parameter out of range.
-3: clear key pressed (not provided for mapped entry type).
-4: Invalid entry type specified.
-5: User pressed enter key when null data entry is permitted.
NOTE All five input parameters are required. No parameter can be omitted from any call.
The prompt can be suppressed by supplying a null message parameter.
get kbd_ent r y( ) will wait for the data entry without updating the display.
F UNCTION C A LL S
getkbd_entry()
ends and returns zero. If the data entry fails, the content of the output buffer is
unchanged. If an out-of-range amount is entered, getkbd_entry() beeps and an
invalid value remains displayed. The user can edit the entry using the backspace
key. All data is returned as a null-terminated string.
NOTE
If the value of outbuf is F1-F4 or ALPHA key, a blank pixel is displayed when
printed on the screen.
Data entry can be divided into three categories: standard entry, mapped key entry,
and amount entry. The data entry category is specified by the t ype parameter
and determines the syntax of the getkbd_entry() call. #def i nes for the type
options are supplied in ACLCONI O. H.
The cell phone mode is specific to Vx680 terminals. This feature enables the user
to key in the alpha numeric text without using the alpha keys, which are
traditionally used in other terminals. Each key has the corresponding key value
and alphabets. The user can click once to display the numeric value and click
twice, thrice and four times to display capital letter of the respective keys. Fifth,
sixth and seventh click displays those respective keys in small letters. The ninth
click will display the special character. Refer to the get kbd_ent r y( ) API for
more details on key mapping.
F UNCTION C A L L S
getkbd_entry()
The time out value for displaying the character simultaneously is set by
#KEY_TI MER environmental variable. If the value of the environmental variable is
greater than 20, then the variable value is set as 20. If the value of the
environmental variable is less than 0, then 2 is set as the default value.
NOTE
Cell phone mode for keying in characters is supported only in Vx680 terminal.
Mapped key entry accepts a bitmapped long integer indicating the valid keys for
the entry. This is useful to prompt the user with a display and restricting input to a
limited number of keystrokes, such as Y/N entries.
The key map is created by ORing the values of the valid keys. #def i nes are
provided in ACLCONIO.H for all standard Verix eVo terminal keys, as well as the
screen-addressable keys.
Mapped key entry returns after the time out specified expires or a key contained in
the key map is entered. A single key is accepted and its null-terminated value is
placed in the output buffer.
Mapped key entry also accepts an error message and error display time. If an
error message is supplied, a prompt message should also be provided. The error
message is displayed for the specified number of half seconds after any invalid
keypress. If data entry starts while the error message is displayed, the routine
immediately reads and processes the new input. If no entry occurs during the
error message display, the prompt message redisplays. This display restarts the
time out, providing another timed entry period. The error message can also
provide a secondary prompt, such as:
Pr ompt Msg = ABORT TRANS?
Er r or Msg = 9= YES OR 6= NO
The following table lists the defines for the individual key definitions.
Table 15 Key Definitions
Key Define
[0] KM_0
[1] KM_1
[2] KM_2
[3] KM_3
[4] KM_4
[5] KM_5
[6] KM_6
[7] KM_7
[8] KM_8
[9] KM_9
F UNCTION C A LL S
getkbd_entry()
F UNCTION C A L L S
getkbd_entry()
The f r a c parameter allows the user to specify the number of decimal places
included in formatting the input. max and mi n parameters must provide enough
digits to permit the use of a specified number of decimal places. This is useful in
international monetary environments and in applications using tax tables, gasoline
prices, and so on.
When specifying negative max or mi n parameters, it is not possible to specify a
negative value between 0 and -1. This is due to the inability to preserve leading
zeros.
Formatting the amount on the display can be controlled by ORing any of the
following values with the AMOUNT in the t ype parameter:
• RDXPSEPN radix decimal point and no separator: 1000000.00
• RDXPSEPC radix decimal point and comma separator: 1,000,000.00
• RDXCSEPN radix comma no separator: 1000000,00
• RDXCSEPP radix comma and decimal point separator: 1.000.000,00
If a format is not specified in the t ype, RDXSEPN is the default.
Example get kbd_ent r y( h_cl ock, msg, out put , 100, AMOUNT| RDXPSEPC,
sz KeyMap[ ] [ CHAR_PER_KEY] , KeyMapSi ze, 2, 100000L, 100L) ;
Displays msg for up to one second using the amount input, a decimal point as
radix, and a comma separator using two decimal places with 1,000.00, as the
maximum value, and 1.00 as the minimum value.
szKeyMap [ ] {CHAR_PER_KEY] The key map specifying the mapping of the logical
alphanumeric keys to the physical keys on the
keypad.
Example char s zKeyMap[ MAX_ALPNUM_KEYS] [ CHAR_PER_KEY] = {"0- +%" , " 1QZ. \ \ " ,
" 2ABC&" , " 3DEF%" , " 4GHI *" , " 5J KL/ " , " 6MNO~" , " 7PRS^" , " 8TUV[ " , " 9WXY] " ,
" * , ' \ " : " , " #=: $? " };
KeyMapSi ze Size of the specified key map.
NOTE Only limited parameter verification is performed. If the wait parameter is zero, no
time-out value is used. For AMOUNT type entry, max cannot be less than min and
frac cannot be larger than the number of characters required to represent the
larger of max or min. For AMOUNT type, values between zero and minus one
cannot be specified, such as, 001 with a fractional value of 2.
A user entering mapped t ype data with a map passed with no bits set “on” (1), is
unable to register any keypress. The routine continues to loop each time a user
presses a key, and returns when the time out expires.
F UNCTION C A LL S
getxy()
For mapped key entry, if an error message is specified but the error time
parameter is zero, the message displays briefly and is then overwritten by the
prompt (if provided).
Example The linked example code file demonstrates use of getkbd_entry(). Also see the
EXTRANS.C example program.
getxy()
Returns the x and y coordinate values of the cursor relative to the current window.
The upper-left corner of the window is position 1,1. The x and y values provided
by this function can be used in a got oxy( ) call to correctly position the cursor
within a window. This function differs from wher ecur ( ) , which returns the
physical position of the cursor. For example, if a window is defined using the
coordinates 3,1, 10,1 and the cursor is in the “home” position, getxy() returns 1,1,
and wher ecur ( ) returns 3,1.
Parameters
x x coordinate.
y y coordinate.
Retur n Values
Success: 0: Success.
Failure: -1: The current cursor position is outside the boundaries of the current
window.
F UNCTION C A L L S
insert_char()
insert_char()
Parameters
s t r i ng Buffer containing the string.
pos Position to insert character.
c Character to insert.
Return Values
Success: > 0: Length of the modified string.
Failure: -1: Position was larger than string length, or position was negative or buffer
is NULL.
NOTE
Bounds checking are not performed. The calling routine must ensure space is
available for the inserted character(s).
insert_decimal()
Inserts a decimal point at the third character from the right in a dollar amount
string. The string is left padded with zeros if the length is less than three (for
example, 1 is converted to 0.01).
Parameters
buf Buffer to store the string to convert. String buffer must be large enough to hold
result.
Return Values
Success: 0: Length of the converted string (positive number).
Failure: -1: If the input buffer is null, the first character is not “-” or a numeric, or if
any character is not numeric.
F UNCTION C A LL S
int2str()
int2str()
Parameters
dest Output buffer. The destination buffer must be large enough to hold the resulting
characters and the null terminator (destination buffer plus two bytes).
val Value to convert.
NOTE
Overflow is undefined.
F UNCTION C A L L S
ju li an _dat e( )
julian _d at e()
Converts a specified date to a Julian calendar value. The Julian date is the day
number with reference to January 1 of the specified year. This is useful in
determining the number of days between one date entry and another. The macro
LEAP_YR() determines if the specified year is a leap year.
Parameters
year Year number to convert.
mont h Month number to convert.
day Day number to convert.
Return Values
Success: > 0: Julian date for the specified month, day and year.
KBHIT()
Uses kbd_pendi ng_c ount ( ) to determine the number of unprocessed key
entries in the keyboard buffer. Key data is not read from the keyboard buffer. This
function is implemented as a macro.
Retur n Values
Success: > 0: Number of keys in
buffer.
F UNCTION C A LL S
key_card_entry()
key_card_entry()
Accepts the card-type data from either the keyboard or card reader. The following
are conditions that must be met before calling key_car d_ent r y( ) :
• The message file must be open.
• Limited parameter verification is performed.
• The input buffer must be large enough to hold the data.
Parameters
h_cl ock Clock handle.
h_car d Card reader handle.
dat a Buffer for entered data.
t ype Numeric or alphanumeric.
wai t Number of increments (10-ms increments).
max Maximum keyboard entry allowed.
mi n Minimum keyboard entry allowed.
buf f er Retrieved message or message to display.
message_ num Message number to display or 0 if there is a message in the buffer.
sz KeyMap [ ] The key map specifying the mapping of the logical alphanumeric
[ CHAR_PER_KEY] keys to the physical keys on the keypad. For example:
sz KeyMap[ MAX_ALPNUM_KEYS] [ CHAR_PER_KEY] = {"0- +%" , " 1QZ. \ \ " , " 2ABC&" ,
" 3DEF%" , " 4GHI *" , " 5J KL/ " , " 6MNO~" , " 7PRS^" , " 8TUV[ " , " 9WXY] " ,
" * , ' \ " : " , " #=: $? " };
By default, in Verix eVo ACT library, CHAR_PER_KEY is defined as 6. Hence the
application can have five chars per key in the key-mapping array. User can modify this
value by calling set_chars_per_key_value(). Based on the value set by the user, the
szKeyMap array should be passed to the library APIs. There is no validation done on
the array size by the library.
KeyMapSi ze Size of the key map specified.
F UNCTION C A L L S
key_card_entry()
Retur n Values
Success: Positive: Source of entry as indicated:
• 0x31 = keyboard
• 0x32 = swipe
Input is in the data buffer. If swiped, full track data returns. If manual entry,
the user entry returns null-terminated. max and mi n parameters are not
verified. For more details on MSR data format refer to the r ead( ) API,
under Magnetic Card Reader section in Verix eVo OS Programmers
Manual.
F UNCTION C A LL S
keyin_amt_range()
keyin_amt_range()
Uses the decimal point as the radix, a comma separator, with an 1,000.00
maximum value and 1.00 minimum value, and uses two decimal places. The
formatting selection applies to the data in the buffer after data entry. The user only
sees the radix during data entry not the separator.
If a zero value is selected for the f r a c parameter, the radix is still displayed, but
with no trailing characters.
F UNCTION C A L L S
keyin_amt_range()
keyi n_amt _r ange( ) requires the user to press at least one numeric key and
never returns a null string in out _buf .
NOTE Only limited parameter verification is performed. max cannot be less than min,
and frac cannot be larger than the number of characters required to represent the
larger of max or min. Values between zero and minus one cannot be specified,
such as, 001 with a fractional value of 2.
Parameters
out _buf Buffer to store the return data.
amt _f mt Formatting specifier.
max Maximum amount value allowed.
mi n Minimum amount value allowed.
frac Decimal places allowed.
Return Values
Success: > 0: The length of the result buffer, including format characters.
Example The linked example code file demonstrates use of keyin_amt_range(). See also
the EXTRANS.C example program.
F UNCTION C A LL S
keyin_mapped()
keyin_mapped()
Accepts a bitmapped long integer indicating valid keys for data entry. This is
useful when prompting the user with a display and restricting input to a limited
number of keystrokes, for example, Y/N entries. The key map is created by ORing
the values of all the allowed keys. #def i nes are provided in ACLCONIO.H for all
standard Verix eVo keys, as well as the screen-addressable keys.
Parameters
key_ map Keys allowed for entry.
Retur n Values
Success: > 0: Key code value of valid key entered.
This routine returns after each keypress, allowing the caller to take appropriate
error processing actions as required by the application.
Example The linked example code file demonstrates use of keyi n_mapped( ) .
F UNCTION C A L L S
LE AP_YR()
LEAP_YR()
Determines if the specified year is a leap year. A leap year is defined as:
"Years evenly divisible by four but not evenly divisible by 100, or years evenly
divisible by 400."
Parameters
year Year to check.
Return Values
Success: 1: Leap year.
F UNCTION C A LL S
load_bmp()
load_bmp()
Assists in building the ISO 8583 message packets (required in PIP applications)
by loading a bitmap, message ID, and processing code from a formatted file. The
file must be created using the TXOFILE utility (see TXOFILE Utility). Table 16 lists
the record, transaction code, transaction bitmap defines, message IDs, and
processing codes.
Each line in the bitmap file is a VLR record.
h_f i l e must be the handle to an open and properly formatted VLR file.
ISO 8583 hosts normally require bitmaps to be 8 bytes in length. The message ID
and processing code are packed BCD values (where, “0200” converts to 0x02
0x00).
Table 16 Codes
Code Definition
Record
00–03 = Bitmap index, message ID index, and processing code index.
04–06 = ISO 8583 bitmaps.
07–08 = ISO message IDs.
09–12 = ISO processing codes.
Tran Codes
00 Tran Code 0 = “04,07,09” authorization only.
01 Tran Code 1 = “05,08,09” sale/void.
02 Tran Code 2 = “06,08,09” force online.
03 Tran Code 3 = “06,08,11” refund.
Transaction Bitmap Defines
04 Bitmap 1 = “\x30\x20\x05\x80\x00\xc0\x00\x00” authorization only.
05 Bitmap 2 = “\x30\x20\x05\x80\x00\xc0\x00\x00” sale.
06 Bitmap 3 = “\x30\x38\x05\x80\x00\xc0\x00\x00” refund/force online.
Message IDs
07 Message Id 1 = “\x01\x00” authorization only.
08 Message Id 2 = “\x02\x00” financial transaction.
Processing Codes
09 Proc Code 1 = “\x00\x40\x00” sale, offline sale, authorization.
10 Proc Code 2 = “\x02\x40\x00” void DB, DB adjust.
11 Proc Code 3 = “\x20\x40\x00” refund, offline refund.
F UNCTION C A L L S
load_bmp()
Parameters
h_f i l e Bitmap file handle.
t r an_code Transaction code. This is the index to the record that contains the
record numbers for the bitmap, message ID, and processing code.
b_ map Pointer to the bitmap buffer.
msg_i d Pointer to the message ID buffer.
p_code Pointer to the processing code buffer.
Return Values
Success: 0
F UNCTION C A LL S
long2str()
long2str()
Converts a signed long integer to a string. If the long value is negative, a minus
sign is placed at the beginning of the string. The function converts 2147483647 as
the largest possible positive integer before it goes negative (four bytes). For
example, the large positive integer 21234567890 is converted to a corresponding
negative string as -2103731502. The large negative integer 11234567890 is
converted to a corresponding string as 1650333998.
Parameters
dest Destination buffer address.
val Long integer to convert.
NOTE
No error checking is performed. This function assumes a long val of four bytes.
The value 0x80000000 is forced to -2147483648.
F UNCTION C A L L S
MA X()
MAX()
Returns the greater of two values. This function is implemented as a macro, and
as such, the data types of val1 and val2 are determined by the caller. The caller
must ensure that val1 and val2 are compatible data types. The macro expands to:
( ( ( v al 1) > ( val 2) ) ? ( v al 1) : ( val 2) )
Parameters
val 1 First value to compare.
val 2 Second value to compare.
Return Values
Success: The larger of the two values.
F UNCTION C A LL S
MEMCLR()
MEMCLR()
Parameters
buf Area to clear.
s i ze Size of the buffer.
Example The linked example code file demonstrates use of MEMCLR(). See also the
EXTRANS.C example program.
F UNCTION C A L L S
msg_display_at()
msg_display_at()
Retrieves the specified message from the message file, repositions the cursor by
column and line number prior to displaying the string, and optionally clears the
display. The following are conditions that must be met before calling
msg_display_at():
• The message file must be open.
• The buffer must be large enough to hold the retrieved message.
• Column and line values are not verified to ensure they are appropriate for the
terminal.
Parameters
col umn The column to display at.
l i ne The line to display on.
message_ num The message number to display.
Return Values
Success: Positive: The number of characters actually written to the display. This is
the value returned from wr i t e( ) .
Failure: Negative: -1 on error; -2 message file not open or message not found
F UNCTION C A LL S
msg_display_new()
msg_display_new()
Retrieves the specified message from the message file, repositions the cursor by
column and line number prior to displaying the string, and optionally clears the
display. The following are conditions that must be met before calling
msg_display_new():
• The message file must be open.
• The buffer must be large enough to hold the retrieved message.
• Uses msg_di spl ay_at ( ) .
msg_display_new() is prototyped in message.h
Parameters
message_ num The message number to display.
Retur n Values
Success: Positive: The number of characters actually written to the display. This is
the value returned from wr i t e( ) .
F UNCTION C A L L S
MI N()
MIN()
Returns the lesser of two values. This function is implemented as a macro and, as
such, the data types of val1 and val2 are determined by the caller. The caller must
ensure that val1 and val2 are compatible data types. The macro expands to:
( ( ( v al 1) < ( val 2) ) ? ( v al 1) : ( val 2) )
Parameters
val 1 First value to compare.
val 2 Second value to compare.
F UNCTION C A LL S
month_end()
month_end()
Returns the number of days in the month for the specified year. Use the macro
LEAP_YR() to determine if the specified year is a leap year.
Parameters
mont h Requested month.
year Requested year.
Retur n Values
Success: The number of days in the month for the indicated year.
mult_strcat()
NOTE
The destination buffer must be large enough to hold the result.
Parameters
out buf Pointer to the destination buffer storing the concatenated string.
va_ al i s t One or more null-terminated strings to concatenate. The argument list is
null-terminated (defined in STDIO.H).
Retur n Values
Success: Number of characters stored in the destination buffer.
0: No strings concatenated.
F UNCTION C A L L S
NO RM_BEEP()
NORM_BEEP()
Activates the beep feature of the system. This produces a beep higher in tone
than an error beep.
This function is implemented as a macro; it returns before completion of the beep.
Dependencies normal_tone()
ntocs()
NOTE A counted string cannot contain more than 254 characters. This restriction is
required since, the count must be the first byte of the string and the maximum
value for a single byte is 255. The count byte is included in the count. The
destination buffer must be at least as long as the source buffer.
Parameters
dest _buf Address to store counted string.
sr c_buf Null-terminated string address.
Return Values
Success: String converted.
F UNCTION C A LL S
p_ set_ ba ud fo rmat ()
p_set_baudformat()
Initializes the specified communications port for printing at a specified baud rate
and data format. Accepts a device handle to the printer port, the baud rate, and
the data format as parameters. Printer characteristics automatically initialized
include: character mode, auto-enable, flow control, and RTS assertion. The
following are conditions that must be met before calling p_set_baudformat:
• The caller must open( ) the communications port.
• Valid baud rates are: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600
and 115200.
Parameters
h_comm_por t Handle for printer port.
baud_r at e Baud rate.
dat a_f or mat Data format.
Retur n Values
Success: 0
Failure: -1 on error.
F UNCTION C A L L S
pa d( )
pad()
NOTE The caller must ensure that the destination buffer is the greatest of the two pad
length or source buffer. No bounds checking is performed. Passing null as the
pad_char parameter results in the destination buffer being filled with pad_size null
characters. The previous contents of the destination buffer are destroyed.
Parameters
pdest _buf Stores the padded string.
psr c_buf Source string to pad.
pad_char Pad with this character.
pad_si ze Size of the padded string.
al i gn Indicates the position of the source data in the destination string. Valid
values are:
Align at: Effect #define (ACLSTR.H)
• 0x00 Source at the beginning LEFT or LEFTJUSTIFY
• 0x80 Source at the end RIGHT or RIGHTJUSTIFY
• 0x88 Source centered CENTER or
CENTERJUSTIFY
• other value Source at the beginning
Return Values
Success: > 0: The number of characters added to the source string to produce the
destination string.
Failure: 0: The source length was greater than or equal to the pad length, or the pad
length was negative.
F UNCTION C A LL S
pa use()
pause()
Parameters
t i me Number of 10-ms intervals to pause.
Retur n Values
Success: 0: Pause interval successfully expired.
F UNCTION C A L L S
pro mp t()
prompt()
Parameters
h_ c l k Handle to clock.
di s pl ay_ s t r i ng String to display.
wai t Wait time in 10-ms increments.
opt Clear display option. The clear options, defined in ACLCONIO.H,
determine how the display clears before writing the prompt message.
Valid clear options are:
• CLR_LINE: Completely clears the current line, but does not change
the cursor position.
• CLR_EOL: Clears from the end of message to the end of the line.
• NO_CLEAR: Writes to the display without clearing.
Return Values
Success: 0: Time expired without a keypress.
F UNCTION C A LL S
pro mp t_at ()
prompt_at()
Displays a null-terminated string at the specified column and line for a specified
duration or until a key is pressed, whichever occurs first. The key pressed remains
in the keyboard buffer and can be read on return from pr ompt _at ( ) .
The opt parameter determines how the display is cleared before writing the msg
string to the display. The wai t parameter specifies the number of 10-ms
increments to display the prompt message.
Parameters
h_cl ock Clock handle.
col Display column location.
lin Display line location.
msg Message to display.
wai t Display time in 10-ms increments.
opt Clear display option. The clear options, defined in ACLCONIO.H, determine
how the display will clear before writing the prompt message. Valid clear
options are:
• CLR_LINE: Completely clears the line specified.
• CLR_EOL: Clears from the end of message to the end of the line.
• NO_CLEAR: Writes to the display without clearing.
Retur n Values
Success: 0: Time expired without a keypress.
Example See also the EXTRANS.C example program. The linked example code file
demonstrates use of prompt_at().
F UNCTION C A L L S
pu rge _c ha r()
purge_char()
NOTE
This function does not purge null characters.
Parameters
buf f er Buffer to remove character from.
r em_char Character to remove.
Return Values
Success: Number of characters deleted from the target string.
F UNCTION C A LL S
range()
range()
Each record of the file has a minimum and maximum range field, and associated
range data, separated with blanks. The maximum length of each cannot exceed
20 characters.
r ange( ) provides access into the range table. The programmer specifies a value
to be ranged or compared. The range function accesses the range table and
compares the minimum and maximum range fields in search of a matching
record. Should the value fall within the minimum and maximum ranges, the
associated range data is stored and the record in which the match is found
returns.
NOTE The file consists of CVLRs. Compression is intended to operate on a subset of the
ASCII character set. All numeric characters (range 30h–39h) are stored using only
four bits. All supported non-numeric characters (ranges 00h–02Fh and 3Ah–5Fh)
are stored using eight bits (that is, without compression). All other characters
(range 60h–FFh) are stored in eight bits and corrupted. Ensure that such data is
not included in the file records.
Parameters
r ange_dat a Range parameters defining the table and search criteria.
Retur n Values
Success: 0: The label length is greater than 4 or less than 1, or the start record is
greater than 99 or less than 1.
Failure: -1: Last record accessed at the time in which processing is complete and a
match has not been found— this is the equivalent of one greater than the last
record number of the file if the entire file is searched.
F UNCTION C A L L S
range()
RANGE_PARMS Structure
All input parameters are passed in a structure of type RANGE_ PARMS, as defined
in ACLSTR. H.
t ypedef st r uct
{
char *acc t _num;
/ * ’ r ange’ or ’ account number ’ sear chi ng f or */
char *l abel ;
/ * Tabl e r ecor d l abel i dent i f i er ; Maxi mum of 4 char acters. Thi s st r i ng i s
concat enat ed wi t h the of f set r ecord number t o a uni que recor d i dent i f i er
i nt o t he t abl e ( l abel _ ent r y_ i d) . * /
char *dat a_f l d;
/ * Pl ace i n whi ch t o st ore f ound r ange data. Passed as nul l i f no data i s
t o be stored. */
i nt s t ar t ;
/ * Of f set r ecor d number i n whi ch t o begi n r ange search. Thi s i nt eger i s
concat enat ed wi t h t he l abel t o cr eat e a uni que recor d i dent i f i er i nt o the
t abl e ( l abel _ ent r y _ i d) . * /
char *f i l e_name;
/ * Fi l e i n whi ch t he r ange t abl e exi st s. */
} RANGE_ PARMS;
F UNCTION C A LL S
range_vlr()
range_vlr()
Searches a VLR file for a record that bounds the given account number.
range_vlr() operates on the specified file passed as an input parameter. This
parameter is assumed to be a VLR file, and each record consists of data as
follows:
NOTE
r ange_vl r ( ) does not perform error checking and the lengths of the range
numbers in the records become the lengths of the comparison.
<mi ni mum r ange_f l d><SPACE><maxi mum r ange_f l d><SPACE><r ange dat a>
Parameters
acct Range or account number being searching for.
start Offset record number at which to begin the range search.
dat a Buffer to store found range data. This is passed as null if there is no data
to store.
f i l e_name File where the range table exists.
Retur n Values
Success: 0: Range not found.
> 0: The positive value of the record accessed in which a range match was
found.
F UNCTION C A L L S
scroll_buffer()
scroll_buffer()
Displays a message in the current display window allowing the user to scroll
through the message using application-defined keys. Scrolling occurs at
increments specified by the calling function.
The initial display position of the message is specified in the s cr ol l _ of f s et
parameter. The amount of text to scroll is specified in the i nc parameter.
Use the calling routine to specify the key(s) to terminate the display. One of these
keys can be specified as a special exit key.
#def i nes for constructing the key map are included in ACLCONIO.H. To accept
one or more keys to terminate the display, OR the desired key values together. If
the exit key is selected, set key_buf [ 0] .
NOTE
If the value of key_buf is F1-F4 or ALPHA key, a blank pixel is displayed when
printed on the screen.
Parameters
buf Buffer with message to scroll.
i nc Scroll increments.
val i d_keys Valid key map. (Refer Table 15 for valid keys.)
s cr ol l _ of f s et Initial display position in scroll increments (1 based).
scr ol l _ l ef t Scroll left key.
s cr ol l _ r i ght Scroll right key.
exi t _key Exit key.
key_buf Buffer to hold key used to terminate the display.
Return Values
Success: Message position, based on i nc, when the user terminated the display.
F UNCTION C A LL S
set_itimeout()
set_itimeout()
Sets an interval timer based on the 1/64-second system tick clock. Used in
conjunction with CHK_TIMEOUT(). The time values are approximate.
Rollover is not processed by this routine. The system tick count is reset each time
the system powers up or on exit from system mode. This results in a rollover after
more than two years of continuous operation.
Parameters
h_cl ock Clock device handle.
t i me Number intervals for time out.
gr adi ent Timeout units.
Retur n Values
Success: > 0: Current system tick value + (time *interval), where, interval is
TM_TICKS, TM_SECONDS, or TM_MINUTES, as defined in ACLDEV.H.
Example See also the EXTMOUT.C programming example. The linked example code file
demonstrates use of set_itimeout().
F UNCTION C A L L S
sgetf()
sgetf()
Parameters
ss Pointer input string.
cs Pointer control string. The control string can contain format directives or literals
as follows:
Flags Flags act as modifiers to the format directive and control how the
data is extracted. All flags are optional.
• *: Overrides storage assignment of this value. Without the “ * ”
option, data extracted from the input string is stored in the
corresponding address parameter. If the “ * ” is included in the
control string, data extracted from the input string is not stored in
an address in the parameter list.
• $: Applies only to integer and long conversions. This flag causes
the parser to ignore a single instance of “ . ” or “ , ” in the input
string. Example: If the input string is “65.11” and the control
string is “%$i”, then 6511 is stored.
Width Numeric value that specifies the maximum field width to extract.
This can be used in conjunction with the i, l, b, c, s types. Note that
if zero is specified as the maximum field width, at least one
character of the input string is extracted.
F UNCTION C A LL S
sgetf()
Type This mandatory field specifies what kind of data is expected in the
input string and how it should be assigned. Supported values are:
• i = Decimal integer: Parsing begins at the first character of the
input string and ends on the first non-numeric. Exception: the “$”
flag allows a single radix (“.” or “,”) to be included in the numeric
string.
• l = Decimal long integer: Parsing begins at the first character of
input string and ends on the first non-numeric. Exception: the “$”
flag allows inclusion of a single radix (“.” or “,”) in the numeric
string.
• c = Character: Parsing begins at the first character in the input
string. Example: If the input string is “987”, then “ ” is stored.
• s = String: Parsing begins at the first non-space character of the
input string and ends at the first space or null character.
Example: If the input string is “987”, then “987” is stored as a
string (null-terminated).
• [ ] = String: Characters specified between brackets in the control
string describe the set of characters in the input string to be
assigned as a string (null-terminated). The first character found
in the data string that is not part of the bracketed set terminates
the string. This option differs from the s option in that the string
parsing is not terminated by a space.
• [1–9] A range of characters can be specified within the brackets
by putting a hyphen (“-”) character between the lower and upper
limits. (The first character must have a lower ASCII value than
the second.)
• [^]: Alternatively, bracketed characters can be used as a set of
exclusion characters to terminate the string. This is specified by
placing a carat (“^”) in the first position following the open
bracket. All characters are copied from the input string to the
assigned string-up until the point at which one of these exclusion
characters or null terminator is encountered.
Examples • If the input string is “123AB45,” then the control string “%[1-8]”
extracts the string “123”. Parsing terminates at the character “A”.
• If the input string is “123AB45,” then the control string “%[A-Z]”
extracts the string “AB”.
• If the input string is “<STX>12AB78<ETX> <LRC>,” then the
control string “%\002%[^\003]” assigns “12AB78” to a string.
ar gs Variable number of pointers to results of format conversion.
F UNCTION C A L L S
sgetf()
Retur n Values
Success: Pointer to the last character parsed in the input string. The return value can
be used as the input string pointer for a subsequent call.
NOTE errno is initialized to zero at beginning of routine and set to EINVAL if:
• a syntax error occurs
• input the string does not match control string, or
• the end of the input string is reached and is not finished parsing the control string.
F UNCTION C A LL S
SLEEP()
SLEEP()
Parameters
t i me Sleep time in 10-ms increments.
F UNCTION C A L L S
sputf()
sputf()
NOTE s put f ( ) is not bound by an internally allocated buffer. The only string size
limitation is that the result buffer must be large enough to accommodate all
expanded format characters.
= Center justify flag can be used in addition to left justify. For example,
sput f ( r esul t , "%=10s", "hel l o") ; accomplishes the following:
r es ul t : " hel l o "
+ Sign flag. This flag immediately follows the justification flag (-, =), and proceeds
- the minimum field width indicator. The + flag causes the output to contain a + if
the input value is positive and a - if the input value is negative.
Examples:
l ong l = 1234567L;
sput f ( buf f , "%- +10. 2l $$0i ", ( char *) &l ) ; or
sput f ( buf f , "%=+10. 2l $$0i ", ( char *) &l ) ;
r esul t : $+1234. 56
change l ong l = - 1234567L;
sput f ( r esul t , "%- +10. 2l $$0i ", ( char *) &l ) ; or
sput f ( buf f , "%=+10. 2l $$0i ", ( char *) &l ) ;
r esul t : $- 1234. 56
F UNCTION C A LL S
sputf()
$[$] n Dollar formatting. The position of the $ flag within the control string is important.
Dollar formatting must immediately proceed the i, u, c, or s directive. * can be
used in place of the n format value; the next parameter in the input list is then
used as the n format value, as follows:
n Format Values
Parameters
r e sul t _ s t or e Control string specifying formatting to occur.
next _cs Variable length list of pointers to control string.
ar gs Parameters and input data.
Retur n Values
Success: The length of the result buffer.
Dependencies Verix eVo SDK, STDIO.H, CTYPE.H, ACL: pad(), ctons1(), long2str(),
insert_char(), int2str(), f_dollar()
F UNCTION C A L L S
strn2int()
strn2int()
Parameters
buf f er Data to convert to an integer value; maximum 40 characters.
cnt Number of bytes to convert.
Return Values Equivalent integer value of the string. If cnt is greater than 40 or less than 0,
s t r n2i nt ( ) returns 0.
F UNCTION C A LL S
str2digit()
str2digit()
Accepts a string and purges all characters that are not digits. If a minus sign (“-”) is
found in the first character position of the string, it is retained in the resulting
string.
NOTE
The original string passed is destroyed; all non-digit characters are purged.
Parameters
sour ce Pointer to null-terminated string to process.
Retur n Values
Success: Number of digit characters in the converted string not including the optional
“-” sign flag.
F UNCTION C A L L S
str2dsp_len()
str2dsp_len()
Parameters
source String to count.
of f s et Starting offset.
dsp_wi d Display width.
di r Count direction. Valid values are:
• FORWARD
• REVERSE
Return Values
Success: 0: Number of characters that can fit in dsp_wi d.
F UNCTION C A LL S
str2int()
str2int()
NOTE The input string cannot be longer than 40 characters. Overflow and underflow is
undefined. st r 2i nt ( ) returns the same value for a string containing only ASCII
zeros, and a string with more than 40 characters.
Parameters
buf f er Buffer containing string to convert; cannot exceed 40 characters.
Retur n Values
Success: Equivalent integer value of string.
F UNCTION C A L L S
str2long()
str2long()
Converts string data containing ASCII decimal digits (0 to 9) into a long integer
number. The string is parsed from the beginning to the end of the buffer, or until a
null is encountered.
This function ignores all non-digit characters, except a minus sign (“-”). The minus
sign is interpreted as a sign flag and must be located in the first character position
of the string. A sign flag occurring in any other position in the string is ignored.
NOTE The module does not perform error checking. Overflow and underflow conditions
are undefined. st r 2l ong( ) returns the same result for a string containing only
ASCII zeros and a string with more than 40 characters.
This routine is the inverse of l ong2st r ( ) . This routine differs from the standard
atol() routine in that it ignores non-numeric characters (except for a sign flag in the
first byte).
Parameters
s t r i ng Null-terminated string to convert.
Example See also the EXTRANS.C example program. The linked example code file
demonstrates use of str2long().
F UNCTION C A LL S
track_parse()
track_parse()
Parameters
par sed I/O structure.
t k_opt i on Track to parse.
Retur n Values
Success: 1
TRACK Structu re
st r uct TRACK
{
char acct [ 23] ; / * account */
char exp [ 5] ; / * expi r at i on dat e */
char name [ 27] ; / * name */
char t ype [ 4] ; / *
t ype r eq’ d by VI SA & MC */
char PVN [ 6] ; / * PVN r eq’ d by VI SA & MC */
char di sc [ 17] ; / * t r ack 1 and 2 onl y */
char t r ack [ 108] ; / * r aw t r ack dat a */
}
F UNCTION C A L L S
view_buffer()
view_buffer()
Displays a string in the current display window and allows the user to use the [*]
and [#] keys to scroll to the right and left, respectively, when viewing strings larger
than the current display.
view_buffer() also allows the calling routine to specify the key or keys allowed to
terminate viewing the string. Pressing any key other than [*], [#], and the specified
termination key produces an error beep, and the display does not change.
view_buffer() does not permit scrolling past the end of the message string and
does not scroll beyond the beginning of the string. A scroll increment is specified
in the call. This is the number of characters to move either right or left for each
press of the [*] or [#] key.
#defines are included in ACLCONIO.H for constructing maps for the termination
key map. To accept one or more keys to terminate the display, simply OR the
desired key values together. For example, KM_BS| KM_CR permits the enter or
backspace key to end the display.
If i nc is less than 1, 1 is used as the scroll increment. i nc cannot be greater than
the display window size.
NOTE
In Vx700 terminal, instead of [*] and [#] keys, down and up arrow keys are used to
scroll to the right and left, respectively.
Parameters
buf Buffer with message to scroll.
i nc Scroll increment.
key_ map Map of termination keys.
Return Values
Success: 1
Example See also the EXTRANS.C example program. The linked example code file
demonstrates use of view_buffer().
F UNCTION C A LL S
DVLR Fu nc ti on Call s
DVLR Funct ion DVLR functions allows manipulation of double variable length (counted) records
Calls (DVLRs). The following DVLR function calls are described:
• delete_dvlr() • seek_dvlr()
• insert_dvlr() • write_dvlr()
• read_dvlr()
A file using DVLRs provides the ability to search both forward and backward
through a file. Each record is composed of a forward-length count, the data, and a
backward-length count.
CAUTION To avoid file pointer positioning errors, do not mix file access methods. For
example, do not write a record using wr i t e_ dvl r ( ) one time and write() the
next time.
delete_dvlr()
Deletes one or more double variable length records from a DVLR file.
NOTE
The file position indicator should be positioned at the start of a record to
guarantee that the function deletes the correct amount of data.
Parameters
handl e File handle returned by open( ) .
count Number of records to delete, starting at the current file position.
Value Description
F UNCTION C A L L S
insert_dvlr()
insert_dvlr()
NOTE
The file position indicator must be positioned at the beginning of the DVLR. If it is
not, the file may become corrupt.
Parameters
handl e File handle returned by open( ) .
buf f er Pointer to the data to insert.
si ze Maximum number of bytes to insert into the file.
read_dvlr()
NOTE
To read the record successfully, the file position indicator must be positioned at
the beginning of a normal DVLR.
After reading the record, the file position indicator is advanced to the start of the
next record, even if all of the bytes in the record are not copied to the buffer.
Parameters
handl e File handle returned by open( ) .
buf f er Pointer to buffer storing the incoming record.
si ze Maximum number of bytes to read from the file.
F UNCTION C A LL S
seek_dvlr()
seek_dvlr()
NOTE
To seek past the correct quantity of data, the file position indicator must be initially
positioned at the beginning of the DVLR.
Parameters
handl e File handle returned by open( ) .
of f s et Number of records to seek forward or backward. Use a negative value to
seek backward.
or i gi n Position to offset from. Valid values are:
Retur n Values A positive number indicates absolute offset (in bytes) into the file after performing
the seek.
F UNCTION C A L L S
write_dvlr()
write_dvlr()
NOTE
The file position indicator must be positioned at the beginning of the DVLR. If it is
not, the file may become corrupt.
Parameters
handl e File handle returned by open( ) .
buf f er Pointer to the data to write.
si ze Maximum number of bytes to write to the file.
F UNCTION C A LL S
IVLR Fu nc ti on Call s
IVLR Functi on IVLR functions allows manipulation of integer variable length records (counted).
Calls The following IVLR function calls are described:
• delete_ivlr() • replace_ivlr()
• insert_ivlr() • seek_ivlr()
• read_ivlr() • write_ivlr()
T
CAUTION
To avoid file pointer positioning errors, do not mix file access methods. For
example, do not write a record using write_ivlr() one time and write() the next time.
delete_ivlr()
Parameters
h_f i l e Handle returned by open( ) .
count Number of records to delete, starting at the current file position.
Retur n Values
Success: Positive: Number of integers deleted
insert_ivlr()
Parameters
h_f i l e Handle returned by open( ) .
buf f er Pointer to data to insert.
r ec _s i z e Maximum number of bytes to insert into the file.
Retur n Values
Success: Positive: Number of bytes inserted
Failure: -1: Indicates a failure, with errno containing the error code as determined by
i ns er t ( ) .
F UNCTION C A L L S
read_ivlr()
read_ivlr()
Parameters
h_f i l e File handle returned by open( ) .
dat a Pointer to buffer storing the incoming data.
si ze Maximum number of bytes to read from the file.
Return Values
Success: Positive: Number of characters read.
Failure: -1: Indicates a failure, with errno containing the error code as determined
by read().
replace_ivlr()
Parameters
h_f i l e Handle returned by open( ) .
buf f er Pointer to data to insert.
r ec _s i z e Maximum number of bytes to insert into the file.
Return Values
Success: Positive: Number of bytes in the new record.
Failure: -1: Indicates a failure, with errno containing the error code as determined
by i ns er t ( ) or r ead( ) .
F UNCTION C A LL S
seek_ivlr()
seek_ivlr()
NOTE
To seek past the correct quantity of data, the file position indicator must be initially
positioned at the beginning of the IVLR.
Parameters
h_f i l e Handle returned by open( ) .
r ec_num Record number to search. int origin; Position to offset from. Valid
values are:
• SEEK_SET: From the beginning of file.
• SEEK_CUR: From the current position of the file pointer.
• SEEK_END: From the end of the file.
Retur n Values
Success: Positive: New value of the file position indicator (in total number of bytes
from the beginning of the file).
Failure: -1: Indicates that the specified record number was not found. Backward
seeking is not supported; a record number previous to the current record
number cannot be sought.
F UNCTION C A L L S
write_ivlr()
write_ivlr()
Parameters
h_f i l e Handle returned by open( ) .
dat a Pointer to the data to write.
si ze Maximum number of bytes to write to the file.
Return Values
Success: Positive: Number of characters written.
Failure: -1: Indicates a failure, with errno containing the error code as determined
by wr i t e( ) .
F UNCTION C A LL S
SVC Function Calls
SVC Functi on This section discusses the following SVC function calls:
Calls
• SVC_CLOCK() • SVC_KEY_TXT()
• SVC_KEY_NUM() • SVC_TICKS()
SVC_CLOCK()
NOTE
This function is supported on EPROM version 10 and higher.
Parameters
ac t i on • 0 = places the current time into buf f er (reads clock).
• 1 = writes the contents of buf f er to the clock (sets clock).
Retur n Values
Success: byt es: The number of bytes read or written.
Failure: -1: Failure
F UNCTION C A L L S
SVC_KEY_NUM()
SVC_KEY_NUM()
Uses keyboard, display, and beeper input to retrieve a formatted decimal number
(counted string). The following are used for key presses:
• The alpha key is used to toggle between positive and negative numbers. A
negative number is displayed with leading-minus sign (-).
• The backspace key is used to delete the last character entered.
• The clear key is used to abort the read.
Parameters
dest_ buf f Specifies where the resulting counted string of digits is stored.
max_di gi t s Specifies the maximum number of digits permitted (excluding
punctuation marks). This must be less than or equal to 15.
f r act i on Specifies the number of digits to the right of the radix. For example, the
fractional value. This must be less than or equal to 10. If the user presses
[ENTER] without additional input, the destination buffer contains a
counted string of zeros in the format specified in fraction.
Return Values
Success: bytes_read: The integer value containing the actual number of bytes stored
in the destination buffer (including punctuation characters) on a successful
read.
Failure: 1: The user pressed the clear key. The clear key trap is disabled when this
function is called.
F UNCTION C A LL S
SVC_KEY_TXT()
SVC_KEY_TXT()
Uses keyboard, display, and beeper to retrieve formatted data input. The following
are used for key presses:
• The control keys in the fourth column of the keyboard (backspace, alpha, and
enter) provide primitive editing options.
• The enter key is used to terminate the string, assuming the
mi ni mum_al l owed parameter has been satisfied.
• Each of the twelve imprinted keys on the keyboard represents several
characters: the alpha key scrolls through each of the possible characters. The
scroll sequence is inscribed on the key caps, with the following two
exceptions:
[0]: “0”, “-”, “ ” (space), “+”
Parameters
szKeyMap[ ] [ CHAR_PER_KEY] The key map specifying the mapping of the logical
alphanumeric keys to the physical keys on the
keypad.
sz KeyMap[ MAX_ALPNUM_KEYS] [ CHAR_PER_KEY] = {"0- +%" , " 1QZ. \ \ " , " 2ABC&" ,
" 3DEF%" , " 4GHI *" , " 5J KL/ " , " 6MNO~" , " 7PRS^" , " 8TUV[ " , " 9WXY] " ,
" * , ' \ " : " , " #=: $? " };
By default, in the Verix eVo ACT library, CHAR_PER_KEY is defined as 6. Hence the
application can have five chars per key in the key-mapping array. User can modify this
value by calling set_chars_per_key_value(). Based on the value set by the user, the
szKeyMap array should be passed to the library APIs. There is no validation done on
the array size by the library.
KeyMapSi ze Size of the key map specified.
dest The location for the entered data to be returned
(should be large enough to receive max_al l owed
bytes plus one count byte).
t ype Specifies the type of data entry allowed:
• 1= Alphanumeric keys.
F UNCTION C A L L S
SVC_KEY_TXT()
Retur n Values
Success: byt es_r ead: Integer value containing the actual number of bytes read on
a successful read.
Failure: -1: The user has pressed the clear key to cancel the read operation. The
clear key trap is disabled when this function is called.
F UNCTION C A LL S
SVC_TICKS()
SVC_TICKS()
Allows the user to check if a tick value has expired or read the systems tick
counter.
Parameters
ac t i on Determines the behavior of the function. Valid values are:
F UNCTION C A L L S
Ap pl ic at io n Id le En gi ne Fu nc tion Call s
Applicat ion This section covers the Branch Table entry, Function Table, and idle loop
Idle Engi ne processing for the application engine, and presents Application Idle Engine
Function Calls Examples. The following application engine functions calls are described:
• aie_main() • appl_idle_set_cancel_loop_time()
• appl_idle_get_cancel_poll_time() • appl_idle_set_fast_poll_time()
• appl_idle_get_fast_poll_time() • appl_idle_set_idle_poll_time()
• appl_idle_get_idle_loop_time() • appl_idle_set_slow_poll_time()
• appl_idle_get_slow_poll_time()
branch_tbl_entry
t ypedef st r uct br anch
{
short event ;
shor t f unc;
st r uct br anch *next_ t abl e;
} Br anch_Tbl _Ent r y;
Function Table
t ypedef shor t ( *PF_TABLE) ( shor t st at e) ;
The idle loop processing, slow poll, and fast poll functions should be of AI E
Pr oc .
t ypedef shor t ( * AI E Pr oc)( ) ;
F UNCTION C A LL S
aie_main()
aie_main()
Starts the application idle engine. The mai n( ) of the program is defined by the
application. After performing the application initialization, Application Idle Engine
Examples should be invoked. Application Idle Engine Examples is the idle engine
processing loop. See Figure 1 for details on processing.
Parameters
i dl et a bl e Branch Table structure to search for the event.
appl t abl e Function Table structure containing the function pointers to the
application event handling routines.
l oop Pointer to the application-defined idle loop function.
f as t pol l Pointer to the application-defined fast poll function.
sl owpol l Pointer to the application-defined slow poll function.
ac t i vat e The application-defined routine to call when a activate event occurs.
deact i vat e The application-defined routine to call when a deactivate event occurs
NOTE The Application Idle Engine uses the EVT_TIMER supported by the Verix V OS
for the slowpoll, fastpoll and idlepoll functionalities. The results are unpredictable
when the application uses the EVT_TIMER along with Application Idle Engine, as
there might be a clash of EVT_TIMER event by the library as well as the
application.
appl_idle_get_cancel_poll_time()
Returns the value of the cancel detect timer. This timer determines the periodicity
of the AIE checks for the cancel key.
F UNCTION C A L L S
appl_idle_get_fast_poll_time()
appl_idle_get_fast_poll_time()
Returns the value of the fast poll timer. This timer determines the periodicity of the
fast poll function that is called in the idle state.
Retur n Values
Success: The value of the fast poll timer.
appl_idle_get_idle_loop_time()
Returns the value of the idle loop timer. This timer determines the periodicity of
the idle poll function that is called in the idle state.
Retur n Values
Success: The value of the idle poll timer.
appl_idle_get_slow_poll_time()
Returns the value of the slow poll timer. This timer determines the periodicity of
the slow poll function that is called in the idle state.
Retur n Values
Success: The value of the slow poll timer.
appl_idle_set_cancel_loop_time()
Parameters
t i me The new value of the cancel poll timer.
F UNCTION C A LL S
appl_idle_set_fast_poll_time()
appl_idle_set_fast_poll_time()
Sets the value of the fast poll timer. The value set by the user should be in
multiples of 50. If the value entered is not in multiples of 50, then it will be rounded
to the nearest multiples of 50. Any negative value entered will also be taken as 50.
Parameters
t i me The new value of the fast poll timer.
appl_idle_set_idle_poll_time()
Sets the idle poll timer. The value set by the user should be in multiples of 50. If
the value entered is not in multiples of 50, then it will be rounded to the nearest
multiples of 50. Any negative value entered will also be taken as 50.
Parameters
t i me The new value of the idle poll timer.
appl_idle_set_slow_poll_time()
Sets the value of the slow poll timer. The value set by the user should be in
multiples of 50. If the value entered is not in multiples of 50, then it will be rounded
to the nearest multiples of 50. Any negative value entered will also be taken as 50.
Parameters
t i me The new value of the slow poll timer.
F UNCTION C A L L S
Me ssag e/ Da ta Entr y Engi ne Func tion Calls
Message/Data This section describes the following message/data entry function calls:
Entry Engine
• msg_get() • msg_select_file()
Function Calls
msg_get()
NOTE
Assumes msg_sel ect_ f i l e( ) has been called. This routine does not check for
buffer overflow. If the message file is compressed, msg_get() decompresses it.
Parameters
message_ num Number of the text message to retrieve.
buf _pt r Pointer to the buffer receiving the text data (uses global variables
msg_f i l e and msg_compr ess ).
Return Values
Success: Pointer to null-terminated text string.
Failure: NULL.
F UNCTION C A LL S
msg_select_file()
msg_select_file()
Opens a message file, reads the first record that contains the initialization
information, and sets the local file handle and compression variables.
Compression on/off is determined at the time the message file is built. This is
transparent to the user.
Parameters
f i l e_name Message filename where record is located.
Retur n Values
Success: Positive: Number of bytes read from the first record in the message file.
F UNCTION C A L L S
IS O 85 83 Me ssage Inte rfac e Engi ne Fu nc ti on Ca lls
ISO 8583 This section describes the following ISO 8583 message interface function calls:
Message • asc_to_asc() • hst_to_bi3()
Interface
Engine • asc_to_bcd() • hst_to_bin()
• av2_to_str() • map_clear()
• av3_to_av3() • map_man()
• av3_to_str() • map_reset()
• bcd_to_asc() • map_set()
• bcd_to_bcd() • map_test()
• bcd_to_snz() • process_8583()
• bcd_to_str() • set_dst_8583()
• bi2_to_hst() • set_src_8583()
• bi3_to_hst() • str_to_asc()
• bin_to_hst() • str_to_av2()
• bit_to_bit() • str_to_av3()
• bv2_to_str() • str_to_bcd()
• get_dst_8583() • str_to_bv2()
• get_fn_8583() • str_to_xbc()
• get_src_8583() • xbc_to_str()
• hst_to_bi2()
NOTE Conversion functions provided in the ISO 8583 Engine are not intended to be
called directly from an application. These functions are called indirectly through
the variable convert_table and process_8583 procedure.
F UNCTION C A LL S
asc_to_asc()
asc_to_asc()
Copies n bytes from source to destination, then advances the global pointers
dst_8583 and src_8583 by n.
Parameters
n Number of bytes to copy.
asc_to_bcd()
Converts n ASCII digits to packed BCD and stores them in the destination. If n is
an odd number, a leading zero is inserted in the destination. This function
assumes only ASCII digits are in the source, therefore, no verification for digits is
done.
Parameters
n Number of ASCII digits to convert.
asc_to_str()
Moves n characters from source to the destination, then appends a null into the
destination. This routine makes a null-terminated string out of n bytes. If there are
more characters than n bytes in the source, they are not copied to the destination.
Parameters
n Number of characters to move.
F UNCTION C A L L S
av2_to_str()
av2_to_str()
Converts a 1-byte counted string into a null-terminated ASCII string and stores the
result in the destination. The count is in BCD form.
Parameters
c Perform no conversion if length > c .
av3_to_av3()
Copies a 2-byte counted string from the source to the destination. The 2-byte
count is in BCD format. For example, the count for a string of length 128 bytes is
stored as 01, 40 in ASCII, which is 01, 28 in BCD representation. The count bytes
are also copied to the destination.
Parameters
c Perform no conversion if length > c .
av3_to_str()
Converts a 2-byte counted ASCII string to a null-terminated ASCII string. The byte
count in the source is in BCD form.
Parameters
c Perform no conversion if length > c .
F UNCTION C A LL S
bcd_to_asc()
bcd_to_asc()
Expands a packed BCD sequence into its ASCII equivalent. It assumes all the
BCD digits are in the range 0–9. No error checking is done by this function.
Parameters
n Number of BCD nibbles.
bcd_to_bcd()
Moves n BCD nibbles from the source to the destination. Since there are two
nibbles per byte and everything is byte aligned, this is done as byte moves.
Parameters
n Number of BCD nibbles to move.
bcd_to_snz()
Copies a fixed-length BCD field to a string. Leading zeros are removed, but are
included in the conversion count. For example, if a BCD string 00012598 is
converted to a string without leading zeros and a count of 6, then the results is an
ASCII string of 125.
Parameters
n Number of BCD digits to copy.
F UNCTION C A L L S
bcd_to_str()
bcd_to_str()
Copies n BCD digits from the source to the destination and then appends a null
character in the destination. Leading zeros in the source are preserved.
Parameters
n Number of BCD digits.
bi2_to_hst()
Parameters
c Perform no conversion if length > c .
bi3_to_hst()
Parameters
c Perform no conversion if length > c .
F UNCTION C A LL S
bin_to_hst()
bin_to_hst()
Converts n bytes of binary digits into 2n bytes of ASCII hex digits. This always
results in an even number of hex digits. No error checking is performed by this
function.
Parameters
n Number of digits to convert.
bit_to_bit()
Copies n bits from the source to the destination. Always moves in whole bytes.
Parameters
n Number of bits to copy.
bv2_to_str()
Parameters
c Perform no conversion if length > c .
F UNCTION C A L L S
get_dst_8583()
get_dst_8583()
Parameters
dst Buffer to store the destination buffer of the ISO 8583 engine.
Dependencies Used in all the conversion routines that must obtain the destination buffer of the
ISO 8583 engine.
get_fn_8583()
Returns the erroneous field number during packet packing or unpacking. The
application calls this function to obtain the erroneous field after pr ocess _8583( )
fails, returning an -1 error. This implies that the field is not defined in the field
table.
Retur n Values
Success: The field number that had the error during message packing or unpacking.
Dependencies Obtain a meaningful results, the application should call get_fn_8583() only after
the packing/unpacking fails.
get_src_8583()
Parameters
sr c Buffer to store the source buffer of the ISO 8583 engine.
Dependencies Used in all the conversion routines that must obtain to get the source buffer of the
ISO 8583 engine.
F UNCTION C A LL S
hst_to_bi2()
hst_to_bi2()
Converts a null-terminated ASCII hex string to a 1-byte counted string and stores
the result. The count is in BCD format and is only half the length of the ASCII hex
string. No error checking is performed by this function.
Parameters
c Perform no conversion if length > c .
hst_to_bi3()
Converts a null-terminated ASCII hex string to a 2-byte counted string and stores
them in the destination. The count is in BCD format and is only half the length of
the ASCII hex string. No error checking is performed by this function.
Parameters
c Perform no conversion if length > c .
hst_to_bin()
Converts n bytes of ASCII hex digits to binary and stores the result. The source
must contain an even number of hex digits and the count; n, must be an even
number. No error checking is performed by this function.
Parameters
n Number of ASCII hex digits to convert.
F UNCTION C A L L S
iso8583_main()
iso8583_main()
Parameters
pConver t Tabl e Pointer to a convert table.
Ret 1 Function pointer to a user-defined function that returns the value of
variant fields.
Ret 2 Function pointer to a user-defined function that returns the value of
variant fields.
sz dst _8583 Buffer to store the destination buffer of the ISO 8583 engine.
szsrc_8583 Buffer to store the source buffer of the ISO 8583 engine.
Dependencies For any application, iso8583_main() should be called in mai n( ) before using the
ISO Message Engine.
map_clear()
Resets all bits in the designated map. The max_ f n parameter indicates the
maximum field number in the map (64, 128, 192, or 256). This is necessary to
ensure the correct construction of maps that exceed 64 bits.
Parameters
map Pointer to bit map.
max_f n Maximum field number in map.
F UNCTION C A LL S
map_man()
map_man()
Turns bits on or off in the specified map. The default is to set (turn on) the bit in the
map associated with each field number. To reset a bit, simply add the constant
0xFF to the desired field number. Since there are a variable number of
parameters, add the constant STOP to the last parameter. If f i el d_ no is illegal
for the given map, the operation on that particular bit is ignored.
Parameters
map Pointer to the bitmap.
f i el d_ no Field (bit number) to reset.
map_reset()
Turns off the bit associated with the field number. If f i el d_ no is illegal for the
given map, this function does nothing.
Parameters
map Pointer to the bitmap.
f i el d_ no Field (bit number) to reset.
F UNCTION C A L L S
map_set()
map_set()
Turns on the bit associated with the field number. If f i el d_ no is illegal for the
given map, this function does nothing.
Parameters
map Pointer to the bitmap.
f i el d_ no Field (bit number) to set.
map_test()
Returns the status of the bit in the bitmap corresponding to the field number. The
returned value is 0 if the bit is off, and 1 if it is on.
Parameters
map Pointer to the bitmap.
f i el d_ no Field (bit number) to check.
Retur ns Values
Success: 1: The bit is set.
Failure: 0: The bit is off or an illegal field number was passed by the caller.
F UNCTION C A LL S
pro ce ss_8 58 3()
process_8583()
Processes packing or unpacking of a packet by checking the bits in the map. For
each bit that is set, it either appends the formatted data to the outgoing packet or
disassembles the packet and stores the data into proper application variables as
indicated by the parameter how.
Parameters
how Pack or unpack.
f i el d_ t bl Field table.
map Bitmap to pack.
buf f er Buffer address.
l i mi t Maximum buffer size.
Retur n Values
Success: 0: Assembly: number of bytes placed in buf f er , which is used for write.
Disassembly: Number of bytes in buf f er not processed, which should be
zero.
Failure: -1: Field not defined in field table. The variable fn_8583 contains the field in
error.
-2: Stored more in buf f er than limit.
-3: Exceeded size of valid data in buf f er .
-4: Stored more than variable limit on an incoming message.
-5: No matching variant field definition.
set_dst_8583()
Parameters
dest Data to set the destination buffer of the ISO 8583 engine.
Dependencies Used in all conversion routines that must set the destination buffer of the ISO
8583 engine.
VERIX EVO ACT PROGRAMMERS GUIDE 247
F UNCTION C A L L S
set_src_8583()
set_src_8583()
Parameters
sr c Data to set the source buffer of the ISO 8583 engine.
Dependencies Used in all the conversion routines that must set the source buffer of the ISO 8583
engine.
str_to_asc()
Parameters
n Size of the ASCII string.
str_to_av2()
Parameters
c Required to be 1.
F UNCTION C A LL S
str_to_av3()
str_to_av3()
Parameters
c Required to be 1.
str_to_bcd()
Parameters
n Size of the BCD string.
str_to_bv2()
Parameters
c Required to be 1.
F UNCTION C A L L S
str_to_xbc()
str_to_xbc()
Converts a null-terminated ASCII string to a BCD string while preserving the first
byte of the source. The first byte must contain one of the two following values:
• C: Denotes a credit transaction.
• D: Denotes a debit transaction.
Parameters
n Size of the BCD string.
xbc_to_str()
Converts a BCD string to a null-terminated ASCII string while preserving the first
byte of the source. The first byte must contain one of the two following values:
• C: Denotes a credit transaction.
• D: Denotes a debit transaction.
Parameters
n Size of null-terminated ASCII string.
F UNCTION C A LL S
PIP Engine Function Calls
PIP Engin e This section describes the following PIP Engine function calls:
Function Calls
• check_8583_tpdu_msg_id() • prot_8583()
• find_field_index() • prot8583_main()
• pip_main() • save_8583_tpdu_msg_id()
• pip_trans() • set_tpdu_length()
check_8583_tpdu_msg_id()
Verifies a valid match between the current values of the TPDU and message ID
found in the field table, and the values passed in the call. This comparison
requires that the TPDU and message ID are stored as packed numeric (BCD)
values.
This function is used by pip_trans() and prot_8583(). In addition, this function can
be used in other places in the application.
Both the TPDU and the message ID are used in the transmit packet.
Parameters
cont r ol Pointer to the data structure used by the ISO 8583 Protocol Engine.
or i g_t pdu Pointer to the buffer containing the original TPDU.
ori g_msg_i d Pointer to the buffer containing the original message ID.
Retur n Values
Success: 1: The TPDU and message ID match.
F UNCTION C A L L S
fi nd _f ie ld _ind ex ()
find_field_index()
Searches a field table array for a specific field entry. This function is used by the
pip_trans() function.
CAUTION There is no mechanism within the function to determine the validity of the
field_struct-type pointer passed to it. Passing an invalid field_struct pointer to the
function causes invalid results.
Parameters
sear ch_num The field for which to search.
Return Values
Success: The address of the array element.
pip_main()
Passes pointers to the map buffer, pointer to the message ID buffer, pointer to
processing code, and a function pointer to user-defined set_trans_field function.
The first three buffers are filled by the application before these are used by the
PIP Engine.
Dependencies For any application, pip_main() must be called in mai n( ) before using the PIP
Engine. Also, note that the fourth parameter can be null if the application wants to
use the default s et _ t r ans _f i el d function provided in PIP engine.
F UNCTION C A LL S
pi p_ tran s()
pip_trans()
Provides advice message processing and an interface to the ISO 8583 Protocol
Engine. This function sets up AMEX host (PIP) processing, and defines the
transaction type and initializes the host data structure.
NOTE • Verix eVo ACT library checks for the cancel key operation during PIP transaction. If the
DISABLECANKEYPIP c onf i g. s ys entry is set to 1, then Verix eVo ACT library
ignores the cancel key pressed during the PIP transaction.
• If the DISABLECANKEYPIP c onf i g. s ys entry is set to 0, or the config entry is not
found, then Verix eVo ACT library checks for the cancel key press and aborts the PIP
transaction if it is pressed.
• For more information on the PIP specification, refer to the AMEX Express 3000 PIP
Terminal Technical Specifications (available from American Express).
Parameters
t r ans_t ype Informs pip_trans() of the requested transaction. Valid values are:
F UNCTION C A L L S
pi p_ tran s()
Retur n Values
Success: 1: Transaction type and structure data successfully passed to application.
AMEXHOST_DUPKEY_ERROR (-65)
AMEXHOST_VOID_ERROR (-66)
AMEXHOST_INVADV_ERROR (-67)
AMEXHOST_INV_OPTION (-68)
PIP_NOT_ONLIN (-69)
AMEX_VOICE_AUTH (-70)
AMEX_DCP_APPROVAL (-71)
AMEX_NO_ADVICE (-72)
AMEX_DCP_REVERSAL (-73)
HOST_ERROR (-74)
NOTE
errno may provide additional information.
F UNCTION C A LL S
pi p_ tran s()
The pip_trans() function only uses the lower byte of the trans_type parameter,
which it passes to the AMEX host module. This module uses the lower byte to
determine the type of transaction being processed (as defined in AMEXHOST. H).
The AMEX host module passes the trans_type parameter to the
s et _ t r ans _f i el ds ( ) function (application defined). This function may use both
the lower and upper bytes to complete any additional transaction information
required by the application.
NOTE
The lower byte should only use assigned values defined in AMEXHOST. H. The
upper byte can be assigned any value.
In the following example, the application uses the lower byte to define a valid
AMEX transaction, and the upper byte to define the bitmap, message ID, and
processing code associated with the transaction.
#i ncl ude " amexhost . h"
/ * A_ADJ UST_CREDI T and A_ADJ UST_DEBI T ar e def i ned i n AMEXHOST. H. */
#def i ne ADJ UST_CREDI T ( 0x1000 | A_ADJ UST_CREDI T)
/ * 0x0013 or 00010011b */
#def i ne ADJ UST_DEBI T ( 0x1100 | A_ADJ UST_DEBI T)
/ * 0x0012 or 00010010b */
/ * Fi l e For mat
* Recor ds 0 - 20 = Bi t map I ndex, Mess age I D I ndex, and Pr ocessi ng Code
I ndex
* Recor ds 21 - 35 = I SO 8583 Bi t maps
* Recor ds 36 - 45 = I SO Mess age I Ds
* Recor ds 46 - 53 = I SO Pr ocessi ng Codes
*/
10 Tr an Code 10=" 33, 42, 52"
/ * AMEX Sal e */
11 Tr an Code 11=" 33, 42, 53"
/ * AMEX Ref und */
/ * Tr ansacti on bi t maps def i nes f or AMEX and Ci t i */
33 Bi t map 8 =" \ x30\ x20\ x05\ x80\ x00\ xc0\ x00\ x0c"
/ * AMEX Fi nanci al */
/ * Message I Ds f or AMEX and Ci t i */
42 Message I D 2 =" \ x02\ x00"
/ * Fi nanci al Tr ansacti on */
/ * Pr ocessi ng Codes f or AMEX and Ci t i */
52 Pr oc Code 1 ="\ x00\ x40\ x00"
/ * Sal e, Of f l i ne Sal e, Aut h * /
53 Pr oc Code 2 ="\ x02\ x40\ x00"
/ * Voi d DB, DB Adj ust */
F UNCTION C A L L S
pro t_ 8583 ()
prot_8583()
This function is called by the PIP Engine and provides the following functionality:
• an interface to the ISO 8583 Message Engine to assemble and disassemble
packets.
• an interface to the application-defined validation function used to determine if
an appropriate response was received.
• an interface to the application-defined communications function used to
transmit and receive request/response messages.
• processes reversals as specified in the ISO 8583 standard.
NOTE • Verix eVo ACT library checks for the cancel key operation during PIP
transaction.
• If the DISABLECANKEYPIP conf i g. sys entry is set to 1, then Verix eVo
ACT library ignores the cancel key pressed during the PIP transaction.
• If the DISABLECANKEYPIP conf i g. sys entry is set to 0 or the config entry
is not found, then Verix eVo ACT library checks for the cancel key press and
aborts the PIP transaction if the cancel key is pressed.
Parameters
cont r ol _dat a Must be a properly initialized COMM_8583_DATA structure.
r ev_opt Determines the reversal processing required and must be one of the
following, (as defined in PROT8583. H):
• REV_ON: Normal reversal processing.
• REV_OFF: No reversal processing.
• REV_ONLY: Process only a pending reversal, if one exists.
Return Values
Success: PROT8583_SUCCESS
F UNCTION C A LL S
pro t_ 85 83 ()
-18: While parsing the outgoing packet, more data was stored in the buffer
than the specified limit (packet size).
-19: While unpacking the incoming packet, the packet size is larger than
the size specified in the field table.
-20: While unpacking the incoming packet, the data parsed for a variable is
larger than the size specified in the field table.
NOTE
If r esp_t i meout is zero, the member in the control data structure, comm_ t i meout ,
must be greater than zero.
Two functions must be provided: the transmit/receive function and the validation
function. Both of these functions must have a return type of int.
The validation function is called after receiving a response. This function can
return the following values:
Success: 0
Failure: -1 to -14: Use if the validation routine fails and you do not want to wait for
another response packet.
1: Indicates the new time-out value (in seconds) to use to wait for
another response packet.
F UNCTION C A L L S
pro t8 583_ ma in ()
prot8583_main()
Parameters
RevFxn f unc User defined function pointer to modify the reversal data.
save_8583_tpdu_msg_id()
Copies the TPDU and message ID from the application variable to the destination
buffer. This function is primarily used by the pip_trans() and prot_8583() functions.
Parameters
cont r ol Pointer to the structure used to find the variable declared in the field
table.
dest_ t pdu Pointer to the buffer to store the TPDU.
dest _msg_i d Pointer to the buffer to store the message ID.
F UNCTION C A LL S
set_tpdu_length()
set_tpdu_length()
Allows the user to set the length of the TPDU field for the PIP processing.
NOTE
The device handle must be valid.
Parameters
i nTPDULengt h Length of the TPDU field. Pass zero if absent.
Retur n Values
Success: TPDU_PARAM_SUCCESS
Failure: -1 to -14: Use if the validation routine fails and you do not want to wait for
another response packet. INVLD_ORDER (-2)
TPDU_PARAM_INVALID (< 0)
NOTE
set _t pdu_l engt h( ) must be called by the application if the TPDU field is
present and its length is not 5 bytes (default value).
F UNCTION C A L L S
Da ta Capt ure En gi ne Fu nc ti on Call s
Data Capt ur e The Data Capture Engine allows short integers, long integers, characters, and
Engine strings to be stored and retrieved from keyed files. The calling application
Function Calls specifies the application variable indicating the source or destination of the data,
the files for storage, the operation desired (write or read), and the type of
conversion required. The Data Capture Engine completes the conversion and
accesses the data file as required. This is accomplished using a single function,
dce_key_cvt().
This section describes the following data capture function calls:
• dce_key_cvt() • DCE_PUTCFG_C()
• DCE_GETCFG_C() • DCE_PUTCFG_S()
• DCE_GETCFG_S()
The application programmer can create other macros as required, but should not
modify the standard macros provided in ACDCE. H. Any modification of standard
macros can introduce confusion and problems in the maintenance of the
application.
F UNCTION C A LL S
dce_key_cvt()
dce_key_cvt()
Access function for Data Capture Engine keyed file. This function permits
application data to be written to and read from keyed files, and completes any
required data conversion using functions provided by the ACL.
The Data Capture Engine does not attempt to create a keyed file; the file must
exist prior to requesting any Data Capture Engine operation. The specified file
does not have to be open; this function opens the file, performs the operation, and
closes it automatically. If the file is not already open, a file handle is obtained from
the operating system, and released on completion of the operation.
The data is not validated to be of the type specified in the call. The caller is
expected to call the Data Capture Engine and correctly specify the data type. The
result of requesting an operation with an incorrect data type is undefined.
Parameters
pr ocess Valid values are:
• DCE_ READ
• DCE_WRI TE
Retur n Values
Success: 1
F UNCTION C A L L S
dce_key_cvt()
NOTE • When reading previously stored information, the data type can be specified as
a character string. This may be useful when the data is to be displayed,
printed, and so on.
• For example, storing the value 100 to a keyed file results in the conversion of
the value to the ASCII string “100”. If the value is then read as a string variable,
the string “100” is placed in the application buffer. This does not affect the
ability to later read the data as a signed or unsigned integer.
• This concept applies to each of the macros listed in this manual that end with
_I, _L, _UI and _UL.
F UNCTION C A LL S
DCE_ GETCFG _C()
DCE_GETCFG_C()
This macro call is the same as dce_key_cvt(), except that the filename is supplied
as CONFIG.SYS, the process is supplied as read, and the data type is supplied as
character.
Parameters
key Keyed record identifier.
dat a Destination data address.
Retur n Values
Success: 1
DCE_GETCFG_S()
This macro call is the same as the dce_key_cvt() function, except that the
filename is supplied as CONFIG.SYS, the process is supplied as read, and the
data type is supplied as string.
Parameters
key Keyed record identifier.
dat a Address of source data.
Retur n Values
Success: 1
F UNCTION C A L L S
DC E_PU TCFG_C ()
DCE_PUTCFG_C()
This macro call is the same as dce_key_cvt(), except that the filename is supplied
as CONFIG.SYS, the process is supplied as write, and the data type is supplied
as character.
Parameters
key Keyed record identifier.
dat a Address of source data.
Return Values
Success: 1
DCE_PUTCFG_S()
This macro call is the same as dce_key_cvt(), except that the filename is supplied
as CONFIG.SYS, the process is supplied as write, and the data type is supplied
as string.
Parameters
key Keyed record identifier.
dat a Address of source data.
Return Values
Success: 1
F UNCTION C A LL S
Mode m Engi ne Fu nc ti on Call s
Modem Engin e This section describes the following modem engine function calls:
Function Calls
• inInitModem() • xmdm_dial_status()
• inOpenModem() • xmdm_failed_output_pending()
• vdCheckDataMode() • xmdm_flush()
• vdSetEchoMode() • xmdm_get_line_dial()
• xhayes_control() • xmdm_hangup()
• xhayes_display() • xmdm_init()
• xhayes_flush() • xmdm_input_pending()
• xhayes_response() • xmdm_open()
• xhayes_send_cmd() • xmdm_output_pending()
• xhayes_status() • xmdm_receive_data()
• xmdm_check_status() • xmdm_send_data()
• xmdm_checkline() • xmdm_set_attrib()
• xmdm_clear() • xmdm_set_protocol()
• xmdm_close()
F UNCTION C A L L S
inInitModem()
inInitModem()
Parameters
h_ modem Opened modem device handle.
max_ wai t Maximum amount time, in seconds, to wait for a response.
va_ al i s t Environment variable number of init string commands to send.
Return Values
Success: SUCCESS: Initialization successful.
Example i nt max_wai t ;
i nt h_modem;
r esul t = i nI ni t Modem( h_modem, 5, 1, 2, 3, 4, 5, 6, - 1) ;
NOTE This function can be used to send any number of initialize commands. It should be
passed with numeric values. The function appends “M” to the passed numeric,
and looks for the environment variables. So, for the above example, it looks for
environment variables “M1”, “M2”, “M3”, “M4”, “M5,” and “M6”. The parameters
should be terminated with -1.
If the CONFIG.SYS environment variable is non-populated, it skips and continues
to the next CONFIG.SYS environment variable. The user is informed about this by
means of LOG_PRI NTF statement.
F UNCTION C A LL S
inOpenModem()
inOpenModem()
Opens the modem, as specified in por t and obtains the resulting modem
response. h_ modemcontains the handle returned by the open( ) call. It opens the
port and sets the protocol parameters. If por t is null or empty, then the device
MDM_PORT is opened.
This call is a simplified version of xmdm_open().
NOTE This function opens the modem port, sets the baud and formats parameters. It
does not send any initialization commands. To initialize the port, use
i nI ni t Modem( ) .
Parameters
h_ modem Pointer to the modem handle.
port Pointer to the modem port string.
rate Rate of connection.
f or mat Connection format.
Retur n Values
Success: SUCCESS: Execution successful.
Example i nt r et Val ;
i nt h_modem;
r et Val = i nOpenModem ( &h_modem, NULL, Rt _2400, Fmt _A7N1) ;
F UNCTION C A L L S
vdCheckDataMode()
vdCheckDataMode()
Sets the parameter for checking the data mode before sending any command to
the modem. xhayes_send_cmd() checks for this and if set to TRUE, checks for
the data mode before sending the command. If set to FALSE, it does not perform
any data mode checking. Default is TRUE for backward compatibility.
Parameters
mode Parameter to enable or disable check for data mode before sending the
command.
vdSetEchoMode()
Sets the parameter for echo mode ON or OFF in the command response. It is
used in conjunction with xmdm_open(). If echo mode is set to TRUE, the user
must provide the init string with echo on. If echo mode is set to FALSE, the library
initializes the port with echo off.
Parameters
set echo Parameter to set or reset the echo mode command response.
NOTE Call function before calling xmdm_open( ) . If set to TRUE, xmdm_open( ) adds
“E1” to the user-defined init string.
If set to FALSE, xmdm_open( ) adds “E0” to the user-defined command string.
The default value is FALSE for backward compatibility.
F UNCTION C A LL S
xh ay es _c on tro l()
xhayes_control()
Sends a Hayes command to the modem and returns a Hayes status code.
Parameters
h_ modem Modem device handle.
h_cl ock Clock device handle.
max_ wai t Maximum wait time (seconds). If no limit on the amount of time in which to
access the modem is desired, set max_ wai t to zero so that the function
never times out, but only returns with the first response from the modem.
command Command to execute.
buf f er Buffer address.
For the Hayes “Dial” command (“D”), buf f er must be a string containing
the phone number and any other valid dial command characters, plus four
additional bytes used internally for Hayes formatting.
For the Hayes “Check Line” command (“-”) and “Hang Up” command (“H”),
buf f er must be at least four bytes in length.
Retur n Values
Success: 0 - 91: Numeric Hayes response (see Table 17).
F UNCTION C A L L S
xh ay es _d ispl ay ()
xhayes_display()
Parameters
hayes_code Hayes modem response code.
buf f er Buffer address.
Return Values
Success: SUCCESS: Hayes response code is valid.
NOTE
XMODEM. H contains a list of valid Hayes response codes. The buffer must be at
least 14 bytes in length to accommodate the returned string.
Invalid response codes are returned in buf f er , and the function returns with
FAILURE.
Table 17 Hayes Failure Codes
Numeric Hayes Code Hayes String
0 HAYES_OK “OK”
1 CONNECT_300 “CONNECT 300”
2 RING_DETECT “RING”
3 NO_CARRIER “NO CARRIER”
4 HAYES_ERROR “ERROR”
5 CONNECT_1200 “CONNECT 1200”
6 NO_DIALTONE “NO DIAL TONE”
7 BUSY_DETECT “BUSY”
8 NO_ANSWER “NO ANSWER”
10 CONNECT_2400 “CONNECT 2400”
11 CONNECT_4800 Hayes “CONNECT 4800” status.
12 CONNECT_9600 Hayes “CONNECT 9600” status.
13 CONNECT_7200 Hayes “CONNECT 7200” status.
14 CONNECT_12000 Hayes “CONNECT 12000” status.
15 CONNECT_14000 Hayes “CONNECT 14000” status.
16 CONNECT_19200 Hayes “CONNECT 19200” status.
17 CONNECT_38400 Hayes “CONNECT 38400” status.
18 CONNECT_57600 Hayes “CONNECT 57600” status.
19 CONNECT_115200 Hayes “CONNECT 115200” status.
F UNCTION C A LL S
xh ay es_d is play ()
F UNCTION C A L L S
xh ay es_f lu sh()
xhayes_flush()
Clears the command response buffer from the modem device. The r ead( )
function is called until the response buffer is empty. This function returns
immediately.
Parameters
h_ modem Opened modem device handle.
Return Values
Success: SUCCESS: The Hayes response buffer cleared successfully.
F UNCTION C A LL S
xh ay es_re spon se ()
xhayes_response()
Reads a Hayes modem command response and converts the command into a
Hayes code integer value. Use xhayes_response() to obtain a valid Hayes
response code following any modem command.
Parameters
h_ modem Opened modem device handle.
h_cl ock Clock device handle.
max_ wai t Maximum amount time, in seconds, to wait for a response. If no timeout is
desired, set max_ wai t to zero
Retur n Values The value returned is the Hayes numeric response value, which is an integer and
is in the allowed range of valid Hayes numeric response codes, see Table 8.
NOTE xhayes_di spl ay( ) can be called to convert the Hayes response return value
to a display string. If echo is enabled then the echo response is ignored and the
Hayes numeric response is returned.
F UNCTION C A L L S
xh ay es_sen d_ cm d()
xhayes_send_cmd()
Converts the input string into Hayes format and sends the resulting command
string to the modem.
If vdCheckDataMode() is set to TRUE, this function checks if the modem is in data
mode or command mode before sending the command.
If vdCheckDataMode() is set to FALSE, this function does not perform any
checking before sending the command.
By default, vdCheckDataMode() is set to TRUE so the function performs a data
mode check.
Parameters
h_ modem Opened modem device handle.
cmd_buf f Command buffer string. cmd_buf f points to the command buffer string
that contains a valid, null-terminated string, such as “D555-1234”, “H” or
“S0= 1”. It must also be large enough to accommodate two additional
command characters, “AT” and <CR> (three bytes total). Upon return,
cmd_buf f contains the fully formatted Hayes command. If the returned
length of cmd_buf f is not equal to the return value of
xhayes_send_cmd(), an error occurred.
NOTE The value returned is the number of bytes sent to the modem. Any value less than
3 should be interpreted as a send command error, since “AT\ r” is the shortest
possible command.
F UNCTION C A LL S
xh ay es_s ta tu s()
xhayes_status()
Obtains the Hayes response from the mode. This function calls the
xhayes_response() and returns the response.
Parameters
h_ modem Modem handle.
h_cl ock Clock device handle.
wai t _t i me Specifies the maximum amount of time, in seconds, to receive the Hayes
response. Set this to zero if no time out is desired.
F UNCTION C A L L S
xm dm_c he ck _s tatu s()
xmdm_check_status()
Returns the current modem signal information, including CTS, DCD, framing error,
overrun error, parity error, and break or abort. The st at _map parameter indicates
which signal(s) to check. Each signal is defined in XMODEM.H and can be
combined for example, E_PARI TY_ FRAME| E_FRAME_OVERRUN.
Parameters
h_ modem Modem handle.
st at _map Signal(s) of interest. Valid values are:
• E_PARITY
• E_OVERRUN
• E_PARITY_OVERRUN
• E_FRAMING
• E_PARITY_FRAME
• E_FRAME_OVERRUN
• MDM_BREAK
• MDM_CTS
• MDM_DCD
Return Values
Success: 1: At least one signal in stat_map was set.
F UNCTION C A LL S
xm dm _c he ck line ()
xmdm_checkline()
Parameters
h_ modem Opened modem device handle.
Retur n Values
Success: SUCCESS: Phone line present.
F UNCTION C A L L S
xm dm _c le ar()
xmdm_clear()
NOTE The modem device should be in initialized state before calling xmdm_cl ear ( )
API. If h_ modemis non-zero, xmdm_cl ear ( ) refers to the opened modem
device, if h_ modemis zero, then xmdm_cl ear ( ) API behaves similar to
xmdm_open( ) API. xmdm_set _pr ot ocol ( ) API is used to initialize the modem.
Parameters
h_ modem Modem handle.
sz_mdm_name Modem access path.
h_cl ock Clock device handle.
wai t _t i me Maximum response time (seconds).
rate Rate of connection.
f or mat Connection format.
Return Values
Success: > 0: Successful initialization, open modem handle value returned.
F UNCTION C A LL S
xm dm _c le ar()
F UNCTION C A L L S
xm dm _c lo se ()
xmdm_close()
First obtains modem status, then, closes the modem device based on input
parameters and modem communication status. xmdm_close() acts as a safe
close so that, for example, if output is currently pending, the modem is not closed.
Parameters
h_ modem Opened modem device handle.
out put _pend Non-zero value causes the function to test for pending output. If output
exists, the function does not close the modem, and an error code
returns.
i nput _pend Non-zero value causes the function to test for pending input. If input
exists, the function does not close the modem and an error code
returns.
Return Values
Success: SUCCESS: Successful close.
F UNCTION C A LL S
xm dm _d ia l_ stat us ()
xmdm_dial_status()
Parameters
h_ modem Opened modem device handle.
h_cl ock Clock device handle.
max_ wai t Maximum amount time, in seconds, to wait for a response.
If max_ wai t is zero, xmdm_di al _s t at us( ) does not time out. The
default wait-for-carrier detect after dialing for Verix eVo modems is 30
seconds. This 30 second wait can be changed through the S7 modem
register or by setting the *S7 environment variable in CONFIG.SYS.
The *S7= 55 entry causes the modem device to wait up to 55 seconds for
answer and carrier detect.
Retur n Values
Failure: E_HR_TIMEOUT: Hayes response not obtained before max_ wai t elapsed.
Value Description
CONNECT_ 300 Dial and connect successful; 300 baud.
NO_CARRI ER No carrier detected.
HAYES_ERROR Hayes error occurred in the dial command.
CONNECT_ 1200 Dial and connect successful; 1200 baud.
NO_DI ALTONE Indicates no dialtone present. This status exists only if dialtone is
enabled with the S60= 0 command (the default setting).
BUSY_ DETECT Indicates line is busy. This status exists only if busy detection is
enabled. The X4 command (default) enables both dialtone and busy
detect.
NO_ANSWER Hayes silence; phone not answered.
VFI _NO_LI NE VeriFone unique; phone line does not exist.
VFI _DI ALDONE VeriFones dial done; dialing complete.
F UNCTION C A L L S
xm dm _f ai le d_ ou tput _p en di ng ()
xmdm_failed_output_pending()
Parameters
h_ modem Opened modem device handle.
Return Values
Success: SUCCESS: No failed output pending.
xmdm_flush()
NOTE This function can be useful just before closing the modem. Also see
xmdm_cl ose( ) and xmdm_s et _at t r i b( ) , which both attempt to flush the
output buffer.
Parameters
h_ modem Opened modem device handle.
Return Values
Success: SUCCESS: Modem buffer and reject queue flushed.
F UNCTION C A LL S
xm dm _g et _l in e_ di al ()
xmdm_get_line_dial()
Parameters
h_ modem Opened modem device handle.
di al _ st r i ng Phone number to dial.
i wr i t e write() return value.
h_cl ock Clock device handle.
max_ wai t Maximum amount time, in seconds, to wait for a response.
Retur n Values
Failure: E_INVALID_RESP: Obtained invalid dial status response such as “OK”.
F UNCTION C A L L S
xm dm _g et _lin e_ di al ()
Value Description
CONNECT_300 Connection made; 300 baud.
CONNECT_1200 Connection made; 1200 baud.
NO_CARRIER Connection not established.
HAYES_ERROR Modem error occurred.
NO_DIALTONE No dial tone present on the phone line.
BUSY_DETECT Called number was busy.
NO_ANSWER Called number did not answer.
VFI_NO_LINE VeriFone-defined; no phone line status.
VFI_DIALDONE VeriFone-defined; dialing completed status.
CAUTION If auto-answer is enabled and a call comes in just before dialing out,
xmdm_get _l i ne_di al ( ) does not consider this a valid Hayes response to
dialing, and returns the value E_INVALID_RESP. This can be unpredictable.
Setting auto-answer to off (ATS0= 0) just before dialing prevents this condition.
Tabl e 18 Di al Co mm an d St ri ng Mo di fi er s
Hex ASCII
Command Descriptio n
Code Code
30h–39h ’0’–’9’ Digits pulse/tone dialed.
41h–44h ’A’–’D’ Digits pulse/tone dialed.
23h, 2Ah ’#’, ’*’ Digits tone dial only.
50h ’P’ Switch to pulse dial.
54h ’T’ Switch to tone dial.
56h ’V’ Verify answer tone (Bell 103/ Bell 212).
57h ’W’ Wait for dial tone or (S7) seconds.
2Ch ’,’ Comma; wait for (S8) seconds.
3Bh ’;’ Semicolon; eliminate the handshake.
20h ’’ Space/blank is ignored.
2Dh ’-’ Dash/hyphen is ignored.
Any other characters or unimplemented digits cause a return code of 4 (ERROR).
F UNCTION C A LL S
xm dm _h an gu p()
xmdm_hangup()
Instructs the modem unit to go on-hook (disconnect) from the phone line.
Parameters
h_ modem Opened modem device handle.
h_cl ock Clock device handle.
max_ wai t Parameter is not used in the library, but is retained for backward
compatibility.
Retur n Values
Success: SUCCESS: Successful execution.
NOTE Calling xmdm_hangup( ) to a modem that is currently on-hook has no effect. The
hangup function always terminates the connection, regardless of who originated
the call. (Closing the modem also guarantees a disconnect.)
F UNCTION C A L L S
xm dm_i ni t( )
xmdm_init()
Initializes the modem by opening the device and setting the communications
parameters to the specified protocol. If the modem device is already open, it is
closed and then re-opened. If the modem is not open, the h_ modemparameter
must be set to zero. This function is equivalent to calling xmdm_clear() and
xmdm_set_protocol().
Parameters
h_ modem Opened modem device handle.
sz_mdm_name Path to modem device.
h_cl ock Clock device handle.
max_ wai t Maximum amount time, in seconds, to wait for a response.
rate Rate of connection.
f or mat Connection format.
Return Values
Success: > 0: Successful initialization; modem device handle is returned.
F UNCTION C A LL S
xm dm _i ni t()
F UNCTION C A L L S
xm dm _i np ut _p en di ng ()
xmdm_input_pending()
Parameters
h_ modem Modem handle.
Return Values
Success: SUCCESS: No input pending.
F UNCTION C A LL S
xm dm _o pen( )
xmdm_open()
Opens the modem device specified in pat h and obtains the resulting modem
responses.
Parameters
h_ modem Pointer to the modem handle.
pat h Pointer to the modem path string.
h_cl ock Clock device handle.
max_ wai t Maximum amount time, in seconds, to wait for a response.
rate Rate of connection.
f or mat Connection format.
Retur n Values
Value Description
HAYES_OK Successful execution.
E_OPEN open() command unsuccessful.
E_ FW_READ_CMD Firmware error; initial read() failed.
E_ FW_TI MEOUT Firmware error; too long to execute.
E_ FW_STATUS Firmware error; Hayes response status.
E_ FW_ONLY_ CR Firmware error; modem opened; Hayes response received during
firmware open was single carriage return character, <CR>.
E_WRI TE_BLK Failure to write port setup with MDM_WRITE_BLK().
NOTE The modem device remains inactive until a call is made to initialize the
parameters such as baud rate, format, and so on. See the
xmdm_set _pr ot ocol ( ) function. If pat h is null or empty, then the device
MDM_PORT is opened.
F UNCTION C A L L S
xm dm _o pe n( )
F UNCTION C A LL S
xm dm _o ut pu t_ pe nd in g()
xmdm_output_pending()
Parameters
h_ modem Opened modem device handle.
Retur n Values
Success: SUCCESS: No output pending.
F UNCTION C A L L S
xm dm _re ce iv e_ da ta()
xmdm_receive_data()
Waits until a specified incoming data, with maximum positive number of bytes
from the modem port or a pause in reception, or a timeout expires on a first come
first basis. If there are more data pending than specified, it will be ignored.
Parameters
h_ modem Handle to the modem comport.
buf f er Pointer to receive buffer.
mi n Not used in the library. Maintained for backward compatibility.
max Maximum number of characters to receive. Must be greater than zero.
max_ wai t Maximum receive time in 10-ms increments.
Return Values
Success: > 0: Number of bytes read
F UNCTION C A LL S
xm dm _sen d_da ta ()
xmdm_send_data()
Parameters
h_ modem Opened modem device handle.
buf f er Data to send to modem.
buf f _ l en Buffer length.
max_ wai t Maximum transmit time in 10-ms increments.
NOTE If max_ wai t is zero (0), the routine makes a single attempt to transfer data to the
modem. If the execution of the data transfer fails, xmdm_send_data() returns
FAILURE.
Retur n Values
Success: > 0: Contains the number of bytes transferred. This value should equal
buf f _ l en on successful transfer. Since the output is buffered by the
modem device and sent at a controlled rate, the output is pending at the
time this function returns. To determine if all buffered output was sent, call
xmdm_checkline() until a value of zero returns.
Failure: FAILURE: Error writing to modem port.
E_NOCARR IER: Carrier lost while trying to send data.
E_PARTIAL: Sent only part of buffer. Check errno for the number of bytes
sent.
E_STATUS_CMD: Unable to obtain modem status when sending buffers
larger than 200 bytes.
F UNCTION C A L L S
xm dm _set _a ttri b()
xmdm_set_attrib()
Parameters
h_ modem Opened modem device handle.
Return Values
Success: SUCCESS: Successful update of attribute.
NOTE
Each attribute has a corresponding identification number. Attributes can be
specific to a particular protocol. These values are from XMODEM.H.
F UNCTION C A LL S
xm dm _set _p rot oc ol()
xmdm_set_protocol()
NOTE The library supports a structure definition for each type of protocol. The
programmer should load the appropriate structure with the intended attributes for
the desired protocol. xmdm_s et _pr ot ocol ( ) initializes the modem with this
information.
Parameters
h_ modem Modem device handle.
rate Rate of connection.
f or mat Connection format. Any parameter that is passed to the f or mat variable,
Fmt _AFC and Fmt _ DTR gets appended which is a default setting for open
block format.
Retur n Values
F UNCTION C A L L S
Re po rt Form at te r Func tion Call s
Report This section describes the following report formatter function calls:
Formatter
• formater_close() • formater_open()
Function Calls
• formater_line() • formater_template()
• formater_main() • formater_set_flags()
Example Generates the . FRMfile using the FORMCVT tool. A sample text file for
generating the . FRMfile as follows.
1: 1, "I TP Test Repor t "
3: 1. 30, " \ C\ DVALUECARD"
4: 1. 40, \ C\ D" SPOT \ W\ HREPORT\ B"
6: 1, " \ NTERM I D"; 14, "DATE" ; 24, " TI ME" ; 32, " BONUS" ; 38, " ART"
7: 1. 10, \ L\ Dt erm_i d; 14. 21, date; 24. 28, v_t i me; 32. 32, bonus; 34, "WORK\ B"
9: 1, " TOTAL" ; 19, " TOTAL"
10: 3, "I NT = $"; 10. 16, i nt _t t l ; 21, "CUM = $"; 28. 34, cum_t t l
12: 1, "BI LL"; 19, "BI LL"
13: 3, "I NT = $"; 10. 16, i nt _bi l ; 21, "CUM = $"; 28. 34, cum_bi l
15: 1, " CREDI T CARD" ; 19, " CREDI T CARD"
16: 3, "I NT = $"; 10. 20, i nt _cr d; 21, "CUM = $"; 28. 34, cum_cr d
20: 1, "SUBJ ECT TO"; 19, "S____ ____ ___ ____ ___ _"
21: 1, " \ D\ W\ HLATER AUDI T\ B" ;
22: 10. 30, \ Ni nt _crd
23: 1, "\ N\ Dt est val ue: "; 25. 28, t est ; 30. 39, \ Cname
25: 1. 12, \ L\ Dt er m_i d; 13. 26, \ Bt er m_i d; 27. 40, \ Ct er m_i d
27: 1. 12, \ Lt er m_i d; 13. 18, \ Lt er m_i d; 27. 40, \ Rt er m_i d
29: 1. 12, \ L i nt _ t t l ; 13. 26, i nt _ t t l ; 27. 40, \ Cv_ t i me
31: 3. 23, "st r i ng const ant "; 24, "t est "; 30. 39, "on l ef t "
33: 2. 14, \ D\ Wt est ; 16. 20, \ B\ Ht est
35: 2. 14, \ N\ Ct est ; 16. 23, \ Ltest; 30. 39, t est
37: 2. 14, \ Cbonus; 16. 23, \ Lbonus; 30. 39, bonus
39&x80000000: 1, " Condi t i on l i ne x80000000"
39&x40000002: 1, " Condi t i on l i ne x40000002"
39&x1: 1, " Condi t i on l i ne x00000001"
41: 1, " That ' s al l f ol ks . . . "
F UNCTION C A LL S
form ater _c lo se()
formater_close()
Parameters
f or mdat a Pointer to a FORMATER structure.
F UNCTION C A L L S
fo rm at er_l in e()
formater_line()
NOTE The following special printing modes are not handled by this function. They are
processed by the output driver.
• Print red
• Restore print color to black
• Print double width
• Print double height
• Restore to normal print mode
• Send initialization command to printer
If a string constant or variable has a length longer than the column range specified
in the template file, it is truncated to fit the specified range. The default for
formatting a string constant is left justification; the default for formatting a variable
is right justification.
When formatting a range of line numbers, problems may occur with system buffer
usage. In this case, f or mat er _l i ne( ) returns -1 and stores the next line
number to format in er r or _ l i ne. Using the contents of er r or _ l i ne, these
types of errors can be processed.
Parameters
f or mdat a Pointer to a FORMATER structure.
s t ar t _ l i ne Starting line number. If the line is not defined in the template
and pr i nt _ bl ank_ l i nes is non-zero, blank lines print until
the line number in the template is reached.
s t op_ l i ne Last line number to print. If this value is TO_ END (-1), the
template is processed through to the last line.
pr i nt _ bl ank_ l i nes If zero, print undefined lines as blank lines; otherwise, ignore
undefined lines.
c ondi t i on Value ANDed with the condition in each template record. If the
result is not 0, the line prints; otherwise it is ignored.
F UNCTION C A LL S
form at er_m ai n()
Retur n Values
Success: 0
Failure: -1: An error condition. er r or _ l i ne is set to indicate where to resume, and
errno may have been set by out put _pr i nt ( ) .
Example whi l e (f or mat er _l i ne (f or mat dat a, st ar t _l i ne, TO_END, pr i nt _bl ank_l i nes,
condi t i on, er r or _l i ne) ! = 0)
s t ar t _ l i ne = * er r or _ l i ne;
formater_main()
NOTE
Call f or mat er _mai n( ) before using any other function.
Parameters
g_dat a gvar dat a Structure holding application-specific information required by the
formatter.
F UNCTION C A L L S
fo rm ater _o pe n()
formater_open()
NOTE
The output initialization function fills in the FORMATER structure with pointers to
the output drivers print and close functions.
Parameters
handl e Handle of an open communications device.
f or mdat a Pointer to a FORMATER structure which is filled in by the
f or mat er _open( ) function and used when calling other
formatter functions.
t empl at e Name of the template file.
* out put _ i ni t i al i z er Pointer to a function that initializes the output driver, (for
example, p150di r ).
t i me_out Time-out value used when initializing an output device. The
initialized output can elect to ignore this parameter.
Return Values
Success: 0
Failure: -1: Template file cannot be opened.
F UNCTION C A LL S
form ater _set _fla gs()
formater_set_flags()
Builds the condition flag from user application-specific variables. It sets a 32-bit
unsigned long bitmap flag to be used by the formatter to format any conditional
lines of the report template.
NOTE
-1 always terminates the parameter list.
Parameters
va_ al i s t Either 0 or non-zero; maximum of 32 (values > 32 shifts bits off the end).
NOTE • The first value passed as the parameter to the function will be ignored, for example:
1,0,1,0,1,0 will be treated as 0,1,0,1,0.
• All bits are right justified in the return value by position.
formater_template()
Parameters
f or mdat a Pointer to a FORMATER structure.
t empl at e Name of the template file.
Retur n Values
Success: 0
F UNCTION C A L L S
Da ta ba se Li brary Fu nc ti on Ca lls
Database This section provides descriptions of the following database library function calls:
Library
• db_close() • db_remove()
Function Calls
• db_delete() • db_seek_key()
• db_get_key() • db_seek_record()
• db_open() • db_write()
• db_read()
Database Library The following linked files illustrate the use of the function calls provided by the
Examples Database library, with examples.
db_close()
Parameters
db_pt r Pointer to the database file structure.
Return Values
Success: Positive: Successful operation.
F UNCTION C A LL S
db_delete()
db_delete()
Deletes one or more records from the database and index files.
NOTE
The delete operation slows the application down, so the offsets can be updated.
If the start record plus the number of records to delete is greater than the actual
number of records in the file, all records in the file starting from the specified
record number are deleted. There is no error message. The argument r ec_cnt
includes the start record number (r ec_num). If r ec_num= 1 and r ec_cnt = 0,
no record is deleted and 0 is returned.
Parameters
db_pt r Pointer to database file structure.
r ec_num The record number to start deleting from.
Retur n Values
Success: Positive ( Successful operation. The number returned indicates the
number of records deleted.
F UNCTION C A L L S
db_get_key()
db_get_key()
Parameters
db_pt r Pointer to the database file structure.
key_st r uct The buffer to contain the key structure.
Mat chst r See Match Structure.
ac t i on Find criteria. Valid values are:
• DB_FIRST: Start from the beginning of file and search forward to find
the first key match.
• DB_LAST: Start from the end of file and search backward to find the
first key match.
• DB_PREVIOUS: Find the previous key from the present position.
• DB_NEXT: Find the next key from the present position.
• n: nth occurrence of the key relative to the current position. If n > 0,
then search forward.
dat abuf Pointer to the data buffer.
dl en Length of the data record.
r ec_num Address of the r ec_numthat is updated when a successful comparison
occurs.
This structure must be created by the programmer. The first element in this
structure must be a pointer to a compare function written by the programmer. The
other elements of the key structure are values to compare against. This
comparison function must return 0 if a match occurs. When db_seek_key() calls
the comparison function, it passes the address of the key_st r uct buffer (this
buffer contains the key structure read by the Database library) and the Match
structure.
db_get_key() calls db_seek_key() internally to obtain the record number of the
specified database record and reads the record into the data buffer for
subsequent processing.
F UNCTION C A LL S
db_get_key()
NOTE If the function returns a value greater than 0, then the r ec_numand key_st r uct
are updated. If you search for the 5th occurrence but only 1 key exists, then
r ec_numand key_st r uct are updated anyway. In this case, db_seek_key( )
returns 1 and not 5.
The prototype of the compare function is:
s hor t ( * comp_ f unc) ( voi d * , voi d * ) ;
where, the first argument is the key structure and the second argument is the
Match structure.
Retur n Values
Success: 1: The requested number of occurrences were found. (r ec_numand
key_st r are updated).
Failure: 0: No key was found or the requested number of occurrences were not
found.
NOTE The compare function that compares the specified search key to the
corresponding key in the index file record must be provided by the programmer. If
this function is not provided, db_s eek_key( ) and db_get _key( ) fail.
F UNCTION C A L L S
db_open()
db_open()
Creates a database file and the corresponding index file and updates the
database file structure. If a database file is already created, db_open() opens the
existing file.
NOTE • Do not provide a filename extension. This function does not check for a
filename extension. The filename should not be more than
DB_MAX_FI LENAME_SI ZE (= 26) characters.
• In flash, db_open( ) API allows only one file to open in the O_RDWR mode.
• Refer to the Verix eVo OS Programmers Manual for more details about the
restrictions on the usage of flash file.
Parameters
db_pt r Pointer to database file structure.
f i l ename The filename with no extension.
key_l en The length of key structure in bytes.
mode The file creation mode as described in fnctl.h (the standard C/C++ library
include file). Valid values are:
• O_RDWR
• O_EXCL
• O_TRUNC
• O_CREAT
Return Values
Success: Positive: Handle to the index file.
F UNCTION C A LL S
db_read()
NOTE
If the file name is given with an extension, the API adds . dat extension along
with the file name given. For example, t es t . t xt is created as t es t . t xt . dat .
db_read()
Parameters
db_pt r Pointer to the database file structure.
key_st r uct Pointer to the key structure.
dat a_buf Pointer to the data buffer.
dl en Length of the data buffer.
r ec_num Use the following parameters:
• n: Record number to be read.
• DB_CURRENT: Reads current record; does not move file pointer.
• DB_FORWARD: Reads current record and moves file pointer to the next
record.
• DB_BACKWARD: Reads previous record and leaves file pointer in front
of the record that was read.
Retur n Values
Positive: Positive: Number of bytes read.
F UNCTION C A L L S
db_remove()
db_remove()
NOTE Do not provide a filename extension. This function does not check for a filename
extension. The filename should not be more than DB_MAX_ FI LENAME_SI ZE (= 26)
characters.
Parameters
f i l ename Name of the file to remove.
Return Values
Success: 0: File successfully removed.
F UNCTION C A LL S
db_seek_key()
db_seek_key()
Searches the index file records for the specified key value. The key value can be
an element of a structure or a text string.
Parameters
db_pt r Pointer to the database file structure.
key_st r uct Pointer to the key structure.
Mat chst r This structure must be created by the programmer. The first element in
this structure must be a pointer to a compare function written by the
programmer. See db_get_key() for details.
ac t i on Find criteria, as follows:
• DB_FI RST: Start from the beginning of file and search forward to find
the first key match.
• DB_LAST: Start from the end of file and search backward to find the
first key match.
• DB_PREVI OUS: Find the previous key from the present position.
• DB_NEXT: Find the next key from the present position.
• n: nth occurrence of the key relative to the current position.
If n>0, search forward.
r ec_num Address of the record number that updates when the key is found.
Retur n Values
Success: Positive (>0): The key was found specified number of times. r ec_num
is updated with the last record number found.
NOTE If the function returns a value greater than 0 (zero), then r ec_numand
key_st r uct are updated. Searching for a 5th occurrence of a key when there is
only one occurrence still updates r ec_numand key_st r uct . In this case,
db_seek_key( ) returns 1 and not 5.
db_r ead( ) must be called to get the entire key and data structure.
The first element of the Match structure must be initialized to the compare
function. The prototype of the compare function is:
shor t ( *comp_f unc) ( voi d *, voi d *)
where, the first argument is the key structure and the second argument is the
Match structure.
F UNCTION C A L L S
db_seek_record()
db_seek_record()
Searches for a specified record in an index file and modifies the file pointer
position accordingly.
NOTE
db_s eek_r ecor d( ) takes record number as a zero-based index.
Parameters
db_pt r Pointer to the database file structure.
r ec_num Number of the record to seek, relative to the origin.
NOTE • While searching the records backwards, the r ec_numvariable should be specified with
a negative sign. If the negative value of r ec_num is greater than the number of records
or greater than the records from the nth position, then the db_s eek_r ecor d fails.
• While searching the records, the starting file value, SEEK_SET variable cannot have a
negative value.
Return Values
Success: Positive: Record number in the database file.
F UNCTION C A LL S
db_write()
db_write()
Parameters
db_pt r Pointer to the database file structure.
key_st r uct Pointer to the key structure.
dat a_buf Pointer to the data buffer.
dat a_l en Data length.
r ec_num File entry index or pointer. Valid values are:
• DB_APPEND: Writes to end of file.
• DB_CURRENT: Writes to current file position; does not advance file
pointer.
• DB_FORWARD: Writes to current file position and advances the file
pointer.
• DB_BACKWARD: Overwrites the previous record. File pointer is placed
in front of written record.
Retur n Values
Success: Positive: Number of bytes written.
NOTE
If a record exists at the current file pointer position, it is overwritten.
Printing This feature enables printing of monochrome bitmaps independent of the printers
Monochrome used in Verix eVo terminals.
Bitmap
print_image()
F UNCTION C A L L S
pr int_ im ag e( )
parameters
of f s et 0-60.
Note: If the value is less than 0, then 0 is taken as the offset
value.
If the value is greater than 60, then 60 is taken as the
offset value.
Retur n Values
Success 1
F UNCTION C A LL S
Print Pak 3700 Function Calls
Prin t Pak 3700 Each of the stand-alone driver functions can be called directly by the application.
Function Calls Each function includes a parameter that specifies the opened port handle. This
handle is an identifier generated by the operating system when the port is opened.
The application is responsible for both opening the opened port to obtain the
handle and closing the opened port after print operations complete.
This section provides descriptions of the following Print Pak 3700 driver function
calls:
• p3700_close() • p3700_mode()
• p3700_dnld_char() • p3700_print()
• p3700_dnld_font_file() • p3700_print_graphic()
• p3700_dnld_graphic_file() • p3700_select_font()
• p3700_id() • p3700_sel_tbl_dnld_char()
• p3700_init() • p3700_status()
NOTE
Print Pak 3700 function calls are supported in Vx680 and Vx520 terminals.
p3700_close()
Waits for all pending data to transmit to the printer, then returns.
CAUTION
p3700_close() performs a device-level close operation.
Parameters
h_comm_por t Handle for the opened communication port.
Retur n Values
Success: 0: No error.
F UNCTION C A L L S
p3 70 0_ dn ld _c ha r()
p3700_dnld_char()
Transmits a single character to the printer. The first byte in the passed buffer must
be the character to replace, followed by either 14 bytes (8 x 14 font), 32 bytes (16
x 16 font), or any other font size supported by the printer. These bytes represent
the bitmap for the new font character.
Parameters
h_comm_por t Handle for the opened communication port.
r d_buf Buffer containing the bytes to download to the printer.
wr i t e_bytes Number of characters to download (including the char to replace). For
example, an 8 x 14 font requires 15 bytes.
Return Values
0: No error.
F UNCTION C A LL S
p3 70 0_ dn ld_f on t_ fi le()
p3700_dnld_font_file()
Downloads a font file set to the printer. The font file is composed of an 8-byte
header record. The definition of this record is as follows:
• 1: (N) p3700 printer ID code
• 2: ESC
• 3: l (lower-case L)
• 4: font_size
• 5: font_table
• 6 & 7: number of bytes per character (for example, for a 16 x 16 font, bytes 6
and 7 are 0x00 and 0x20).
• 8: number of characters to download
Following the header record is a series of font images that compose each new
font character. The first byte in the font image is the ASCII character to replace in
the selected font table. The remaining bytes in the font image are the bytes that
form the new font character.
Prototype #i ncl ude <pr i nt er. h>
shor t p3700_dnl d_f ont _f i l e( shor t handl e, shor t h_f ont _f i l e,
s hor t f ont _ t abl e) ;
Parameters
handl e Handle for the opened communication port.
h_ f ont _ f i l e Handle for the font file.
f ont _ t abl e Font table to select.
Retur n Values
Success: > 0: Number of font characters downloaded.
NOTE • Verix eVo ACT printer library checks for the cancel key operation during the
download of graphic file and font file to the printer.
• If the DISABLECANKEYF conf i g. sys entry is set to 1, then Verix eVo ACT
library ignores the cancel key pressed during the font file download.
• If the DISABLECANKEYF conf i g. sys entry is set to 0 or any other value, or
not found, then Verix eVo ACT library checks for the cancel key press and
aborts the font file download if the cancel key is pressed.
F UNCTION C A L L S
p3 70 0_ dn ld _gra ph ic _f il e()
p3700_dnld_graphic_file()
Downloads a graphic logo file to the printer. The graphic file is composed of a
16-byte header record. The definition of this record is:
• 1: “N” (printer ID code of P3700)
• 2: ESC
• 3: “G”
• 4: “M”
• 5: Image format (ASCII)
• 6: “,”
• 7: Reserved (“0”) Image ID (ASCII)
• 8: “,”
• 9, 10, 11: Image Width (ASCII) (for example, the image width is “240” for a 240
column image).
• 12: “,”
• 13,14,15: Image height (ASCII) (for example, the image height is “120” for a
120 column height image).
• 16: “;”
Parameters
h_comm_por t Handle for the opened communication port.
h_ gr a phi c _ f i l e Handle for the graphic file.
Return Values
Success: 0: No error.
NOTE • Verix eVo ACT printer library checks for the cancel key operation during the
download of graphic file and font file to the printer.
• If the DISABLECANKEYG conf i g. sys entry is set to 1, then Verix eVo ACT
library ignores the cancel key pressed during the graphic file download.
• If the DISABLECANKEYG conf i g. sys entry is set to 0 or any other value, or
not found, then Verix eVo ACT library checks for the cancel key press and
aborts the graphic file download if the cancel key is pressed.
F UNCTION C A LL S
p3 70 0_ id()
p3700_id()
Sends the <ESC>i command (request printer ID) to the ITP, and waits for a
response. If the ITP responds within the time-out period, the ID is compared to the
valid ID for an ITP.
Parameters
h_comm_por t Handle to the opened communications port.
i d_t i me_out Time-out period, in increments of approximately 500 ms.
Retur n Values
Success: 0: No errors detected.
F UNCTION C A L L S
p3 70 0_ in it ()
p3700_init()
Parameters
h_comm_por t Handle for the opened communication port.
t i me_out Time out, in 1-sec increments.
Return Values
Success: 0: No errors detected.
F UNCTION C A LL S
p3 70 0_mo de ()
p3700_mode()
Parameters
mode Special print character.
buf Pointer to the print buffer.
Retur n Values
Success: 0: No errors detected.
p3700_print()
Parameters
h_comm_por t Handle to the opened communications port.
buf Pointer to the string to print (maximum 1000 bytes).
Retur n Values
Failure: < 0: Port write error.
F UNCTION C A L L S
p3 70 0_ pr int_ grap hi c()
p3700_print_graphic()
Parameters
h_comm_por t Handle for the opened communication port.
i mageI d The index of the image ID must be 0.
of f s et The left margin for the image.
Return Values
Success: > 0: No error.
p3700_select_font()
Parameters
h_comm_por t Handle for the opened communication port.
f ont _ s i z e Size of the font.
f ont _ t abl e Font table to select.
Return Values
Success: > 0: No error.
F UNCTION C A LL S
p3 70 0_ sel_ tb l_ dn ld _c ha r()
p3700_sel_tbl_dnld_char()
Selects the font table, then downloads a single font character to the printer.
Parameters
h_comm_por t Handle for the opened communication port.
f ont _buf Buffer containing the bytes to download to the printer.
f ont _ t abl e Font table to select.
f ont _ s i z e Size of the font (valid values determined by printer).
f ont _bytes Number of characters to download (including the char to replace). For
example, an 8 x 14 font requires 15 bytes.
Retur n Values
Success: 0: No error.
F UNCTION C A L L S
p3 70 0_ stat us()
p3700_status()
Sends the <ESC>d command to the ITP and waits for it to respond with its status
byte. The time-out value is specified in increments of 1000 ms (1 second).
Specifying a time-out value of 6 allows the printer approximately 6 seconds to
respond.
Parameters
h_comm_por t Handle to the opened communications port.
st at_ t i me_out Time-out period, in increments of approximately 500 ms.
Return Values
Success: 0: No error.
A PPENDIX A
Example Programs
E XAMPLE P ROGRAMS
EXFI ELD. C
EXFIELD.C / *************************************************
* Appl i cat i on: EXFI ELD
* Rel ease Dat e: 7/ 12/ 99
* Ver si on: 1. 0
*
* Pur pose: Demonst r at es usage of Veri x eVo ACT Li br ar y f unct i ons:
* f i el dcnt , f i el df i x , f i el dr ay and f i el dvar
* Ot her ACL f unct i ons used :
* pr ompt , get _char , vi ew_buf f er , di spl ay
* Descr i pt i on: EXFI ELD di spl ays t he pr ompt ACL FI ELD
* FUNCS
* I t t hen di spl ays t he pr ompt FI ELDCNT EXAMPLE.
* The buf f er used as i nput t o t he f l d_cnt ( ) f unct i ons i s
* di spl ayed. The user may scr ol l t hr ough t he buf f er usi ng
* t he # and keys.
* Keys CLEAR or ENTER t er mi nat e t he di spl ay. Next each
* f i el d i n t he buf f er i s di s pl ayed.
* Next , t he pr ompt FI ELDFI X i s di spl ayed. The buf f er
* used as i nput t o t he f l d_f i x( ) f uncti on i s di spl ayed
* f or r evi ew , f ol l owed by each f i el d i n t he buf f er .
* EXFI ELD t hen di spl ays t he FI ELDRAY EXAMPLE pr ompt . The
* buf f er used as i nput t o t he f l d_r ay( ) f uncti on i s
* di spl ayed f or r evi ew , f ol l owed by each f i el d i n t he
* buf f er .
* EXAMPLE OF VARI ABLE FI ELDS DELI MI TED BY SPACES.
* Last l y , t he FI ELDVAR EXAMPLE pr ompt i s di spl ayed. The
* buf f er used as i nput t o t he f l d_var ( ) f uncti on i s
* di spl ayed f or r evi ew, f ol l owed by each f i el d i n t he
* buf f er , EXAMPLE OF VARI BALE FI ELDS DELI MI TED BY SPACES
*
****************************************************/
#i ncl ude <acl coni o. h>
#i ncl ude <acl st r . h>
#i ncl ude <st r i ng. h>
#i ncl ude <svc. h>
EXAMPLE P ROGRAMS
EXFIEL D. C
i nt i , j ;
/ * f i el df i x( ) exampl e :
* Show f i xed f i el ds of l engt hs 1 t hr ough 5 f r om f l d_f i x
* buf f er .
* Of f set s t o st ar t f i el d at ar e based on t he r et ur n val ue
* ( f i el d s i z e ) f r om t he pr evi ous f i el df i x( ) cal l * /
/ * f i el dr ay( ) exampl e :
* Show r ay f i el ds, each ter mi nated by space, f r om
* exampl e Of f set s to st art f i el d at ar e based on t he
* r et ur n val ue ( f i el d s i z e) f r o m t he pr e vi ous f i el df i x( )
* cal l * /
E XAMPLE P ROGRAMS
EXFI ELD. C
/ * f i el dvar ( ) exampl e :
* Show var i abl e f i el ds 1 t hr ough 5 i n exampl e1 buf f er .
* Each f i el d i s t ermi nated by space.
*/
EXAMPLE P ROGRAMS
EXT MOUT.C
EXTMOUT.C / *******************************************
* Appl i cat i on: EXTMOUT
* Rel ease Dat e: 07/ 12/ 99
* Ver si on: 1. 0
* Pur pose: Demonst r at es usage of Ver i x eVo ACT Li br ary f unct i ons:
* set _i t i meout and CHK_TI MEOUT
* Ot her ACL f unct i ons used - di spl ay and di spl ay_at
*
* Descr i pt i on: EXTMOUT def i nes 11 t i meout s r angi ng f r om 1
* second t o 3 mi nut es f r omcur r ent t i me.
* Each t i meout cont r ol s what i s di spl ayed at a
* cor r espondi ng di spl ay posi t i on.
* EXTMOUT di spl ays a "t wi nkl i ng" char act er i n each of t he
* 16 di spl ay posi t i ons.
* As each t i meout expi r es , EXTMOUT di spl ays t he
* cor r espondi ng l ett er f r oma pr ogr ammessage i n t he
* di spl ay posi t i on assi gned t o t he t i meout .
****************************************************/
char t w_char s[ ] = { ' | ' , ' / ' , ' - ' , ' \ \ ' , ' | ' , ' / ' , ' - ' , ' \ \ ' };
char end_pr ompt [ ] = { " END TI MER DEMO" };
char t emp[ 2] ;
E XAMPLE P ROGRAMS
EXTM OU T.C
mor e = 1;
t w_i ndex =0;
whi l e( mor e)
{
mor e = 0;
gotoxy( 1, 1) ;
EXAMPLE P ROGRAMS
EXTRANS. C
EXTRANS.C / ****************************************************
* Appl i cat i on: EXTRANS
* Rel ease Dat e: 07/ 12/ 99
* Ver si on: 1. 0
* Pur pose: Demonst r at es usage of Ver i x eVo ACT Li br ary f unct i ons:
* append_char , r ange, sput f , st r 2l ong, di spl ay,
* ERR_BEEP, get kbd_ent r y, KBHI T, keyi n_amt _r ange,
* NORM_BEEP pr ompt _at , vi ew_buf f er , chk_car d_r dr ,
* car d_par se , MEMCLR
* Descr i pt i on: EXTRANS pr ompt s f or an account and wai t s
* f or ei t her a car d swi pe or keyboar d i nput .
* I f keyboar d i nput , EXTRANS r eads t he account and t hen
* prompt s f or and r eads an expi r at i on date. I f car d i nput
* , EXTRANS reads t he car d and par ses t hi s car d
* i nf ormati on. Af t er t he account i s r ead , EXTRANS
* prompt s f or an amount . I t t hen val i dat es bot h t he
* account t he expi r at i on dat e. Account i s val i dated based
* on r ange dat a i n conf i g. sys and must be bet ween
*1000- 5999
* Expi r ati on data i s val i dat ed based on the cur r ent Opsys
* dat e. I f an er r or i s f ound, an appr opr i at e message i s
* di spl ayed. The user may scr ol l t hr ough i t ( usi ng # and * keys ) and exi t
t he di spl ay t hr ough t he Cl ear or Ent er
* keys.
**************************************************/
struct
{
i nt t ype;
st r uct TRACK car d_i nf o;
char r ange_dat a[ 12] ;
char amount [ 15] ;
}i nput ;
E XAMPLE P ROGRAMS
EXTR ANS. C
wi ndow( 1, 1, 16, 1) ;
h_c ar d = open( DEV_CARD, 0) ;
h_cl ock = open( DEV_CLOCK, 0) ;
consol e = open( DEV_CONSOLE, 0) ;
f or( i =0; i <=2; ++i )
p_pr ompt s[ i ] = messages[ i ] ;
whi l e( 1)
{
cl r s cr ( ) ;
di spl ay_at ( 1, 1, p_prompt s[ 0] , CLR_EOL) ;
di spl ay_at ( 1, 2, p_prompt s[ 1] , CLR_EOL) ;
di spl ay_at ( 1, 3, p_prompt s[ 2] , CLR_EOL) ;
ch = get _char ( ) ;
Adj ust Val ue( &ch) ;
i f ( ch == ' 1' )
{
/ * Cont i nue sel ect i on wai t f or ei t her car d swi pe or keyboar d ent r y*/
r _par m. st ar t = 1;
err f l ag = 0;
MEMCLR( &i nput , si zeof ( i nput ) ) ;
cl r s cr ( ) ;
di spl ay_at ( 1, 1, " ACCOUNT ?" , CLR_EOL) ;
whi l e(! chk_car d_r dr ( h_card) &&! KBHI T() ) ;
330 VERIX EVO ACT PROGRAMMERS GUIDE
EXAMPLE P ROGRAMS
EXTRANS. C
i f ( er r f l ag >= 0)
{
cl r s cr ( ) ;
di spl ay_at ( 1, 1, " AMOUNT?" , CLR_EOL) ;
keyi n_amt _r ange( i nput . amount , RDXPSEPC, 99999999L, 100L, 2) ;
/ * Veri f y expi r ati on date and account r ange */
i f ( er r f l ag < 0)
{
s wi t c h( er r f l ag)
{
case( - 2) :
di spl ay( "\ f DATE") ;
br eak;
case( - 3) :
di spl ay( "\ f ACCT") ;
br eak;
def aul t :
di s pl ay( " \ f I NPUT" ) ;
br eak;
}
E XAMPLE P ROGRAMS
EXTR ANS. C
ERR_BEEP( ) ;
pr ompt _at ( h_cl ock, 7, 1, " ERROR" , 1000, NO_CLEAR) ;
}
i f ( er r f l ag ! = - 1)
{
MEMCLR( buf f , si zeof ( buf f ) ) ;
i f ( i nput . t ype == 0)
st r cpy(buf f , "KEY I NPUT: ") ;
el s e
spr i nt f ( buf f , "TRACK %d I NPUT: ", i nput . t ype) ;
st r cat ( buf f , " ACCT=") ;
s t r c at ( buf f , i nput . c ar d_ i nf o. ac ct ) ;
st r cat ( buf f , " EXP DATE=") ;
NORM_BEEP( ) ;
vi ew_buf f er ( buf f , 1, KM_CR | KM_ESC) ;
}
}
el s e
i f ( ch == KEY_CANCEL)
br eak;
}
di spl ay( "\ f END EXAMPLE" ) ;
r etur n 1;
}
EXAMPLE P ROGRAMS
EXTRANS. C
r et_ val =
getkbd_ent r y(h_cl ock, NULL, i nput . car d_i nf o. acct , 0, NUMERI C, szKeyMap, si zeof (
szKeyMap) , 16, 1) ;
i f ( 0 < r et _ val )
{
/ * Get expi r ati on dat e - must be 4 numeri c charact ers. */
/ * Si mpl e expi r at i on dat e val i dat i on. Expi r at i on dat e must be val i d and of
f or m yymm. */
E XAMPLE P ROGRAMS
Da ta Capt ure Engi ne Ex am ple Pro gr am
Engine 1. DCE_PUTCFG_C( )
Example 2. DCE_GETCFG_C( )
Program 3. DCE_PUTCFG_S( )
4. DCE_GETCFG_S( )
5. dce_key_cvt ( )
*/
c = ' A' ;
/ / Add CONFI G. SYS key DCE- 1 wi t h val ue ’ A’
r t n_val = DCE_PUTCFG_C( " DCE- 1", set _val ) ;
i f ( r t n_ val ! = 1)
pr i nt f ( "WRI TE - FAI L %d\ n", r t n_val ) ;
el s e
pr i nt f ( "DCE- 1 = %c (CHAR) \ n", *set _val . c_val ) ;
get_char();
EXAMPLE P ROGRAMS
Da ta Capt ure Engi ne Ex ampl e Progr am
E XAMPLE P ROGRAMS
Mo de m Engi ne Exam pl e Pro gram
Example
Program 1. UnComment t he cal l MdmCal Test ( ) and comment t he cal l MdmRecTest ( ) i n
mai n( )
2. Change t he phone number t o t he appr opr i at e number t o whi ch t he host
t ermi nal wi l l be connect ed and bui l d t he workspace
3. Downl oad t he out put f i l e (. out ) t o one ter mi nal . Thi s act s as t he
cal l er
4. UnComment t he cal l MdmRecTest ( ) and comment t he cal l MdmCal Test ( ) i n
mai n( ) and bui l d t he wor kspace
5. Downl oad the out put f i l e (. out ) t o t he second t er mi nal . Thi s acts as
t he host . */
#i ncl ude <st dl i b. h>
#i ncl ude <st r i ng. h>
#i ncl ude <st di o. h>
#i ncl ude <acl coni o. h>
#i ncl ude <svc. h>
#i ncl ude <xmodem. h>
EXAMPLE P ROGRAMS
Mo de m Engi ne Ex ampl e Pro gram
el s e
{
msg_wai t ( "\ f *ZP I S BAD. FI X. " ) ;
st r cpy( sz_phonebuf f , "\ 0") ;
}
s zpt r [ 5] =' \ 0' ;
sz_phonebuf f [ 5] = ' \ 0' ;
i f ( szpt r ! = NULL)
return (0);
return (-1);
}
E XAMPLE P ROGRAMS
Mo de m Engi ne Exam pl e Pro gram
}
SVC_WAI T( 1000) ;
/ / di sconnect
r et Val = xmdm_hangup( handl e, - 1, 0) ;
s pr i nt f ( t es t , " di s connec t , %d" , r et Val ) ;
wr i t e_ at ( t es t , 13, 1, 5) ;
voi d MdmRecTest ( )
{
i nt r et Val ;
i nt handl e = - 1;
char dl St r [ 20] ;
char dat aTx[ 10] ;
char dat aRx[ 10] ;
i nt i ;
char t est [ 20] ;
EXAMPLE P ROGRAMS
Mo de m Engi ne Ex ampl e Pro gram
wr i t e_ at ( t es t , 11, 1, 4) ;
do {
r etVal = xhayes_r esponse( handl e, - 1, 0) ;
spr i nt f ( t est , "Resp %d", r et Val ) ;
wr i t e _at ( t e st , ( s hor t ) s t r l en( t es t ) , 1, 5) ;
} whi l e ( r et Val ! = CONNECT_1200) ;
E XAMPLE P ROGRAMS
Re po rt Format te r Ex am pl e Pro gram
#i f ndef G_C
#def i ne G_C 1
#def i ne G_S 2
#def i ne G_I 3
#def i ne G_L 4
t ypedef st r uct
{
voi d *addr ;
i nt t ype;
}g_dat a;
#endi f
EXAMPLE P ROGRAMS
Re po rt Form at te r Ex am ple Progr am
FORMATER p3300;
E XAMPLE P ROGRAMS
Re po rt Format te r Ex am pl e Pro gram
condi t i on = 0L;
st art = 1;
pr i nt f ( " Pr i nt i ng. . . \ n" ) ;
whi l e( f or mat er _l i ne( &p3300, st ar t , TO_END, 1, condi t i on, &er r l i ne) < 0 )
{
pr i nt f ( t empBuf f , " Pr i nt er e r r : %d" , i ) ;
s t a r t = er r l i ne;
}
pr i nt f ( " Cl os i ng Pr i nt er \ n" ) ;
f ormat er _cl ose( &p3300) ;
pr i nt f ( "\ nFor mat t er End\ n") ;
}
EXAMPLE P ROGRAMS
P3700 Example Program
P3700 Example This example program demonstrates the use of all P3700 printer functions. Return
Program values from the called functions are not generally processed as this is for
demonstration purposes only. VeriFone strongly recommends that you process
the return values in your application using this library.
#i ncl ude <svc. h>
#i ncl ude <st di o. h>
#i ncl ude <st r i ng. h>
#i ncl ude <pr i nt er. h>
E XAMPLE P ROGRAMS
P3700 Example Program
/ / pr i nt er i n NORMAl f ont
memset ( pr i nt Buf , 0, si zeof ( pr i nt Buf ) ) ;
pr i nt Buf [ 0] = PRI NT_NORM;
st r cpy( ( char *) &pr i nt Buf [ 1] , ( const char *) " \ n\ nNORMAL PRI NT\ n\ n") ;
r et Val = p3700_pr i nt ( handl e, pr i nt Buf ) ;
/ / Pr i nt i n Doubl e Hei ght
memset ( pr i nt Buf , 0, si zeof ( pr i nt Buf ) ) ;
pr i nt Buf [ 0] = DBL_ HEI GHT;
st r cpy( ( char *) &pr i nt Buf [ 1] , ( const char * ) "DOUBLE HEI GHT\ n\ n") ;
r et Val = p3700_pr i nt ( handl e, pr i nt Buf ) ;
/ / pr i nt er i n NORMAl f ont
memset ( pr i nt Buf , 0, si zeof ( pr i nt Buf ) ) ;
pr i nt Buf [ 0] = PRI NT_NORM;
st r cpy( ( char *) &pr i nt Buf [ 1] , ( const char *) "NORMAL PRI NT\ n\ n") ;
EXAMPLE P ROGRAMS
P3700 Example Program
/ / Pr i nt i n Doubl e Wi dt h
memset ( pr i nt Buf , 0, si zeof ( pr i nt Buf ) ) ;
pr i nt Buf [ 0] = DBL_ WI DTH;
st r cpy( ( char * ) &pr i nt Buf [ 1] , ( const char *) "DOUBLE WI DTH\ n\ n") ;
r et Val = p3700_pr i nt ( handl e, pr i nt Buf ) ;
/ / Pr i nt i n I nver s e St yl e
memset ( pr i nt Buf , 0, si zeof ( pr i nt Buf ) ) ;
pr i nt Buf [ 0] = PRI NT_NORM;
pr i nt Buf [ 1] = I NVERSE;
st r cpy(( char *) &pr i nt Buf [ 2] , ( const char *) "I NVERSE PRI NTI NG\ n\ n") ;
r et Val = p3700_pr i nt ( handl e, pr i nt Buf ) ;
E XAMPLE P ROGRAMS
P3700 Example Program
EXAMPLE P ROGRAMS
P3700 Example Program
SVC_WAI T( 1000) ;
r et Val = p3700_cl ose( handl e) ;
wr i t e_at ( ( char *) "Pr i nt er Demo Compl ete", 21, 1, 1) ;
VeriFone Systems
2099 Gateway Place, Suite 600
San Jose, CA, 95110 USA
(800) VeriFone (837-4366)
www.verifone.com