2.7.1 WPAN_MLME_DisassociateReq Function

C

bool WPAN_MLME_DisassociateReq(WPAN_AddrSpec_t *DeviceAddrSpec, uint8_t DisassociateReason, bool TxIndirect)

Summary

Inititate MLME-DISASSOCIATE.request service and have it placed in the MLME-SAP queue.

Description

This function is used by the associated device to notify the coordinator of its intent to leave the PAN. It is also used by the coordinator to instruct an associated device to leave the PAN. The MLME-DISASSOCIATE.request primitive is used by an associated device to notify the coordinator of its intent to leave the PAN. It is also used by the coordinator to instruct an associated device to leave the PAN.

Precondition

WPAN_Init() should have been called before calling this function.

Parameters

ParamDescription
DeviceAddrSpecPointer to WPAN_AddrSpec_t structure for device to which to send the disassociation notification command
DisassociateReasonDisassociateReason* - Reason for disassociation. Valid values: - @ref WPAN_DISASSOC_BYPARENT, @ref WPAN_DISASSOC_BYCHILD
TxIndirectTRUE if the disassociation notification command is to be sent indirectly

Returns

true - success; false - buffer not available or queue full.

Example

WPAN_AddrSpec_t DeviceAddrSpec;
DeviceAddrSpec.AddrMode = WPAN_ADDRMODE_SHORT;
DeviceAddrSpec.PANId = 0x1111;
DeviceAddrSpec.Addr.shortAddress = 0x0001;
uint16_t DisassociateReason = WPAN_DISASSOC_BYCHILD;
bool TxIndirect = true;

bool retVal = false;
retVal = WPAN_MLME_DisassociateReq(&DeviceAddrSpec, WPAN_DISASSOC_BYCHILD, true);
if (true != retVal)
{
     printf("buffer not available or queue full");
}

Remarks

On the receipt of WPAN_MLME_DisassociateReq, MAC layer will perform respective operation and asynchronously invokes USR_MLME_DisassociateConf with proper status.