mirror of
https://github.com/espressif/openthread.git
synced 2026-09-16 22:20:07 +00:00
[mac] apply RxChannelAfterTxDone only if RxOnWhenIdle (#10826)
This commit updates the implementation to apply RxChannelAfterTxDone only if RxOnWhenIdle.
This commit is contained in:
@@ -244,3 +244,44 @@ TEST(RadioSpinelTransmit, shouldPerformCsmaCaWhenEnabled)
|
||||
|
||||
platform.GoInMs(1000);
|
||||
}
|
||||
|
||||
TEST(RadioSpinelTransmit, shouldNotCauseSwitchingToRxAfterTxDoneIfNotRxOnWhenIdle)
|
||||
{
|
||||
FakeCoprocessorPlatform platform;
|
||||
|
||||
constexpr Mac::PanId kSrcPanId = 0x1234;
|
||||
constexpr Mac::PanId kDstPanId = 0x4321;
|
||||
constexpr uint8_t kDstAddr[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
|
||||
constexpr uint16_t kSrcAddr = 0xac00;
|
||||
constexpr int8_t kTxPower = 100;
|
||||
|
||||
uint8_t frameBuffer[OT_RADIO_FRAME_MAX_SIZE];
|
||||
Mac::TxFrame txFrame;
|
||||
|
||||
txFrame.mPsdu = frameBuffer;
|
||||
|
||||
{
|
||||
Mac::TxFrame::Info frameInfo;
|
||||
|
||||
frameInfo.mType = Mac::Frame::kTypeData;
|
||||
frameInfo.mVersion = Mac::Frame::kVersion2006;
|
||||
frameInfo.mAddrs.mSource.SetShort(kSrcAddr);
|
||||
frameInfo.mAddrs.mDestination.SetExtended(kDstAddr);
|
||||
frameInfo.mPanIds.SetSource(kSrcPanId);
|
||||
frameInfo.mPanIds.SetDestination(kDstPanId);
|
||||
frameInfo.mSecurityLevel = Mac::Frame::kSecurityEncMic32;
|
||||
|
||||
frameInfo.PrepareHeadersIn(txFrame);
|
||||
}
|
||||
|
||||
txFrame.mInfo.mTxInfo.mTxPower = kTxPower;
|
||||
txFrame.mChannel = 11;
|
||||
txFrame.mInfo.mTxInfo.mRxChannelAfterTxDone = 25;
|
||||
|
||||
ASSERT_EQ(platform.mRadioSpinel.Enable(FakePlatform::CurrentInstance()), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Receive(11), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.SetRxOnWhenIdle(false), kErrorNone);
|
||||
ASSERT_EQ(platform.mRadioSpinel.Transmit(txFrame), kErrorNone);
|
||||
platform.GoInMs(1000);
|
||||
EXPECT_EQ(platform.GetReceiveChannel(), 11);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user