mirror of
https://github.com/espressif/openthread.git
synced 2026-10-13 11:17:39 +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)
|
void Mac::PrepareBeacon(TxFrame &aFrame)
|
||||||
{
|
{
|
||||||
uint8_t numUnsecurePorts;
|
|
||||||
uint8_t beaconLength;
|
uint8_t beaconLength;
|
||||||
uint16_t fcf;
|
uint16_t fcf;
|
||||||
Beacon * beacon = NULL;
|
Beacon * beacon = NULL;
|
||||||
@@ -836,10 +835,7 @@ void Mac::PrepareBeacon(TxFrame &aFrame)
|
|||||||
{
|
{
|
||||||
beaconPayload->Init();
|
beaconPayload->Init();
|
||||||
|
|
||||||
// set the Joining Permitted flag
|
if (IsJoinable())
|
||||||
Get<Ip6::Filter>().GetUnsecurePorts(numUnsecurePorts);
|
|
||||||
|
|
||||||
if (numUnsecurePorts)
|
|
||||||
{
|
{
|
||||||
beaconPayload->SetJoiningPermitted();
|
beaconPayload->SetJoiningPermitted();
|
||||||
}
|
}
|
||||||
@@ -877,10 +873,7 @@ bool Mac::ShouldSendBeacon(void) const
|
|||||||
// false) but only if it is in joinable state (unsecure port
|
// false) but only if it is in joinable state (unsecure port
|
||||||
// list is not empty).
|
// list is not empty).
|
||||||
|
|
||||||
uint8_t numUnsecurePorts;
|
shouldSend = IsJoinable();
|
||||||
|
|
||||||
Get<Ip6::Filter>().GetUnsecurePorts(numUnsecurePorts);
|
|
||||||
shouldSend = (numUnsecurePorts != 0);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -888,6 +881,15 @@ exit:
|
|||||||
return shouldSend;
|
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)
|
void Mac::ProcessTransmitAesCcm(TxFrame &aFrame, const ExtAddress *aExtAddress)
|
||||||
{
|
{
|
||||||
uint32_t frameCounter = 0;
|
uint32_t frameCounter = 0;
|
||||||
|
|||||||
@@ -653,6 +653,7 @@ private:
|
|||||||
void PrepareBeaconRequest(TxFrame &aFrame);
|
void PrepareBeaconRequest(TxFrame &aFrame);
|
||||||
void PrepareBeacon(TxFrame &aFrame);
|
void PrepareBeacon(TxFrame &aFrame);
|
||||||
bool ShouldSendBeacon(void) const;
|
bool ShouldSendBeacon(void) const;
|
||||||
|
bool IsJoinable(void) const;
|
||||||
void BeginTransmit(void);
|
void BeginTransmit(void);
|
||||||
bool HandleMacCommand(RxFrame &aFrame);
|
bool HandleMacCommand(RxFrame &aFrame);
|
||||||
Frame * GetOperationFrame(void);
|
Frame * GetOperationFrame(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user