Beispiel #1
0
        protected virtual void StartNewScanner(bool bgScan)
        {
            this.newCallback = new LollipopScanCallback(args => this.Scanned?.Invoke(this, args));
            var scanMode = bgScan ? ScanMode.LowPower : ScanMode.Balanced;

            this.manager.Adapter.BluetoothLeScanner.StartScan(
                null,
                new ScanSettings
                .Builder()
                .SetScanMode(scanMode)
                .Build(),
                this.newCallback
                );
        }
Beispiel #2
0
        protected virtual void StartNewScanner(ScanConfig config)
        {
            this.newCallback = new LollipopScanCallback(args => this.Scanned?.Invoke(this, args));
            var scanMode      = config.IsLowPoweredScan ? ScanMode.LowPower : ScanMode.Balanced;
            var filterBuilder = new ScanFilter.Builder();

            if (config.ServiceUuid != null)
            {
                filterBuilder.SetServiceUuid(config.ServiceUuid.Value.ToParcelUuid());
            }

            //new ScanFilter.Builder().SetDeviceAddress().Set
            this.manager.Adapter.BluetoothLeScanner.StartScan(
                new [] { filterBuilder.Build() },
                new ScanSettings
                .Builder()
                .SetScanMode(scanMode)
                .Build(),
                this.newCallback
                );
        }