[sub-mac] relax the requirement for TxDone callback (#4113)

This commit changes the `SubMac::BeginTrasnmit()` by moving the call
to `Transmit()` on radio platform after the state change to
`kStateTransmit` (and pcap callback). This relaxes the requirement for
radio platform implementation and allow it to invoke `TxDone` callback
directly from the `Transmit()` call itself (instead of requiring
`TxDone` to be called only after the `Transmit()` call returns).
This commit is contained in:
Abtin Keshavarzian
2019-08-20 08:39:24 -07:00
committed by Jonathan Hui
parent 1812d8cfda
commit 27336a95cf
+3 -3
View File
@@ -286,9 +286,6 @@ void SubMac::BeginTransmit(void)
error = Get<Radio>().Receive(mTransmitFrame.GetChannel());
assert(error == OT_ERROR_NONE);
error = Get<Radio>().Transmit(mTransmitFrame);
assert(error == OT_ERROR_NONE);
SetState(kStateTransmit);
if (mPcapCallback)
@@ -296,6 +293,9 @@ void SubMac::BeginTransmit(void)
mPcapCallback(&mTransmitFrame, true, mPcapCallbackContext);
}
error = Get<Radio>().Transmit(mTransmitFrame);
assert(error == OT_ERROR_NONE);
exit:
return;
}