示例#1
0
 private void OnConnectResult(CSR_BLE_CONNECT_RESULT cr)
 {
     CurDevInfo.ConnHandle = cr.connectHandle;
     CsrBleDll.CsrBleClientDiscoverDatabase(cr.connectHandle);
     IsConnected = true;
     OnUpdateBleConnectEvent("蓝牙连接:" + CurDevInfo);
 }
示例#2
0
        private void OnHostConnectResult(CSR_BLE_CONNECT_RESULT conn)
        {
            var gattDevice = GattConnectDevices.Last();

            if (conn.result == 0)
            {
                gattDevice.Handle    = conn.connectHandle;
                gattDevice.Connected = true;

                CsrBleDll.CsrBleClientDiscoverDatabase(conn.connectHandle);
                Debug("[CSR]:OnHostConnectResult Success");
                OnDeviceConnectEvent("蓝牙连接 SUCCESS:" + gattDevice.Address);
            }
            else
            {
                gattDevice.Connected = false;
                Debug("[CSR]:OnHostConnectResult Fail");
                OnDeviceConnectEvent("蓝牙连接 FAIL:" + gattDevice.Address);
            }

            _connectEvent.Set();
        }