Пример #1
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     this.manager                     = new ABTBluetoothReaderManager();
     this.ManagerDelegate             = new ReaderManagerDelegate(this);
     this.manager.WeakDelegate        = this.ManagerDelegate;
     this.centralManager              = new CBCentralManager(this, null);
     this.centralManager.WeakDelegate = this;
     this.peripherals                 = new List <CBPeripheral>();
     // Perform any additional setup after loading the view, typically from a nib.
 }
Пример #2
0
        public override void DidDetectReader(ABTBluetoothReaderManager bluetoothReaderManager, ABTBluetoothReader reader, CBPeripheral peripheral, NSError error)
        {
            if (error == null)
            {
                _helper.Reader?.Detach();

                _helper.Reader              = reader;
                _helper.ReaderDelegate      = new ReaderDelegate(_helper);
                _helper.Reader.WeakDelegate = _helper.ReaderDelegate;
                _helper.Reader.AttachPeripheral(peripheral);
            }
            else
            {
                // Disconnect, not a reader:
                //_helper.centralManager.CancelPeripheralConnection(peripheral); // TODO: Maybe needed?
            }
        }