beautypg.com

3 mm initialization and shutdown, 3 s26_driverversion(), 1 s26_boardopen() – Sensoray 2600 User Manual

Page 10

background image

Sensoray 2600 Programming Guide

6

Initialization and Status Functions

by

S26_DriverOpen()

, however, the application should not call

S26_DriverClose()

. This must be the last

middleware function called by the application.

Example:

See section 4.4.4.

4.2.3 S26_DriverVersion()

Function:

Returns a middleware version string.

Prototype:

const char * S26_DriverVersion( void );

Returns:

Pointer to the middlware’s version string (e.g., “1.0.10” ).

Notes:

This function is only available in middleware version 1.0.10 or higher.

Example:

// Fetch and display middleware version string.

printf( "%s", S26_DriverVersion() );

4.3 MM Initialization and Shutdown

4.3.1 S26_BoardOpen()

Function:

Enables communications between an application and MM.

Prototype:

u32 S26_BoardOpen( u32 hbd, char *ClientAdrs, char *MMAdrs );

Returns:

u32 consisting of a set of active-high error bit flags. All flags will contain zero if the board was successfully
opened. If the board could not be opened, at least one of the flags will be asserted:

Notes:

S26_BoardOpen()

registers a MM with the middleware so that communication between the application program

and the MM will be enabled. Each MM must be registered before calling any other functions that reference the
MM. In the context of this function, “opening” the MM is synonymous with registering the MM.

After opening the MM, the application may use the handle in all other functions that require a board handle.

Do not register a MM at two different handles. This can result in unpredictable behavior and may cause your
system to become unstable.

Example:

// Declare MM number 0, client is not multi-homed.

Parameter

Type

Description

hbd

u32

MM handle. Use any value between 0 and N-1, where N is the number of MMs in the system.
Do not use a value that has already been used for another MM.

ClientAdrs

char*

Pointer to a null-terminated string that specifies the Ethernet client’s IP address in dotted
decimal format. In the case of a multi-homed client, which is a client that has two or more
network interfaces (NICs), specify the IP address of the NIC that is to be used. This should be
set to zero if the client has only one NIC; this will cause the middleware to use the default NIC
for communicating with the MM.

MMAdrs

char*

Pointer to a null-terminated string that specifies the MM’s IP address in dotted decimal format.
This is the address at which the MM is programmed to respond.

Symbolic Name

Description

ERR_BADHANDLE

An invalid MM handle was specified.

ERR_BINDSOCKET

The MM’s network sockets could not be bound to the client’s IP address. Some operating
systems (e.g., Windows 98) do not support multiple NICs. In such systems, you must specify
zero as the address for your NIC.

ERR_CREATESOCKET

One or more of the MM’s network sockets could not be created.