beautypg.com

2 programming examples, 3 required function calls – Sensoray 2410 API User Manual

Page 8

background image

Sensoray 24xx Programming Guide

4

Fundamentals

address you chose earlier. If necessary, also enter a new netmask and gateway address. Click the Submit button and wait for
the page to reload.

7. Reset the module. Press and release the RST pushbutton. Your permanent network settings are now in effect.

3.2 Programming Examples

The C programming language has been used for all programming examples.

3.2.1 Constants

Many of the examples specify symbolic constants that are defined in

s24xx.h

, which can be found on the distribution media.

3.2.2 Data Types

In most cases, data values passed to or received from library functions belong to a small set of fundamental data types. All of these
data types are listed in Table 1. Data types are referenced by their C-language type names, as shown in the left column of the table.

A few functions make use of structures that are composites of the fundamental types. All structures are defined in header file

s24xx.h

.

3.3 Required Function Calls

Some library functions are used universally in all applications, while others, depending on application requirements, may or may
not be used. All applications must, as a minimum, perform the following steps:

1.

Call

S24xx_ApiOpen()

to initialize the API. This should always be the first API function executed by a client application.

2.

For each I/O module, call

s24xx_SessionOpen()

to open a communication session with it.

3.

To guarantee proper cleanup when your application terminates, call

S24xx_SessionClose()

for each previously opened

session, and then call

s24xx_ApiClose()

after all sessions have been closed.

Table 1: Data types used by library functions

Type Name

Description

u8

8-bit unsigned integer

s16/u16

16-bit signed/unsigned integer

s32/u32

32-bit signed/unsigned integer

BOOL

32-bit integer (0=false, other=true)

HSESSION

void pointer (session handle)

HEVCAP

void pointer (event notification system handle)