Oc_getswitchposition -40 – Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual

Page 94

Advertising
background image

6–40

Library of Routines

OC_GetSwitchPosition

Publication 1747-6.5.3 June 1998

OC_GetSwitchPosition

OC_GetSwitchPosition reads the current position of the three-position front-panel
switch from the scanner.

Syntax:

int

OC_GetSwitchPosition(HANDLE handle, BYTE *swpos);

Parameters:

Description:

The switch position has no effect on the scanner. The application can use this switch for any purpose.

The scanner must be initialized before you can monitor the switch position.

Return Value:

Considerations:

Supported in the DOS API library and the Windows NT API library

Example:

HANDLE

Handle;

BYTE

sw_pos;

int

retcode;

retcode = OC_GetSwitchPosition( Handle, &sw_pos );

if ( sw_pos == SWITCH_BOTTOM )

OC_SetScanMode ( Handle, SCAN_IDLE );

Parameter:

Description:

handle

Must be a valid handle returned from OC_OpenScanner

swpos

If

swpos

is:

SWITCH_TOP

switch is in the top position

SWITCH_MIDDLE

switch is in the middle position

SWITCH_BOTTOM

switch is in the bottom position

Name:

Value:

Description:

SUCCESS

0

switch position was read successfully

ERR_OCACCESS

2

handle

does not have access to scanner

ERR_OCINIT

5

scanner has not been initialized, see OC_InitScanner

Advertising
This manual is related to the following products: