PxMsgGetSize()
Return the message size.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxSize_t PxMsgGetSize (PxMsg_t msgid); - ARGUMENTS
|
- RETURN VALUES
-
-
Message size
-
- ERROR CODES
-
PXERR_MSG_ILLMSGmsgidis not a valid object idPXERR_MSG_ILLUSERThe calling task is not user of this message
- DESCRIPTION
-
PxMsgGetSizereturns the size of messagemsgid. If an invalid message is given, 0 is returned.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
msgidmust be a valid message object, requested viaPxMsgRequest…orPxMsgEnvelop…or received by aPxMsgReceive…call (V). This id may be checked with one of the following macros:-
PxMsgIdIsValid()must be true. -
PxMsgIdGet()must not be_PXIllegalObjId. -
PxMsgIdError()must bePXERR_NOERRORotherwise 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
PxGetErrormust 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 }