PxMsgGetSender()
Return the sender TaskId of the message.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxTask_t PxMsgGetSender (PxMsg_t msgid);
- ARGUMENTS
|
- RETURN VALUES
-
-
Message sender
-
- ERROR CODES
-
PXERR_MSG_ILLMSG
msgid
is not a valid object idPXERR_MSG_ILLUSER
The calling task is not user of this message
- DESCRIPTION
-
PxMsgGetSender returns the message’s sender. If the message has been sent by a handler the previous user of the message is returned.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
msgid
must 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_NOERROR
otherwise the returned error code has to be interpreted (C).
-
-
- After call
-
-
The returned value is the task object id of type
PxTask_t
. This id may be checked with one of the following macros:-
PxTaskIdIsValid()
must be true. -
PxTaskIdGet()
must not be_PXIllegalObjId
. -
PxTaskIdError()
must bePXERR_NOERROR
otherwise the returned error code has to be interpreted (C).
-
-
Additionally the task object may be checked with
PxTaskCheck()
(F).
-
- Best Practice
-
-
No restrictions.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxTask_t msgOwner = PxMsgGetSender(msgid); if (msgOwner.error == PXERR_NOERROR) { if (msgOwner.id != _PXIllegalObjId) { // The msgOwner contains the task ID of the sender } else { // Cannot get the message sender because // the calling task is not the message user } } else { // The message handle is invalid (msgOwner.error == PXERR_MSG_ILLMSG) }