PxMsgGetData()

Get data area of a message (task service).

APPLIES TO

1.0.0

SYNOPSIS
PxMsgData_t PxMsgGetData (PxMsg_t msgid);
ARGUMENTS
msgid

Message object

RETURN VALUES
  • Pointer to message data area

ERROR CODES

PXERR_MSG_ILLMSG

msgid is not a valid message object

PXERR_MSG_ILLUSER

The calling task is not user of this message

PXERR_PROT_NOFREE_ENTRY

No free protection entry

PXERR_PROT_ILL_HANDLE

The associated protection handle is not valid

PXERR_REQUEST_INVALID_PARAMETER

Invalid pair parameter

PXERR_ILL_NULLPOINTER_PARAMETER

Illegal null pointer parameter in the call

PXERR_PROT_ILL_SIZE

The size of the protection region is not valid

PXERR_PROT_ILL_ALIGN

Alignment of protection region not valid

PXERR_MSG_NOT_IMPLEMENTED

The function is called by a system interrupt handler

DESCRIPTION

PxMsgGetData returns a C-pointer to the data area corresponding to message msgid. If an invalid message is given a null pointer is returned. PxMsgGetData function can only be called from task, othewise PXERR_TASK_ILLCALL error 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
  • PxMsgGetData returns a null pointer on failure (C).

Best Practice
  • No restrictions.

SEE ALSO
USAGE
#include "pxdef.h"

PxMsgData_t DataArea = PxMsgGetData(msgid)

if (DataArea != NULL) {
    // Handle data
}
else {
    // Report error
}