public void Open(NfcTagType nfcTagType) { this.nfcTagType = nfcTagType; // map NFC tag type to PN532 target type (baud rate/protocol) this.targetType = this.NfcToPN532Type(nfcTagType); this.isRunning = true; this.nfcTagConn = null; // get info and configure PN532 ic this.pn532.GetFirmwareVersion(); this.pn532.SAMConfiguration(PN532.SamMode.NormalMode, false); // start thread for tag detection this.detectionThread = new Thread(this.DetectionThread); this.detectionThread.Start(); }
public async Task Open(NfcTagType nfcTagType) { this._nfcTagType = nfcTagType; // map NFC tag type to PN532 target type (baud rate/protocol) _targetType = NfcToPn532Type(nfcTagType); _nfcTagConn = null; // get info and configure PN532 ic await _pn532.GetFirmwareVersion(); await _pn532.SAMConfiguration(PN532.SamMode.NormalMode, false); _isRunning = true; // start thread for tag detection await Task.Factory.StartNew(DetectionThread, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default); }
public void Open(NfcTagType nfcTagType) { this.nfcTagType = nfcTagType; // map NFC tag type to PN532 target type (baud rate/protocol) this.targetType = this.NfcToPN532Type(nfcTagType); this.isRunning = true; this.nfcTagConn = null; // get info and configure PN532 ic this.pn532.GetFirmwareVersion(); this.pn532.SAMConfiguration(PN532.SamMode.NormalMode, false); // start thread for tag detection this.detectionThread = new Thread(this.DetectionThread); this.detectionThread.Start(); }