beautypg.com

ProSoft Technology MVI56E-LDM User Manual

Page 107

background image

ControlLogix Platform ♦ "C" Programmable

CIP API Functions

Linux Application Development Module

Developer's Manual

ProSoft Technology, Inc.

Page 101 of 264

March 12, 2014

OCXcip_ReadConnected

Syntax

int OCXcip_ReadConnected(OCXHANDLE apihandle,
OCXHANDLE connHandle,
BYTE *dataBuf,
WORD offset,
WORD dataSize );

Parameters

apihandle

handle returned by previous call to OCXcip_Open

connHandle

handle of open connection

dataBuf

pointer to buffer to receive data

offset

offset of byte to begin reading

dataSize

number of bytes to read

Description
This function is used by an application to read data being received on the open
connection specified by

connHandle

.

apiHandle

must be a valid handle returned from

OCXcip_Open

.

connHandle

must be

a handle passed by the

connect_proc

callback function.

offset

is the offset into

the connected data buffer to begin reading.

dataBuf

is a pointer to a buffer to

receive the data.

dataSize

is the number of bytes of data to be read.

Notes: When a connection has been established with a ControlLogix controller, the first 4 bytes of

received data are processor status and are automatically set by the controller. The first byte of data

appears at offset 4 in the receive data buffer.

Return Value

OCX_SUCCESS

data was read successfully

OCX_ERR_NOACCESS

apihandle

does not have access

OCX_ERR_BADPARAM

connHandle

or offset/dataSize is invalid

Example

OCXHANDLE apihandle;
OCXHANDLE connHandle;
BYTE buffer[128];

// Read 128 bytes from the connected data buffer
OCXcip_ReadConnected(handle, connHandle, buffer, 0, 128 );

See Also
OCXcip_WriteConnected