Beispiel #1
0
        private void listBoxDeviceSearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            SelectDeviceString = listBoxDeviceSearch.Text?.ToString();
            SelectAddr         = BleGattDevice.GetAddress(SelectDeviceString);

            CsrBleControl.Only().BleHostScanStop();
        }
        private void listBoxDeviceSearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            _selectSearchDeviceString = listBoxDeviceSearch.SelectedItem.ToString();
            _selectSearchAddress      = BleGattDevice.GetAddress(_selectSearchDeviceString);

            CsrBleControl.Only().BleHostScanStop();
        }
        private async void buttonDisconnect_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(_selectConnectDeviceString))
            {
                await CsrBleControl.Only().BleHostDisconnect(BleGattDevice.GetAddress(_selectConnectDeviceString));

                OnDeviceConnectResults(CsrBleControl.Only().GattConnectDevices);

                _selectConnectDeviceString        = string.Empty;
                listBoxDeviceConnect.SelectedItem = null;
            }
            else
            {
                await CsrBleControl.Only().BleHostDisconnect();

                OnDeviceConnectResults(null);
            }
        }