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

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);
}
主站蜘蛛池模板: 青海省| 绥棱县| 崇义县| 瑞丽市| 雷州市| 泽州县| 称多县| 开封市| 阜城县| 广元市| 连江县| 白银市| 土默特左旗| 社会| 大庆市| 德令哈市| 民丰县| 鹤峰县| 克拉玛依市| 庐江县| 光山县| 江门市| 若尔盖县| 崇文区| 清苑县| 柏乡县| 河东区| 高台县| 松潘县| 防城港市| 板桥市| 湖南省| 宜丰县| 二连浩特市| 洪洞县| 张家口市| 台北市| 正阳县| 嵊州市| 辉南县| 锡林浩特市|