PxMsgGetSize()

Return the message size.

APPLIES TO

8.2.0

SYNOPSIS
PxSize_t PxMsgGetSize (PxMsg_t msgid);
ARGUMENTS
msgid

The message object

RETURN VALUES
  • Message size

ERROR CODES

PXERR_MSG_ILLMSG

msgid is not a valid object id

PXERR_MSG_ILLUSER

The calling task is not user of this message

DESCRIPTION

PxMsgGetSize returns the size of message msgid. If an invalid message is given, 0 is returned.

IMPLEMENTATION GUIDELINES
Before call
  • msgid must be a valid message object, requested via PxMsgRequest…​ or PxMsgEnvelop…​ or received by a PxMsgReceive…​ call (V). This id may be checked with one of the following macros:

    • PxMsgIdIsValid() must be true.

    • PxMsgIdGet() must not be _PXIllegalObjId.

    • PxMsgIdError() must be PXERR_NOERROR otherwise the returned error code has to be interpreted (C).

After call
  • The function returns 0 if the given message has no data area (e.g., short message) or is invalid. In this case PxGetError must be called to check which error has occurred. (F)

Best Practice
  • No restrictions.

SEE ALSO
USAGE
#include "pxdef.h"

PxSize_t Size = PxMsgGetSize(msgid);

if (Size == 0)
{
	// Check the error via PxGetError()
}
else
{
	// Use the size of message data
}