# WM_StartConnect

## C Specification

      #include <nitro/wm.h>

      WMErrCode WM_StartConnect( WMCallbackFunc callback , const WMBssDesc* pInfo , const u8* ssid );

## 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. Specifies the structure that is obtained with `WM_StartScan`. 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.

## Return Values

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

## Description

This function initiates a connection process to a parent. 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. Call `WM_Reset` before re-calling `WM_StartConnect`.

## 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_StartScan`, `WM_EndScan`, `WM_Disconnect`

## Revision History

06/08/2005 Added statement about callback being called from the interrupt handler.
02/07/2005 Added caution about callbacks.
10/27/2004 Added to and revised Description.
10/22/2004 Changed type of return value.
08/23/2004 Added ssid argument.
08/02/2004 Standardized structure names.
07/29/2004 Added to Description.
07/23/2004 Initial version