// Async method to send simulated telemetry. private static async void SendDeviceToCloudMessagesAsync() { var conveyor = new ConveyorBeltSimulator(intervalInMilliseconds); // Simulate the vibration telemetry of a conveyor belt. while (true) { var vibration = conveyor.ReadVibration(); await CreateTelemetryMessage(conveyor, vibration); await Task.Delay(intervalInMilliseconds); } }
// Async method to send simulated telemetry. private static async void SendDeviceToCloudMessagesAsync() { // The ConveyorBeltSimulator class is used to create a // ConveyorBeltSimulator instance named `conveyor`. The `conveyor` // object is first used to capture a vibration reading which is // placed into a local `vibration` variable, and is then passed to // the two create message methods along with the `vibration` value // that was captured at the start of the interval. var conveyor = new ConveyorBeltSimulator(intervalInMilliseconds); // Simulate the vibration telemetry of a conveyor belt. while (true) { var vibration = conveyor.ReadVibration(); await CreateTelemetryMessage(conveyor, vibration); await CreateLoggingMessage(conveyor, vibration); await Task.Delay(intervalInMilliseconds); } }