mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 07:37:47 +00:00
[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:
committed by
Jonathan Hui
parent
1a501a1840
commit
501a190546
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user