コード例 #1
0
ファイル: Program.cs プロジェクト: PankajRawat333/iot-central
        private static async void SendTwinData()
        {
            var twinProperties = new Microsoft.Azure.Devices.Shared.TwinCollection();

            twinProperties["TelemetryInterval"] = "12";
            await s_deviceClient.UpdateReportedPropertiesAsync(twinProperties);
        }
コード例 #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());
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: PankajRawat333/iot-central
 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);
     }
 }
コード例 #4
0
        // 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;
        }
コード例 #5
0
 /// <summary>
 /// Creates an instance of <see cref="Twin"/>
 /// </summary>
 /// <param name="twinProperties"></param>
 public Twin(TwinProperties twinProperties)
 {
     Tags       = new TwinCollection();
     Properties = twinProperties;
 }
コード例 #6
0
 /// <summary>
 /// Creates an instance of <see cref="Twin"/>
 /// </summary>
 public Twin()
 {
     Tags       = new TwinCollection();
     Properties = new TwinProperties();
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of <see cref="TwinProperties"/>
 /// </summary>
 public TwinProperties()
 {
     Desired  = new TwinCollection();
     Reported = new TwinCollection();
 }
コード例 #8
0
 /// <summary>
 /// Creates an instance of <see cref="TwinState"/>
 /// </summary>
 public TwinState()
 {
     Tags = new TwinCollection();
     DesiredProperties = new TwinCollection();
 }