mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 07:07:46 +00:00
[mac] add IsJoinable (private) method (#4133)
This commit is contained in:
committed by
Jonathan Hui
parent
6b42ce5845
commit
3cd4be9392
+11
-9
@@ -815,7 +815,6 @@ void Mac::PrepareBeaconRequest(TxFrame &aFrame)
|
||||
|
||||
void Mac::PrepareBeacon(TxFrame &aFrame)
|
||||
{
|
||||
uint8_t numUnsecurePorts;
|
||||
uint8_t beaconLength;
|
||||
uint16_t fcf;
|
||||
Beacon * beacon = NULL;
|
||||
@@ -836,10 +835,7 @@ void Mac::PrepareBeacon(TxFrame &aFrame)
|
||||
{
|
||||
beaconPayload->Init();
|
||||
|
||||
// set the Joining Permitted flag
|
||||
Get<Ip6::Filter>().GetUnsecurePorts(numUnsecurePorts);
|
||||
|
||||
if (numUnsecurePorts)
|
||||
if (IsJoinable())
|
||||
{
|
||||
beaconPayload->SetJoiningPermitted();
|
||||
}
|
||||
@@ -877,10 +873,7 @@ bool Mac::ShouldSendBeacon(void) const
|
||||
// false) but only if it is in joinable state (unsecure port
|
||||
// list is not empty).
|
||||
|
||||
uint8_t numUnsecurePorts;
|
||||
|
||||
Get<Ip6::Filter>().GetUnsecurePorts(numUnsecurePorts);
|
||||
shouldSend = (numUnsecurePorts != 0);
|
||||
shouldSend = IsJoinable();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -888,6 +881,15 @@ exit:
|
||||
return shouldSend;
|
||||
}
|
||||
|
||||
bool Mac::IsJoinable(void) const
|
||||
{
|
||||
uint8_t numUnsecurePorts;
|
||||
|
||||
Get<Ip6::Filter>().GetUnsecurePorts(numUnsecurePorts);
|
||||
|
||||
return (numUnsecurePorts != 0);
|
||||
}
|
||||
|
||||
void Mac::ProcessTransmitAesCcm(TxFrame &aFrame, const ExtAddress *aExtAddress)
|
||||
{
|
||||
uint32_t frameCounter = 0;
|
||||
|
||||
@@ -653,6 +653,7 @@ private:
|
||||
void PrepareBeaconRequest(TxFrame &aFrame);
|
||||
void PrepareBeacon(TxFrame &aFrame);
|
||||
bool ShouldSendBeacon(void) const;
|
||||
bool IsJoinable(void) const;
|
||||
void BeginTransmit(void);
|
||||
bool HandleMacCommand(RxFrame &aFrame);
|
||||
Frame * GetOperationFrame(void);
|
||||
|
||||
Reference in New Issue
Block a user