# WM_StartConnectEx

## C Specification

      #include <nitro/wm.h>

      WMErrCode WM_StartConnectEx(
      WMCallbackFunc  callback ,
      const WMBssDesc*  pInfo ,
      const u8*         ssid ,
      BOOL              powerSave ,
      u16               authMode
      );

## Arguments

`callback` | Specifies the callback function to be called when the notification of the status for the asynchronous process is sent or when the asynchronous process completes. This callback is called from within the interrupt handler.
pInfo | Specifies Information on the parent to be connected. Be sure to designate the structure obtained in `WM_StartScan` or `WM_StartScanEx` as is. Note that this structure entity will be forcibly cached.
ssid | Specifies the child information (fixed at 24 bytes (`WM_SIZE_CHILD_SSID`)) to be sent to the parent. The specified data will be sent to the parent by the callback of `WM_StartParent`. If NULL, the 24 bytes of data will be set to all zeros.
powerSave | Designate TRUE if the power-saving mode is being used, or FALSE if the full-time response mode is being used. Normally, TRUE should be designated. FALSE should be assigned only when there is a need to perform relatively frequent data sending and receiving in infrastructure mode. If FALSE is designated, significantly more power will be consumed then in power-saving mode.
authMode | Designates the authentication mode. Normally, open system authentication (`WM_AUTHMODE_OPEN_SYSTEM`) should be designated. When designating shared key authentication (`WM_AUTHMODE_SHARED_KEY`), an authentication that performs WEP encryption will be performed, so a WEP key that is the same as that of the communication partner must be configured in advance using a function such as `WM_SetWEPKeyEx`. No other values than these two can be designated.

## Return Values

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

## Description

This function initiates a connection process to a parent. When using infrastructure mode, etc., this function allows a finer degree of control over the connection operations than does `WM_StartConnect`, but normally there is no need to use this. This function is executable only when the WM is in the `IDLE` state. If the return value for API is `WM_ERRCODE_OPERATING`, a callback is triggered when the connection process starts, when the request is approved by the parent, and AID was allocated. The callback is also generated when the normal connection state could not be achieved after starting the connection process. When the connection is complete, the WM changes to the `CHILD` state. After the connection is established, the callback specified by this function is generated when the device is disconnected from the parent. The callback that was specified with this function is also generated if the beacon that was transmitted by the parent on a periodic basis was not received after a set period of time. If the connection process fails along the way and the callback is returned, this indicates that there is an error in the internal state, so try to call `WM_Reset` before retrying `WM_StartConnectEx`.

## Note

After calling this function, a callback will be generated when the connection as a child device completes as expected, but sometimes before the callback is generated a notification will be generated that shows that there was a beacon receive notification or a disconnect from the parent device. When performing an initialization process, etc., as the child device, perform it before this function is called rather than when the callback has been generated.

## See Also

`WM_StartConnect, WM_StartScan, WM_EndScan, WM_Disconnect`

## Revision History

06/08/2005 Added statement about callbacks being called from the interrupt handler.
03/02/2005 Added to Description.
02/14/2005 Initial version

CONFIDENTIAL