Beispiel #1
0
        private static async void SendTwinData()
        {
            var twinProperties = new Microsoft.Azure.Devices.Shared.TwinCollection();

            twinProperties["TelemetryInterval"] = "12";
            await s_deviceClient.UpdateReportedPropertiesAsync(twinProperties);
        }
Beispiel #2
0
 private Task twinDesiredPropertiesUpdated(Microsoft.Azure.Devices.Shared.TwinCollection twins, object context)
 {
     return(Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                () =>
     {
         OutputLabel.Text = JsonConvert.SerializeObject(twins);
     }).AsTask());
 }
Beispiel #3
0
 private static async Task UpdateDesiredProperty(TwinCollection desiredProperties, object userContext)
 {
     Console.WriteLine("Desired property change:");
     if (desiredProperties["TelemetryInterval"] != null)
     {
         var twinProperties = new Microsoft.Azure.Devices.Shared.TwinCollection();
         twinProperties["TelemetryInterval"] = desiredProperties["TelemetryInterval"];
         await s_deviceClient.UpdateReportedPropertiesAsync(twinProperties);
     }
 }
        // Supporting methods
        private static async Task OnDesiredPropertyChanged(Microsoft.Azure.Devices.Shared.TwinCollection desiredProperties, object userContext)
        {
            Dictionary <string, string> returnDict = new Dictionary <string, string>();

            Console.WriteLine("desired property change:");
            Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(desiredProperties));
            desiredProperties.OfType <KeyValuePair <string, object> >().All(s =>
            {
                returnDict.Add(s.Key, s.Value.ToString());
                return(true);
            });

            await Task.Delay(100);

            await((LibCallback)userContext)(returnDict);
            return;
        }
 /// <summary>
 /// Creates an instance of <see cref="Twin"/>
 /// </summary>
 /// <param name="twinProperties"></param>
 public Twin(TwinProperties twinProperties)
 {
     Tags       = new TwinCollection();
     Properties = twinProperties;
 }
 /// <summary>
 /// Creates an instance of <see cref="Twin"/>
 /// </summary>
 public Twin()
 {
     Tags       = new TwinCollection();
     Properties = new TwinProperties();
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of <see cref="TwinProperties"/>
 /// </summary>
 public TwinProperties()
 {
     Desired  = new TwinCollection();
     Reported = new TwinCollection();
 }
Beispiel #8
0
 /// <summary>
 /// Creates an instance of <see cref="TwinState"/>
 /// </summary>
 public TwinState()
 {
     Tags = new TwinCollection();
     DesiredProperties = new TwinCollection();
 }