public async Task SimulateMotionEvents() { deviceId = "2"; RegisterDeviceAsync().Wait(); bool deviceActivated = await ActivateDeviceAsync(); if (deviceActivated) { InitDeviceClient(); stopWatch.Restart(); numEventsSent = 0; LogStatus("Sending Motion Events..."); SensorBase sensor = new MotionSensor(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 SimulateMotionEvents() { stopWatch.Restart(); numEventsSent = 0; LogStatus("Sending Motion Events..."); SensorBase sensor = new MotionSensor("2", 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); }