[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) 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;
+1
View File
@@ -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);