// Send device serial number over property update.
        private async Task SendDeviceSerialNumberAsync(CancellationToken cancellationToken)
        {
            const string   propertyName       = "serialNumber";
            TwinCollection reportedProperties = PnpConvention.CreatePropertyPatch(propertyName, SerialNumber);

            await _deviceClient.UpdateReportedPropertiesAsync(reportedProperties, cancellationToken);

            _logger.LogDebug($"Property: Update - {{ \"{propertyName}\": \"{SerialNumber}\" }} is complete.");
        }
示例#2
0
 private static async Task UpdateProperty(string propertyName, string v)
 {
     TwinCollection reportedProperties = PnpConvention.CreatePropertyPatch(propertyName, v);
     await deviceClient.UpdateReportedPropertiesAsync(reportedProperties);
 }