Skip to Content
Azure IoT Development Cookbook
book

Azure IoT Development Cookbook

by Yatish Patil
August 2017
Intermediate to advanced
254 pages
6h 10m
English
Packt Publishing
Content preview from Azure IoT Development Cookbook

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);            }
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Azure Serverless Computing Cookbook - Third Edition

Azure Serverless Computing Cookbook - Third Edition

Praveen Kumar Sreeram, Kasam Shaikh, Greg Leonardo

Publisher Resources

ISBN: 9781787283008Supplemental Content