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

            twinProperties["TelemetryInterval"] = "12";
            await s_deviceClient.UpdateReportedPropertiesAsync(twinProperties);
        }
Exemplo n.º 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());
 }
Exemplo n.º 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;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Creates an instance of <see cref="Twin"/>
 /// </summary>
 /// <param name="twinProperties"></param>
 public Twin(TwinProperties twinProperties)
 {
     Tags       = new TwinCollection();
     Properties = twinProperties;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates an instance of <see cref="Twin"/>
 /// </summary>
 public Twin()
 {
     Tags       = new TwinCollection();
     Properties = new TwinProperties();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of <see cref="TwinProperties"/>
 /// </summary>
 public TwinProperties()
 {
     Desired  = new TwinCollection();
     Reported = new TwinCollection();
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates an instance of <see cref="TwinState"/>
 /// </summary>
 public TwinState()
 {
     Tags = new TwinCollection();
     DesiredProperties = new TwinCollection();
 }