From 96adf87cd0268600ce0c4af348fb70f7ca464e02 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sat, 21 May 2016 14:20:05 +0800 Subject: [PATCH] add otPlatRadioGetCaps method to check radio capabilities (#53) add doxygen for otRadioCaps remove tmp file --- examples/platform/posix/radio.cpp | 5 +++++ include/platform/radio.h | 18 ++++++++++++++++++ src/core/mac/mac.cpp | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/examples/platform/posix/radio.cpp b/examples/platform/posix/radio.cpp index 40a9ffce4..7da633da2 100644 --- a/examples/platform/posix/radio.cpp +++ b/examples/platform/posix/radio.cpp @@ -260,6 +260,11 @@ int8_t otPlatRadioGetNoiseFloor() return 0; } +otRadioCaps otPlatRadioGetCaps() +{ + return kRadioCapsNone; +} + ThreadError otPlatRadioHandleTransmitDone(bool *rxPending) { ThreadError error = kThreadError_None; diff --git a/include/platform/radio.h b/include/platform/radio.h index a84e2b13d..fc38fe1a1 100644 --- a/include/platform/radio.h +++ b/include/platform/radio.h @@ -77,6 +77,17 @@ enum kPhyUsPerSymbol = ((kPhyBitsPerOctet / kPhySymbolsPerOctet) * 1000000) / kPhyBitRate, }; +/** + * This enum represents radio capabilities. + * + */ + +typedef enum otRadioCaps +{ + kRadioCapsNone = 0, ///< None + kRadioCapsAckTimeout = 1, ///< Radio supports AckTime event +} otRadioCaps; + /** * This structure represents an IEEE 802.15.4 radio frame. */ @@ -272,6 +283,13 @@ ThreadError otPlatRadioHandleTransmitDone(bool *aFramePending); */ int8_t otPlatRadioGetNoiseFloor(void); +/** + * Get the radio capabilities. + * + * @returns The radio capability bit vector. The stack enables or disables some functions based on this value. + */ +otRadioCaps otPlatRadioGetCaps(void); + /** * @} * diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 025f4814d..159c60419 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -516,7 +516,7 @@ void Mac::HandleBeginTransmit(void) SuccessOrExit(error = otPlatRadioTransmit(&mSendFrame)); - if (mSendFrame.GetAckRequest()) + if (mSendFrame.GetAckRequest() && !(otPlatRadioGetCaps() & kRadioCapsAckTimeout)) { mAckTimer.Start(kAckTimeout); otLogDebgMac("ack timer start\n");