public ProcessBufferedReadings(string name, IPriorityCollection<TagInfo> readingsQueue) { sleepTime = Config.Instance.SleepTime; System.Console.WriteLine("Sleep time is: " + sleepTime); this.Name = name; this.readingsQueue = readingsQueue; leftCloud = new Dictionary<TagId, bool>(MaximumNumberOfTags); }
/// <summary> /// Constructor. /// </summary> public RaceResultsForm() { InitializeComponent(); // Wire-up the listeners, passdetector and loggers. SetupLogger(); // Create the queues to handle thread-safe queuing. readingsQueue = new PriorityCollectionNonBlocking<TagInfo>("Queue", 1024); passingsQueue = new PriorityCollectionNonBlocking<TagInfo>("Queue", 1024); // Start the GUI update timer. viewUpdateTimer.Start(); }
public Form1() { InitializeComponent(); readingsQueue = new PriorityCollectionBlocking<TagInfo>("Queue", 50); }
/// <summary> /// Constructor. /// </summary> public BufferReadings(IPriorityCollection<TagInfo> readingsQueue) { this.readingsQueue = readingsQueue; }
private void startCollectingDataButton_Click(object sender, EventArgs e) { //MessageBox.Show("SleepTime is: " + Config.Instance.SleepTime + "; PortNumber is: " + Config.Instance.PortNumber); startCollectingDataButton.Enabled = false; stopCollectingDataButton.Enabled = true; //so that user won't switch during the event: this.selectedRaceComboBox.Enabled = false; this.eventComboBox.Enabled = false; ResetRaceStandingsGrid(); //passingsDataGrid.DataSource = new BindingList<PassingsInfo>(); readingsLogger = new TagSubscriber(LogReadings); passingsLogger = new TagSubscriber(LogPassings); readingsQueue = new PriorityCollectionNonBlocking<TagInfo>("Queue", 1024); passingsQueue = new PriorityCollectionNonBlocking<TagInfo>("Queue", 1024); #if V15 HardcardServer.NetworkPort = Properties.Settings.Default.PortNumber; HardcardServer.PassingSleepTime = 1000; server = new HardcardServer("Hardcard Race System"); //LoggerConsole log = new LoggerConsole(); //LoggerSummary countLogger = new LoggerSummary(); //LoggerBinary binaryLog = new LoggerBinary("tagReadings.bin"); //binaryLog.AddPublisher(server.IndividualReadingPublisher); //countLogger.AddPublisher(server.IndividualReadingPublisher); //countLogger.DesiredTagTypes = TagEventType.Read; readingsLogger.AddPublisher(server.PassingsPublisher); readingsLogger.DesiredTagTypes = TagEventType.PassDetermined; passingsLogger.AddPublisher(server.PassingsPublisher); passingsLogger.DesiredTagTypes = TagEventType.PassDetermined; bool useXML = Properties.Settings.Default.useXML; networkFeed = new NetworkPublisher(useXML); networkFeed.Server = Properties.Settings.Default.serverIP; networkFeed.Port = Properties.Settings.Default.serverPortNumber; networkFeed.AddPublisher(server.PassingsPublisher); networkFeed.DesiredTagTypes = TagEventType.PassDetermined; networkFeed.Start(); server.Start(); #else int portNumber = Properties.Settings.Default.PortNumber; networkListener = new NetworkListener("Race Host",portNumber); int initialCapacity = 10000; PriorityCollectionBlocking<TagInfo> queue = new PriorityCollectionBlocking<TagInfo>("Queue", initialCapacity); // The queue above is used to communicate between the buffer below and the passDetector. BufferReadings buffer = new BufferReadings(queue); passDetector = new ProcessBufferedReadings("Pass Detector", queue); buffer.AddPublisher(networkListener); // Subscribe the loggers to the publishers. readingsLogger.AddPublisher(networkListener); passingsLogger.AddPublisher(passDetector); passDetector.Start(); networkListener.Start(); #endif }