Hands-on lab/lab-files/starter-project/SmartMeterSimulator/Sensor.cs
/// <summary>
/// Send a message to the IoT Hub from the Smart Meter device
/// </summary>
Send a message to the IoT Hub from the Smart Meter device
Send a message to the IoT Hub from the Smart Meter device
public async void SendMessageAsync()
        {
            var telemetryDataPoint = new
            {
                id = DeviceId,
                time = DateTime.UtcNow.ToString("o"),
                temp = CurrentTemperature
            };
        }
public async void SendMessageAsync ( ) { var telemetryDataPoint = new { id = DeviceId , time = DateTime . UtcNow . ToString ( " " ) , temp = CurrentTemperature } ; }
Send a message to the IoT Hub from the Smart Meter device
Send a message to the IoT Hub from the Smart Meter device
//TODO: 18.Serialize the telemetryDataPoint to JSON //var messageString = JsonConvert...; //TODO: 19.Encode the JSON string to ASCII as bytes and create new Message with the bytes //var message = new Message(...); //TODO: 20.Send the message to the IoT Hub //var sendEventAsync = _DeviceClient?.SendEventAsync(...); //if (sendEventAsync != null) await...;