Example #1
0
        private bool SD_Connect()
        {
            _ble.TiConnect(dps.MacBytes());

            // wait for connection
            if (!WaitForConnection())
            {
                return(false);
            }
            return(true);
        }
Example #2
0
        private void TestConnection()
        {
            if (_checkConnection == false)
            {
                return;
            }

            #region Disconnect the last connected device
            if (last_connected_device != null)
            {
                if (last_connected_device.Connected == true)
                {
                    _dongle.TerminateLinkRequest(last_connected_device.Handle);
                }
            }
            #endregion

            #region Connect to the next device
            next_dps_to_connect++;
            if (grdTargets.Rows.Count <= next_dps_to_connect)
            {
                next_dps_to_connect = 0;
            }

            DataGridViewRow row    = grdTargets.Rows[next_dps_to_connect];
            BleDevice       device = BleDevices.GetDeviceByMac(row.Cells["colMAC"].Value.ToString());
            last_connected_device = device;
            if (device != null)
            {
                if (!device.Connected)
                {
                    _dongle.TiConnect(device.MacBytes());
                }
            }
            #endregion
        }