官术网_书友最值得收藏!

How to do it...

In this section, we will create a device job to update the device twin properties:

  1. We will create a job to update device twin properties:
var twin = new Twin();
twin.Properties.Desired["HighTemperature"] = "44";
twin.Properties.Desired["City"] = "Mumbai";
twin.ETag = "*";

return await jobClient.ScheduleTwinUpdateAsync(jobId,
"deviceId='"+ deviceId + "'",
twin,
DateTime.Now,
10);
  1. We will use following code to get the device job status, which was initiated in step 1:
JobClient jobClient;
JobClient jobClient;jobClient = JobClient.CreateFromConnectionString(abc.GetConnectionString());

public async Task<JobResponse> MonitorJob(string jobId, JobClient jobClient)
{
return await jobClient.GetJobAsync(jobId);
}
主站蜘蛛池模板: 定襄县| 阜阳市| 抚松县| 大埔县| 宿迁市| 岱山县| 汪清县| 西藏| 佛冈县| 和龙市| 叶城县| 岐山县| 台州市| 绵竹市| 宁津县| 廊坊市| 阿坝县| 鄂伦春自治旗| 通州区| 磴口县| 黄石市| 神木县| 乌兰浩特市| 乌鲁木齐县| 靖江市| 个旧市| 历史| 宁国市| 康马县| 永丰县| 万源市| 特克斯县| 托克托县| 柞水县| 慈利县| 台江县| 沧州市| 二连浩特市| 南康市| 乌审旗| 温泉县|