void ChildSupervisor::SendMessage(Child &aChild) { Message *message = NULL; uint8_t childIndex; VerifyOrExit(aChild.GetIndirectMessageCount() == 0); message = Get<MessagePool>().New(Message::kTypeSupervision, sizeof(uint8_t)); VerifyOrExit(message != NULL); // Supervision message is an empty payload 15.4 data frame. // The child index is stored here in the message content to allow // the destination of the message to be later retrieved using // `ChildSupervisor::GetDestination(message)`. childIndex = Get<ChildTable>().GetChildIndex(aChild); SuccessOrExit(message->Append(&childIndex, sizeof(childIndex))); SuccessOrExit(Get<ThreadNetif>().SendMessage(*message)); message = NULL; otLogInfoUtil("Sending supervision message to child 0x%04x", aChild.GetRloc16()); exit: if (message != NULL) { message->Free(); } }
void ChildSupervisor::SendMessage(Child &aChild) { ThreadNetif &netif = GetNetif(); Message *message = NULL; otError error = OT_ERROR_NONE; uint8_t childIndex; VerifyOrExit(aChild.GetIndirectMessageCount() == 0); message = netif.GetInstance().mMessagePool.New(Message::kTypeSupervision, sizeof(uint8_t)); VerifyOrExit(message != NULL); // Supervision message is an empty payload 15.4 data frame. // The child index is stored here in the message content to allow // the destination of the message to be later retrieved using // `ChildSupervisor::GetDestination(message)`. childIndex = netif.GetMle().GetChildIndex(aChild); SuccessOrExit(error = message->Append(&childIndex, sizeof(childIndex))); SuccessOrExit(error = netif.SendMessage(*message)); message = NULL; otLogInfoMle(GetInstance(), "Sending supervision message to child 0x%04x", aChild.GetRloc16()); exit: if (message != NULL) { message->Free(); } }
void SourceMatchController::IncrementMessageCount(Child &aChild) { if (aChild.GetIndirectMessageCount() == 0) { AddEntry(aChild); } aChild.IncrementIndirectMessageCount(); }
void SourceMatchController::DecrementMessageCount(Child &aChild) { if (aChild.GetIndirectMessageCount() == 0) { otLogWarnMac(GetInstance(), "DecrementMessageCount(child 0x%04x) called when already at zero count.", aChild.GetRloc16()); ExitNow(); } aChild.DecrementIndirectMessageCount(); if (aChild.GetIndirectMessageCount() == 0) { ClearEntry(aChild); } exit: return; }
void SourceMatchController::SetSrcMatchAsShort(Child &aChild, bool aUseShortAddress) { VerifyOrExit(aChild.IsIndirectSourceMatchShort() != aUseShortAddress); if (aChild.GetIndirectMessageCount() > 0) { ClearEntry(aChild); aChild.SetIndirectSourceMatchShort(aUseShortAddress); AddEntry(aChild); } else { aChild.SetIndirectSourceMatchShort(aUseShortAddress); } exit: return; }