Messaging – ProSoft Technology MVI69E-LDM User Manual
Page 75

MVI69E-LDM ♦ "C" Programmable
Contents
Linux Application Development Module
Developer's Manual
ProSoft Technology, Inc.
Page 75 of 130
August 21, 2014
5.3
Messaging
MVI69_GetMsgRequestFromBp
Syntax
int MVI69_GetMsgRequestFromBp(MVI69HANDLE handle,
WORD *buffer,
WORD *length,
WORD reserved,
WORD timeout);
Parameters
handle
handle returned by previous call to MVI69_Open
buffer
pointer to buffer to receive message data from processor
length
pointer to variable containing the maximum message length in words.
When this function is called, this should be set to the size of the indicated
buffer. Upon successful return, this variable will contain the actual
received message length.
timeout
maximum number of milliseconds to wait for message
Description
This function retrieves a message sent from the control processor.
handle must be a valid handle returned from MVI69_Open.
Upon calling this function, length should contain the maximum message size in words to be
received. buffer must point to a buffer of at least length words in size. Upon successful
return, length will contain the actual length of the message received.
If length exceeds the maximum message size specified by the value MsgRcvBufSize (see
the MVI69_GetIOConfig function), MVI69_ERR_BADPARAM will be returned.
timeout specifies the number of milliseconds that the function will wait for a message. To poll
for a message without waiting, set timeout to zero. If no message has been received,
MVI69_ERR_TIMEOUT will be returned.
If the message received from the control processor is larger than length, the message will
be truncated to length words and MVI69_ERR_MSGTOOBIG will be returned.
If the call returns MVI69_SUCCESS, buffer will contain the message in the following format:
Name
Data Type
Description
MessageId
WORD
Message ID. Used to match responses
to requests.
SizeofMessage
WORD
Size of the Message data in bytes.
Message[...]
BYTEs
CIP Message packet, starting with
Service Code. Total number of bytes is
provided in the SizeofMessage field.
The API does not act upon any data of the Message, nor does it monitor response timeouts.
The user application is responsible for parsing the message and generating a response.