PxMsgGetProtection()
Get protection mode of a message.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxAccessPerm_t PxMsgGetProtection (PxMsg_t msgid); - ARGUMENTS
|
- RETURN VALUES
-
-
Protection mode (
NoAccessProtection,ReadProtection,WriteProtection,WRProtection)
-
- ERROR CODES
-
PXERR_MSG_ILLMSGmsgidis not a valid object idPXERR_MSG_ILLUSERThe calling task is not user of this message
- DESCRIPTION
-
PxMsgGetProtectionreturns the protection mode for the data area of a given message objectmsgid. The following values are possible:-
NoAccessProtectionthe caller has no access to the messages data area -
ReadProtectionthe caller has read only access to the messages data area -
WriteProtectionthe caller has write only access to the messages data area -
WRProtectionthe caller has read and write access to the messages data area
-
- 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
-
-
PxMsgGetProtectionreturns a value of typePxProtectType_t, which may have one of the following values (V):-
NoAccessProtectionneither read nor write access -
ReadProtectionread access -
WriteProtectionwrite access -
WRProtectionread and write access
-
-
- Best Practice
-
-
No restrictions.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxProtectType_t protType = PxMsgGetProtection(msgid); switch (protType) { case NoAccessProtection: // Task has no permission to access message data break; case ReadProtection: // Task has read-only permission to access message data break; case WriteProtection: // Task has write-only permission to access message data break; case WRProtection: // Task has read and write permission to access message data break; }