public void Start(CancellationTokenSource cancellationToken) { try { EmulatedServer.Init(recoveryFileName); EmulatedServer.StartReading(); read = new Read() { ID = 0, AntennaNumber = "2", IpAddress = "127.0.0.1", ReaderNumber = "1", EPC = "TAG_12", UniqueReadingID = Guid.NewGuid().ToString(), PeakRssiInDbm = "-11dBm", TimingPoint = "Spotter" }; do { Thread.Sleep(1500); read.Time = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); read.ID++; read.UniqueReadingID = Guid.NewGuid().ToString(); WriteReadingInFile(read); EmulatedServer.OnTagRead(read); } while (!cancellationToken.IsCancellationRequested); } catch (Exception ex) { Debug.WriteLine(string.Format("{0}: {1}\n{2}", nameof(this.Start), ex.Message, ex.StackTrace)); } }
public void StopServer() { EmulatedServer.Stop(); }
public void DisposeServer() { EmulatedServer.Dispose(); }