extens reader
This commit is contained in:
@@ -16,7 +16,7 @@ namespace RfidClass
|
||||
public RFIDReaderClass(string com)
|
||||
{
|
||||
this.t = new Thread(this.reader);
|
||||
s = new SerialPort(com, 9600, Parity.None, 8, StopBits.One);
|
||||
s = new SerialPort(com, 115200, Parity.None, 8, StopBits.One);
|
||||
}
|
||||
|
||||
private void reader()
|
||||
@@ -65,16 +65,18 @@ namespace RfidClass
|
||||
|
||||
public long readKey()
|
||||
{
|
||||
this.e = null;
|
||||
this.t = new Thread(this.reader);
|
||||
this.id = 0;
|
||||
this._stop = false;
|
||||
try
|
||||
{
|
||||
this.s.Open();
|
||||
if(!s.IsOpen)
|
||||
this.s.Open();
|
||||
}
|
||||
catch (Exception exeption)
|
||||
{
|
||||
//throw exeption;
|
||||
throw exeption;
|
||||
}
|
||||
this.t.Start();
|
||||
while (!this.t.IsAlive) ;
|
||||
@@ -84,6 +86,7 @@ namespace RfidClass
|
||||
{
|
||||
this._stop = true;
|
||||
}
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
if (this.e != null)
|
||||
{
|
||||
@@ -95,6 +98,14 @@ namespace RfidClass
|
||||
public void abort()
|
||||
{
|
||||
this._stop = true;
|
||||
this.reset();
|
||||
this.s.Close();
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
if (s.IsOpen)
|
||||
this.s.Write("9");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user