
上QQ阅读APP看书,第一时间看更新
How to do it...
In this section, we will create a device job to update the device twin properties:
- 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);
- 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);
}