# WM_SetLifeTime

## Syntax

      #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. Initial value is 40 (4 seconds).
`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. Default value is 5.
`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. Initial value is 40 (4 seconds).

## 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 permissible time during which communications can be interrupted due to deteriorating communication conditions. If the CAM lifetime receives any kind of communication, there is no disconnection.
Basically, the MP communication lifetime displays the value permissible for MP communication interrupt time. The lifetime is updated when a meaningful MP communication is received from a communications partner.
Either way, communications are cut off when the lifetime expires.

If the CPU hangs up while the wireless communications hardware is running MP communications, the CAM lifetime is not adequate to properly disconnect. For example, there are cases when the parent continues to send a beacon, or when the child automatically returns a NULL response in the parent MP frame. The MP communications lifetime was prepared to disconnect properly in these situations.

The frame lifetime acts differently than the other two lifetimes. It only affects communications during connection and disconnection when running MP communications. In infrastructure mode, the default values affect all frame lifetimes. Do not change them unless there is good reason. In particular, if the frame lifetime is made invalid, conditions could result where the disconnect callback is not called.

## Revision History

2006/01/13 Rewrote the explanation and added a note not to set the frame lifetime to `0xFFFF`.
2005/06/12 Added a description of the frame lifetime.
2005/10/03 Corrected the description of the default frame lifetime.
2005/06/08 Added a statement about callback being called from the interrupt handler.
2005/03/02 Added a statement about the range that can be specified with the `frameLifeTime` argument.
2004/11/19 Changed the description for `mpLifeTime`.
2004/11/09 Added `mpLifeTime` to arguments.
2004/10/22 Changed the return value type.
2004/08/11 Initial version.

CONFIDENTIAL