MiApp_StartConnection Function

MiWi Development Environment

MiWi(TM) Development Environment Help
MiApp_StartConnection Function
C
BOOL MiApp_StartConnection(
    BYTE Mode, 
    BYTE ScanDuration, 
    DWORD ChannelMap
);
Description

This is the primary user interface function for the application layer to a PAN. Usually, this fucntion is called by the PAN Coordinator who is the first in the PAN. The PAN Coordinator may start the PAN after a noise scan if specified in the input mode.

Preconditions

Protocol initialization has been done.

Parameters
Parameters 
Description 
BYTE Mode 
Whether to start a PAN after a noise scan. Possible modes are

 

BYTE ScanDuration 
The maximum time to perform scan on single channel. The value is from 5 to 14. The real time to perform scan can be calculated in following formula from IEEE 802.15.4 
specification 
960 * (2^ScanDuration + 1) * 10^(-6) second ScanDuration is discarded if the connection mode is START_CONN_DIRECT
DWORD ChannelMap 
The bit map of channels to perform noise scan. The 32-bit double word parameter use one bit to represent corresponding channels from 0 to 31. For instance, 0x00000003 represent to scan channel 0 and channel 1. ChannelMap is discarded if the connection mode is START_CONN_DIRECT
Returns

a boolean to indicate if PAN has been started successfully.

Remarks

None

Example
// start the PAN on the least noisy channel after scanning all possible channels.
MiApp_StartConnection(START_CONN_ENERGY_SCN, 10, 0xFFFFFFFF);
Microchip My Application xx.yy - [Jan 1, 2009]
Copyright © 2009 Microchip Technology, Inc.  All rights reserved.