try { wclBluetoothRadio Radio = GetSelectedRadio(); if (Radio != null) { m_BTClient.Address = Convert.ToInt64(sAddress, 16); m_BTClient.Authentication = false; m_BTClient.Encryption = false; m_BTClient.Channel = iChannel; m_BTClient.Service = wclUUIDs.SerialPortServiceClass_UUID; //- iResult = Radio.RemotePair(m_BTClient.Address); //- m_bConnecting = true; iResult = m_BTClient.Connect(Radio); if (iResult == wclErrors.WCL_E_SUCCESS) { System.Threading.Thread.Sleep(500); while (m_bConnecting) { Application.DoEvents(); } bool bConnected2; Radio.GetRemoteConnectedStatus(m_BTClient.Address, out bConnected2); bConnected2 = (m_BTClient.State == wclClientState.csConnected); bRes = bConnected2; } else bRes = false; } } catch (Exception e) { bRes = false; } return bRes;
BTManager = new wclBluetoothManager(); BTManager.OnPinRequest += BTManager_OnPinRequest; BTManager.OnAuthenticationCompleted += BTManager_OnAuthenticationCompleted; BTManager.OnConfirm += BTManager_OnConfirm; BTManager.OnPasskeyNotification += BTManager_OnPasskeyNotification; BTManager.OnPasskeyRequest += BTManager_OnPasskeyRequest; BTManager.OnProtectionLevelRequest += BTManager_OnProtectionLevelRequest; BTManager.OnStatusChanged += BTManager_OnStatusChanged; BTManager.Open();