Omega Vehicle Security 1500 Manuel D’Utilisation

Page de 256
Appendix B
Ethernet API Reference
Overview
NetScan software provides an ethernet API that allows users to write programs.  Support consists of two files,
NPCI_WIN.DLL for 16-bit windows developers, and NPCI_W3V.DLL for 32-bit windows developers. The only
system requirement is that the Windows TCP/IP protocol be loaded and configured.
With a mechanism called session handles, the API can simultaneously handle multiple NetScan units.  All functions
rely on the session handle to keep track of the NetScan device selected for communication.
A typical session with a NetScan consists of the following basic parts:
 
Initialization -  Initialization requires several functions to be called in appropriate order.  These functions
include: 
nSWInit
nSessionBegin
nIOLock
 and 
nSERIALConfigure
.
 
Actual communications (during the session) -  Communication functions include 
nSerialReceive
 and
nSerialSend
.
 
De-initialization – De-initialization is for ending a session, and uses the functions: 
NSessionEnd
 and
NSWDeinit
.
Detailed descriptions of each function are covered in the following section. Examples programs are also included on
the distribution disk.
Functions
nSWInit
Function: int nSwInit(void);
Parameters: None
Returns: 0 if successful, error code if not.
Description: This function is used to allocate system resources prior to beginning a session. This function must be
called before any others.
Example:
ErrVal = nSWInit ();
nSessionBegin
Function: int nSessionBegin (short adapter, char FAR *local, char FAR *remote,
    unsigned long flags, unsigned long reserved, long FAR *session);
Parameters:
Short
adapter
Always a 0.
Char FAR *
local
Always a null string.
Char FAR *         remote
A null terminated string, which contains the IP address of the NetScan
device.
Unsigned long
flags
Always zero
Unsigned long
reserved
Always zero
Long FAR *
session
A variable used to receive the session handle.
Returns: 0 if successful, error code if not.
Description: This function is used to establish a session with a specific NetScan device. If a successful connection
is made, then a session handle is assigned and placed in the session argument. Since each session is unique, it is
possible to have multiple sessions active at any given time.
Example:
ErrVal = nSessionBegin(0,”\0”,”192.0.0.1\0”,0,0.session);