# WM_SetLifeTime

## C Specification

      #include <nitro/wm.h>

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

## Description

Sets the communication lifetime (the time until timeout)

This function is only executable when the WM is `IDLE`.

If the return value is `WM_ERRCODE_OPERATING`, a callback is generated after the lifetime setting process is complete. The default state when this function is not called is:
`CAM lifetime = 4 seconds
frame lifetime = off`
MP communication lifetime = 4 seconds

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`.

## Arguments

`callback` | The callback function to call when the asynchronous process finishes.
`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. (e.g. 100ms, 200ms, 300ms, etc.) Assigning `0xFFFF` invalidates the lifetime.
`frameLifeTime` | The lifetime while in infrastructure mode in beacon interval units. 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). When 0xFFFF is specified, the lifetime becomes invalid.

## Return Values

Returns the process result as a `WMErrCode` enumerated type.

## See Also

`WM_StartMP WM_StartConnect WM_StartParent WMErrCode WMCallbackFunc`

## Revision History

11/19/2004 Changed the description of `mpLifeTime`.
11/09/2004 Added `mpLifeTime` to Arguments.
10/22/2004 Changed return value type.
08/11/2004 Initial version.