diff --git a/examples/platforms/simulation/radio.c b/examples/platforms/simulation/radio.c index a1baca64f..2e856dc15 100644 --- a/examples/platforms/simulation/radio.c +++ b/examples/platforms/simulation/radio.c @@ -830,7 +830,8 @@ void radioSendAck(void) if ( #if OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 // Determine if frame pending should be set - (otMacFrameIsData(&sReceiveFrame) || otMacFrameIsDataRequest(&sReceiveFrame)) + ((otMacFrameIsVersion2015(&sReceiveFrame) && otMacFrameIsCommand(&sReceiveFrame)) || + otMacFrameIsData(&sReceiveFrame) || otMacFrameIsDataRequest(&sReceiveFrame)) #else otMacFrameIsDataRequest(&sReceiveFrame) #endif diff --git a/examples/platforms/utils/mac_frame.cpp b/examples/platforms/utils/mac_frame.cpp index b9ef7e333..dcaa6d119 100644 --- a/examples/platforms/utils/mac_frame.cpp +++ b/examples/platforms/utils/mac_frame.cpp @@ -76,6 +76,11 @@ bool otMacFrameIsData(const otRadioFrame *aFrame) return static_cast(aFrame)->GetType() == Mac::Frame::kFcfFrameData; } +bool otMacFrameIsCommand(const otRadioFrame *aFrame) +{ + return static_cast(aFrame)->GetType() == Mac::Frame::kFcfFrameMacCmd; +} + bool otMacFrameIsDataRequest(const otRadioFrame *aFrame) { return static_cast(aFrame)->IsDataRequestCommand(); diff --git a/examples/platforms/utils/mac_frame.h b/examples/platforms/utils/mac_frame.h index f7fff115f..edac95fe0 100644 --- a/examples/platforms/utils/mac_frame.h +++ b/examples/platforms/utils/mac_frame.h @@ -91,10 +91,22 @@ bool otMacFrameIsAck(const otRadioFrame *aFrame); bool otMacFrameIsData(const otRadioFrame *aFrame); /** - * Check if @p aFrame is an Data Request Command. + * Check if @p aFrame is a Command frame. * * @param[in] aFrame A pointer to the frame. * + * @retval true It is a Command frame. + * @retval false It is not a Command frame. + * + */ +bool otMacFrameIsCommand(const otRadioFrame *aFrame); + +/** + * Check if @p aFrame is a Data Request Command. + * + * @param[in] aFrame A pointer to the frame. For 802.15.4-2015 and above frame, + * the frame should be already decrypted. + * * @retval true It is a Data Request Command frame. * @retval false It is not a Data Request Command frame. * diff --git a/src/core/mac/mac_frame.hpp b/src/core/mac/mac_frame.hpp index 1063be592..fea5c59e6 100644 --- a/src/core/mac/mac_frame.hpp +++ b/src/core/mac/mac_frame.hpp @@ -733,7 +733,9 @@ public: otError SetCommandId(uint8_t aCommandId); /** - * This method indicates whether the frame is a MAC Data Request command (data poll) + * This method indicates whether the frame is a MAC Data Request command (data poll). + * + * For 802.15.4-2015 and above frame, the frame should be already decrypted. * * @returns TRUE if frame is a MAC Data Request command, FALSE otherwise. *