[posix-app] remove function "HdlcInterface::IsDecoding()" (#4340)

The function "RadioSpinel::IsSafeToHandleNow()" is finally called by the
function "HdlcInterface::Decode()". However, the variable "mIsDecoding"
is set to TRUE before calling "RadioSpinel::IsSafeToHandleNow()" in
function "HdlcInterface::Decode()". So the function "IsDecoding()"
always return TURE in function "RadioSpinel::IsSafeToHandleNow()". This
commit removes the function "IsDecoding()" to simplify the code.
This commit is contained in:
Zhanglong Xia
2019-11-20 21:12:23 -08:00
committed by Jonathan Hui
parent 1a501a1840
commit 501a190546
3 changed files with 1 additions and 12 deletions
-3
View File
@@ -125,7 +125,6 @@ namespace PosixApp {
HdlcInterface::HdlcInterface(Callbacks &aCallbacks)
: mCallbacks(aCallbacks)
, mSockFd(-1)
, mIsDecoding(false)
, mRxFrameBuffer()
, mHdlcDecoder(mRxFrameBuffer, HandleHdlcFrame, this)
{
@@ -199,9 +198,7 @@ void HdlcInterface::Read(void)
void HdlcInterface::Decode(const uint8_t *aBuffer, uint16_t aLength)
{
mIsDecoding = true;
mHdlcDecoder.Decode(aBuffer, aLength);
mIsDecoding = false;
}
otError HdlcInterface::SendFrame(const uint8_t *aFrame, uint16_t aLength)
-8
View File
@@ -129,14 +129,6 @@ public:
*/
int GetSocket(void) const { return mSockFd; }
/**
* This method indicates whether the `HdclInterface` is currently decoding a received frame or not.
*
* @returns TRUE if currently decoding a received frame, FALSE otherwise.
*
*/
bool IsDecoding(void) const { return mIsDecoding; }
/**
* This method instructs `HdlcInterface` to read and decode data from radio over the socket.
*
+1 -1
View File
@@ -627,7 +627,7 @@ private:
*/
bool IsSafeToHandleNow(spinel_prop_key_t aKey) const
{
return !((mHdlcInterface.IsDecoding() || mWaitingKey != SPINEL_PROP_LAST_STATUS) &&
return !((mWaitingKey != SPINEL_PROP_LAST_STATUS) &&
(aKey == SPINEL_PROP_STREAM_RAW || aKey == SPINEL_PROP_MAC_ENERGY_SCAN_RESULT));
}