# WM_SetLifeTime

## C Specification

      #include <nitro/wm.h>

      WMErrCode WM_SetLifeTime(
              WMCallbackFunc  callback
              u16             tableNumber ,
              u16             camLifeTime ,
              u16             frameLifeTime ,
              u16             mpLifeTime
      );

## Arguments

callback | Designates the callback function to call when the asynchronous process completes. This callback is called from within the interrupt handler.
tableNumber | The CAM table number that sets the lifetime. The state of the CAM table is controlled by each communication terminal. In general, specify `0xFFFF` to batch-set the time-out period for every CAM table.
camLifeTime | The lifetime of the CAM table with 100 ms resolution. Assigning `0xFFFF` invalidates the lifetime.
frameLifeTime | The lifetime of data communications during infrastructure mode and administrative communications related to connecting/disconnecting are specified in terms of the number of beacon intervals. Use a value from 1 through 63, or 0xFFF. Assigning `0xFFFF` invalidates the lifetime.
mpLifeTime | The time a parent allows when a child returns NULL continuously during MP communication (in 100 ms units). Or, the time a child is allowed to remain in a state unable to receive MP frames from the parent (in 100 ms units). Assigning `0xFFFF` invalidates the lifetime.

## Return Values

Returns the results of the `WMErrCode` enumerated type process.

## Description

Sets the communication lifetime (the time until timeout). The function is only executable when the WM is in the `IDLE` state. If the return value is `WM_ERRCODE_OPERATING`, a callback is generated after the lifetime setting process is complete. If this function is not called, the default values are 4 seconds for CAM lifetime, 5 beacons for frame lifetime, and 4 seconds for MP communication lifetime.

The CAM lifetime is the time communication may be disrupted due to deteriorating communication conditions. On the other hand, the MP communication lifetime is the time allowed for a child to return only NULL (despite good communications with the parent) or the time a child cannot receive MP frames because the parent sends only a beacon. A NULL response is generated if the send data cannot be set because the wireless driver is overloaded. When the child's ARM7 bus freezes, it returns NULL for the MP frames from the parent. In case the child called `WM_StartConnect`, but did not call `WM_StartMP` afterwards, the child returns NULL continuously until the child is disconnected by the MP communication lifetime. Unless there is a specific reason otherwise, call `WM_StartMP` immediately after `WM_StartConnect`. With MP frame, the send cancellation might rarely occur with the parent due to overloading the wireless driver. When the parent's ARM7 bus freezes, the beacon is transmitted automatically, and the parent remains unable to send the MP frame. Also, the MP frame is not sent unless `WM_StartMP` is called after `WM_StartParent` (with a parent), and the parent is disconnected from the child by the MP communication lifetime. Unless there is a specific reason otherwise, call `WM_StartMP` immediately after `WM_StartParent`.

## Revision History

06/12/2005 Added a description of the frame lifetime. 10/03/2005 Corrected description of the default frame lifetime.
06/08/2005 Added statement about callback being called from the interrupt handler.
03/02/2005 Added statement about range that can be specified with the `frameLifeTime` argument.
11/19/2004 Changed Description for `mpLifeTime`.
11/09/2004 Added `mpLifeTime` to arguments.
10/22/2004 Changed return value type.
08/11/2004 Initial version.

CONFIDENTIAL