private void DataReceivedHandler( object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (SerialPort)sender; string s = sp.ReadExisting().TrimEnd('\r', '\n'); nfc_code += s; if (nfc_code.Length == 8) { callback?.Invoke(nfc_code); callback = null; nfc_code = ""; } }
public void Read(NfcReadCallback cb) { callback = cb; }