public async Task SimulateHVACEvents() { deviceId = "3"; RegisterDeviceAsync().Wait(); bool deviceActivated = await ActivateDeviceAsync(); if (deviceActivated) { InitDeviceClient(); stopWatch.Restart(); numEventsSent = 0; LogStatus("Sending HVAC Events..."); SensorBase sensor = new HVACSensor(deviceId, TransmitEvent); sensor.InitSchedule(10); Console.WriteLine("Generated {0:###,###,###} Events", sensor.CountOfDataPoints); sensor.Start().Wait(); FlushIoTHubBuffer(); stopWatch.Stop(); Console.WriteLine("Completed transmission in {0} seconds. Sent {1:###,###,###} events.", stopWatch.Elapsed.TotalSeconds, numEventsSent); } else { LogError("Device Not Activated."); } }
public void SimulateHVACEvents() { stopWatch.Restart(); numEventsSent = 0; LogStatus("Sending HVAC Events..."); SensorBase sensor = new HVACSensor("3", TransmitEvent); sensor.InitSchedule(10); Console.WriteLine("Generated {0:###,###,###} Events", sensor.CountOfDataPoints); sensor.Start().Wait(); FlushEventHubBuffer(); stopWatch.Stop(); Console.WriteLine("Completed transmission in {0} seconds. Sent {1:###,###,###} events.", stopWatch.Elapsed.TotalSeconds, numEventsSent); }