|API|uint8_t MiApp_EstablishConnection(uint8_t Channel, uint8_t addr_len,uint8_t *addr, uint8_t Capability_info, connectionConf_callback_t ConfCallback)| |Description|This is the primary user interface function for the application layer to start communication with an existing PAN. For P2P protocol, this function call can establish one or more connections. For network protocol, this function can be used to join the network, or establish a virtual socket connection with a node out of the radio range.| |Pre-Condition|Protocol initialization is done. If only to establish connection with a predefined device, an active scan must be performed before and valid active scan result must be saved.| |Parameters|• uint8_t channel – selected channel to invoke join procedure.• uint8_t addr_len – address length• uint8_t *addr – address of the parent• uint8_t Capability_info – capability information of the device• connectionConf_callback_t ConfCallback – callback routine which will be called upon the initiated connection procedure is performed| |Returns|The index of the peer device on the connection table.| |Example|<code>// Establish one or more connections with any devicePeerIndex = MiApp_EstablishConnection(14, 8, 0x12345678901234567,0x80,callback);</code>| |Remarks|If more than one connections is established through this function call, the return value points to the index of one of the peer devices.|
Parent topic:MiApp API Description