# WM_StartConnect

## C Specification

      #include <nitro/wm.h>

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

## Description

Initiates a connection process to a parent

This function can only be executed when the WM is `IDLE`. 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.

When the callback for `WM_ERRCODE_CONNECTED` is generated, the aid will be overwritten by the value that is assigned by the parent.

When the connection process fails midway and returns the callback, the internal state may become corrupt. Call `WM_Reset` before re-calling `WM_StartConnect`.

## Arguments

`callback` | Specifies the callback function to notify the state of the asynchronous processing, and to call when an asynchronous process completes
`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 (24-byte `WM_SIZE_CHILD_SSID` fixed size) to be sent to the parent The specified data will be sent to the parent by the callback of `WM_StartParent`.

## Return Values

Returns the process result of the `WMErrCode` enumeration type.

## See Also

`WM_StartScan`, `WM_EndScan`, `WM_Disconnect`

## Revision History

10/27/2004 Revised and corrected the Description
10/22/2004 Changed return value type
08/23/2004 Added the `ssid` argument
08/02/2004 Standardized structure names
07/23/2004 Added descriptions
07/23/2004 Initial Version