Example #1
0
        private void InitScanner()
        {
            if (IsAfterLollipop && !(Filters?.Any() ?? false))
            {
                if (Filters == null)
                {
                    Filters = new List <ScanFilter>();
                }
                else
                {
                    Filters.Clear();
                }
                Filters.Add(new ScanFilter.Builder().SetServiceUuid(BcoreUuid.BcoreScanUuid).Build());
            }

            if (IsAfterLollipop && ScanSettings == null)
            {
                ScanSettings = new ScanSettings.Builder().SetScanMode(ScanMode.Balanced).Build();
            }

            if (IsAfterLollipop && Callback == null)
            {
                Callback = new ScanCallback(this);
            }

            if (!IsAfterLollipop && LeCallback == null)
            {
                LeCallback = new LeScanCallback(this);
            }
        }
Example #2
0
        /// <summary>
        /// Starts the BLE Scan
        /// </summary>
        public void startLEScan()
        {
            startScanUIPrep();
            _devicesFound = new List <BluetoothDevice>();

            // Starting Timer
            _scanTimeout.Enabled = true;

            // Starting Scan
            _scanCallBack = new LeScanCallback();
            _adpt.StartLeScan(_scanCallBack);
        }