public TempSensor(string thingPropertiesURI) { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver, thingPropertiesURI); Stop = false; Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("Temperature Sensor started"); }
public ThroughputReader() { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver); Stop = false; Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("Throughput reader started"); }
public Ping(string thingPropertiesURI) { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver, thingPropertiesURI); SampleData = new IotNvpSeq(); Stop = false; Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("# Ping started"); }
public Dashboard(string thingPropertiesURI) { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver, thingPropertiesURI); Stop = false; TruckData = new Dictionary <string, TruckDataValue>(); Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("Dashboard started"); }
public DistanceServiceThing(string thingPropertiesURI, float latitude, float longitude) { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver, thingPropertiesURI); WarehouseLat = latitude; WarehouseLng = longitude; Stop = false; Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("Distance Service started"); }
public GPSSensor(string thingPropertiesURI, float latitude, float longitude) { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver, thingPropertiesURI); TruckLat = latitude; TruckLng = longitude; Stop = false; Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("GPS Sensor started"); }
public GatewayService(string thingPropertiesURI, int windowHeight) { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver, thingPropertiesURI); Stop = false; WindowHeightInLines = windowHeight; var comparer = new DataFlowKeyComparer(); SampleCount = new Dictionary <DataFlowKey, DataFlowValue>(comparer); Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("Gateway Service started"); }
public Camera(string thingPropertiesURI) { DataRiver = DataRiver.GetInstance(); Thing = CreateThing(DataRiver, thingPropertiesURI); RelatedCameras = new Dictionary <string, string>(); Threads = new List <Thread>(); Stop = false; Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("Camera started"); SetState("on"); }
public ThingBrowser(string thingPropertiesURI) { DataRiver = DataRiver.GetInstance(); // Add listener for discovery of Things CustomDispatcher = new Dispatcher(); NewThingListener = new NewThingDiscoveredListener(DataRiver); DataRiver.AddListener(NewThingListener, CustomDispatcher); Thing = CreateThing(DataRiver, thingPropertiesURI); Stop = false; Console.CancelKeyPress += this.CtrlCHandler; Console.WriteLine("ThingBrowser started"); }
public void Dispose() { // Remove the discovered Thing listener that was added during class initialization try { DataRiver.RemoveListener(NewThingListener, CustomDispatcher); } catch (ThingAPIException e) { Console.WriteLine($"Unexpected error while removing discovered Thing listener: {e.Message}"); } DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("ThingBrowser stopped"); }
public void Dispose() { try { // Set camera state to 'off' SetState("off"); } catch (ThingAPIException e) { Console.WriteLine($"Error setting camera state to off: {e.Message}"); } // Stop and join threads Closed = true; foreach (Thread myThread in Threads) { myThread.Join(); } DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("Camera stopped"); }
public void Dispose() { DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("Dashboard stopped"); }
public void Dispose() { DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("GPS Sensor stopped"); }
public void Dispose() { DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("Temperature Sensor stopped"); }
public void Dispose() { DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("# Ping stopped"); }
public void Dispose() { DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("Throughput reader stopped"); }
public void Dispose() { DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("Gateway Service stopped"); }
public void Dispose() { DataRiver.Close(); DataRiver.Dispose(); Console.WriteLine("Rotational Speed Sensor stopped"); }
public int Run(ulong runningTime, string barcodeFilePath) { StartTimestamp = DateTime.Now; int barcodeIndex = 0; DateTime barcodeTimestamp = StartTimestamp.AddMilliseconds(-BarcodeIntervalMS); // Get barcodes List <string> barcodes = ReadBarCodes(barcodeFilePath); if (barcodes.Count == 0) { Console.WriteLine("Error: no barcodes found"); return(1); } // Add listener for new Things var cameraDiscoveredListener = new CameraThingDiscoveredListener(this); DataRiver.AddListener(cameraDiscoveredListener); // Add listener for lost Things var cameraLostListener = new CameraThingLostListener(this); DataRiver.AddListener(cameraLostListener); // Check for related camera already in the discovered things registry System.Threading.Thread.Sleep(CameraInitialDelayMS); CheckRegistryForRelatedCameras(); do { var now = DateTime.Now; // Check if next barcode should be read if (barcodeIndex < barcodes.Count && ((now.Subtract(barcodeTimestamp).TotalSeconds * 1000) > BarcodeIntervalMS)) { string barcode = barcodes[barcodeIndex]; barcodeIndex++; // Randomly skip some of the barcodes if (StaticRandom.Rand(0, 100) > BarcodeSkipPercentage) { ParameterizedThreadStart pts = new ParameterizedThreadStart(BarcodeTask); Thread t = new Thread(pts); Threads.Add(t); t.Start(barcode); } // Update timestamp barcodeTimestamp = now; } // Sleep for some time System.Threading.Thread.Sleep(CameraDelayMS); } while (!Stop && SecondsExecuting(StartTimestamp) < runningTime); // Remove listeners DataRiver.RemoveListener(cameraLostListener); DataRiver.RemoveListener(cameraDiscoveredListener); return(0); }
public NewThingDiscoveredListener(DataRiver dr) { MyDataRiver = dr; }