The text of a manual · part 20 of 23
VRC 4000 Software Driver Manual: Appendix E TWDriver Application Programming Interface, pages 171 to 179
Pages 171 to 179 of 206, from VRC 4000 Software Driver Manual
The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Symbol VRC-4000
Page 171
Appendix E TWDriver Application Programming Interface Contents PASCAL & C Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-4 Before Calling the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-6 THE API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-8 The Calibration Data File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-24 Pascal: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-24 'C': . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-24 Calibration Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-26 Touchscreen Type Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-28 Multiple Touchscreens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-29
E-1
Page 172
VRC 4000 Software Driver Manual
E-2
Page 173
Appendix E: TWDriver Application Programming Interface
Introduction TWdriver is a Windows 3.0/3.1 mouse driver. A Windows device driver is actually a dynamic-link library (DLL) that programs call to interact with a piece of hardware. Like all Windows DLL's, functions are exported which Windows application programs can dynamically link to and call. TWdriver is linked with the following .DEF file: LIBRARY MOUSE EXETYPE WINDOWS DESCRIPTION 'TWdriver V3.xx: Touchscreen name' STUB 'WINSTUB.EXE' CODE PRELOAD DISCARDABLE DATA PRELOAD FIXED SINGLE EXPORTS Inquire @1 Enable @2 Disable @3 MouseGetIntVect@4 WEP TWGetInfo TWSetClickTime TWSetSensitivity TWSetStabilisation TWSetButtonMode TWSetButton TWSetTouchOffset TWSetSound TWReadCalibration1 TWReadCalibration2 TWUpdateCalibration TWSendData TWReceiveData
E-3
Page 174
VRC 4000 Software Driver Manual
The first five functions are required by Windows for the mouse interface, the rest are exported mainly for use by TWsetup, although they may also be called by user applications.
PASCAL & C Declarations TWdriver exports 13 API functions, which can be called from high-level language programs, using the normal Windows calling conventions, i.e. Pascal style. The declarations required are as follows:
PASCAL: procedure TWGetInfo(lpTWInfo : LPvoid); far; external 'mouse'; procedure TWSetButtonMode(arg : Word; down1,up1,down2,up2,down3,up3: byte); far; external 'mouse'; procedure TWSetTouchOffset(arg : Byte); far; external 'mouse'; procedure TWSetButton(arg : Byte); far; external 'mouse'; procedure TWSetClickTime(arg : Word); far; external 'mouse'; procedure TWSetSensitivity(arg : Word); far; external 'mouse'; procedure TWSetSound(arg : byte); far; external 'mouse'; procedure TWSetStabilisation(arg : Word); far; external 'mouse'; procedure TWReadCalibration1(lpTWXy : LPvoid); far; external 'mouse'; procedure TWReadCalibration2(lpTWXy : LPvoid); far; external 'mouse'; procedure TWUpdateCalibration(bCalibMode : byte; wX1,wY1,wX2,wY2 : Word; bInvertX,bInvertY : byte); far; external 'mouse';
E-4
Page 175
Appendix E: TWDriver Application Programming Interface procedure TWSendData(lpDataBuff : LPvoid; wDataLength : Word); far; external 'mouse'; procedure TWReceiveData(lpDataBuff : LPvoid; wDataLength : Word); far; external 'mouse';
'C' VOID FAR PASCAL TWGetInfo(LPVOID lpTWInfo); VOID FAR PASCAL TWSetButtonMode(WORD arg, BYTE down1,BYTE up1, BYTE down2,BYTE up2,BYTE down3,BYTE up3); VOID FAR PASCAL TWSetTouchOffset(BYTE arg); VOID FAR PASCAL TWSetButton(BYTE arg); VOID FAR PASCAL TWSetClickTime(WORD arg); VOID FAR PASCAL TWSetSensitivity(WORD arg); VOID FAR PASCAL TWSetSound(BYTE arg); VOID FAR PASCAL TWSetStabilisation(WORD arg); VOID FAR PASCAL TWReadCalibration1(LPVOID lpTWXy); VOID FAR PASCAL TWReadCalibration2(LPVOID lpTWXy); VOID FAR PASCAL TWUpdateCalibration(BYTE bCalibMode, WORD wX1, WORD wY1,WORD wX2,WORD wY2, BYTE bInvertX, BYTE bInvertY); VOID FAR PASCAL TWSendData(LPVOID lpDataBuff, WORD wDataLength); VOID FAR PASCAL TWReceiveData(LPVOID lpDataBuff, WORD wDataLength);
E-5
Page 176
VRC 4000 Software Driver Manual
Before Calling the API Before attempting to call the TWdriver API, your application must determine if TWdriver is loaded. This can be achieved using one of the following functions:
BORLAND TURBO PASCAL for WINDOWS function CheckTWPresent : TFarProc; const Module_Name: PChar = 'MOUSE'; Proc_Name: PChar = 'TWGetInfo'; begin CheckTWPresent := GetProcAddress(GetModuleHandle(Module_Name), Proc_Name); end;
E-6
Page 177
Appendix E: TWDriver Application Programming Interface
MICROSOFT 'C' FARPROC CheckTWPresent() { PSTR Module_Name = “MOUSE”; PSTR Proc_Name = “TWGetInfo”; return (GetProcAddress (GetModuleHandle (Module_Name), Proc_Name)); }
E-7
Page 178
VRC 4000 Software Driver Manual
THE API Function: Syntax:
TWGetInfo TWGetInfo(lpTWInfo)
Description:
This function fills the supplied structure with all the current configuration parameters of TWdriver. Note that the calibration file pathname is an asciiz string and requires conversion for use in Pascal.
Parameter:
lpTWInfo. Far Pointer to a TWInfo structure.
Structure:
PASCAL:
TWInfo = Record VerMajor: VerMinor: Touchscreen:
byte; byte; byte;
CalibFilePath: CalibMode: ComPort: Address: Irq: ClickTime: Sensitivity: ButtonMode: Stabilization: Offset: Button: CalFileOK: AutoInit: TSname: InitStatus EvalVersion: Zsupport:
E-8
{ major version number } { minor version number } { touchscreen number, see ’Touchscreen Type Numbers} array[1..80] of char; { calibration file pathname, Asciiz } byte; { current TWcalib mode. Always 0 } byte; { 0=bus card ; 1=COM1 ; 2=COM2 .. } word; { port base address } byte; { IRQ number } word; { clicktime } word; { sensitivity } word; { current button mode } word; byte; byte; byte; byte; array[1..60] of char; byte; byte; byte;
{ stabilization factor } { 0 = Off ; 1 = On } { 0 = Left ; 1 = Right ; 2 = Both } { 0 = OK, or a DOS file error } { 0 = Disabled ; 1 = Enabled } { Touchscreen name, $ terminated } { Initialisation status, 1 = OK } { 0 = Production ; 1 = Eval } { 1 = Z supported ; 0 = not }
Page 179
Appendix E: TWDriver Application Programming Interface
ARIsupport: Down1: Up1: Down2: Up2: Down3: Up3: SoundOff: NumScreens: PortType: Baud: Parity: Databits: Stopbits: IRQshare: ReArm: OverrunErrs: ParityErrs: FramingErrs: RFU: end; 'C' typedef struct { BYTE BYTE BYTE byte; byte; byte; byte; byte; byte; byte; byte; byte; byte; word; byte; byte; byte; byte; byte; word; word; word; array[1..100] of byte;
{ 1 = ARI supported ; 0 = not } { ButtonDown1 setting } { ButtonUp1 setting } { ButtonDown2 setting } { ButtonUp2 setting } { ButtonDown3 setting } { ButtonUp3 setting } { 1 = Sound Off ; 0 = On } { Number of touchscreens } { 1 = Serial ; 2 = Bus ; 3 = Other } { 1200, 2400, 4800, or 9600 } { 'N', 'O', 'E' } { '7' or '8' } { '1' or '2' } { 1 = On ; 0 = Off } { 1 = On ; 0 = Off } { Count of overrun errors } { count of parity errors } { count of framing errors } { reserved for future use }
VerMajor; VerMinor; TouchScreens;
BYTE BYTE BYTE WORD
CalibFilePath[80]; CalibMode; ComPort; Address;
/* major version number */ /* minor version number */ /* touchscreen number, see ’Touchscreen Type Numbers’*/ /* calibration file pathname, Asciiz */ /* current TWcalib mode active */ /* 0 = bus card, 1 = Com1, 2 = Com2 */ /* port base address */
BYTE WORD WORD WORD WORD BYTE BYTE
Irq; ClickTime; Sensitivity; ButtonMode; Stabilization; Offset; Button;
/* Irq number */ /* click time */ /* sensitivity */ /* current button mode, User defined if zero */ /* stabilization */ /* 0 = Off, 1 = On */ /* 0 = Left ; 1 = Right ; 2 = Both */
E-9