// Send device serial number over property update. private async Task SendDeviceSerialNumberAsync(CancellationToken cancellationToken) { string propertyName = "serialNumber"; string propertyPatch = PnpHelper.CreatePropertyPatch(propertyName, JsonConvert.SerializeObject(SerialNumber)); var reportedProperties = new TwinCollection(propertyPatch); await _deviceClient.UpdateReportedPropertiesAsync(reportedProperties, cancellationToken); _logger.LogDebug($"Property: Update - {{ \"{propertyName}\": \"{SerialNumber}\" }} is {StatusCode.Completed}."); }
private async Task UpdateMaxTemperatureSinceLastRebootAsync(string componentName, CancellationToken cancellationToken) { string propertyName = "maxTempSinceLastReboot"; double maxTemp = _maxTemp[componentName]; string propertyPatch = PnpHelper.CreatePropertyPatch(propertyName, JsonConvert.SerializeObject(maxTemp), componentName); var reportedProperties = new TwinCollection(propertyPatch); await _deviceClient.UpdateReportedPropertiesAsync(reportedProperties, cancellationToken); _logger.LogDebug($"Property: Update - component=\"{componentName}\", {{ \"{propertyName}\": {maxTemp}°C }} is {StatusCode.Completed}."); }