[mac] add IsJoinable (private) method (#4133)

This commit is contained in:
Abtin Keshavarzian
2019-08-29 13:21:19 -07:00
committed by Jonathan Hui
parent 6b42ce5845
commit 3cd4be9392
2 changed files with 12 additions and 9 deletions
+11 -9
View File
@@ -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;
+1
View File
@@ -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);