# WM_StartScan

## C Specification

      #include <nitro/wm.h>

      WMErrCode WM_StartScan(
          WMCallbackFunc        callback ,
          const WMScanParam*    param );

## Description

Starts the scan for a parent

This function is only executable when the WM is in either the `IDLE` or `SCAN` state. If the WM is in the `IDLE` state, this function changes the state to `SCAN`.

If the return value is `WM_ERRCODE_OPERATING`, a callback is generated after the scanning process has started properly. The callback is also generated when the scan process has completed.

One callback can obtain information for no more than one parent machine. To obtain information from several parent machines, this function must be called several times. However, by doing so, there may be a possibility of getting the information from the same parent machine. If a parent could not be found after completing the scan, a callback is generated to indicate that no parent was found. You may continuously call `WM_StartScan` without calling `WM_EndScan`.

Basically, this function searches only the wireless channel specified by `param`. However, there is a possibility of picking up the parent information on neighboring channels. When searching for the parent on all channels, use `WM_GetAllowedChannel` to make a guess at the channels that the parent may be using, and then make the application search for it.

## Arguments

`callback` | Callback function to be called when an asynchronous process has completed.
`param` | Pointer to the structure that shows scan information. The ARM7 processor writes the scan result information directly to `param->scanBuf`. Therefore, it must be 32-byte-aligned. Note that the param structure entity will be forcibly cached.

## Return Values

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

## See Also

`WM_EndScan`, `WM_StartConnect`, `WM_Disconnect`, `WM_GetAllowedChannel`

## Revision History

10/22/2004 Changed return value type
09/21/2004 Added description
08/10/2004 Revised description
08/02/2004 Standardized structure names
07/29/2004 Added descriptions
07/23/2004 Initial Version