You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,53 @@ DeviceClient azureIoT = new DeviceClient(IotBrokerAddress, DeviceID, SasKey, mod
110
110
111
111
Note: the model ID has to be passed at the creation of the DeviceClient, it is not possible to pass it later on.
112
112
113
+
#### Reporting properties
114
+
115
+
Reporting Plug & Play properties is supported. He is a comprehensive example and how you can check if you have received one property that you're interested in:
In this example, the property we are interested in to receive is called `targetTemperature`. To receive its update, we are subscribing to the twin update. And we can get the value thu the `e.Twin[TargetTemerature]` once we've checked that the property exist.
139
+
140
+
The patter to publish a writable property is then quite simple. it's about building a `PropertyAcknowledge`, creating a TwinCollection, adding it to it with the property name, here our `targetTemperature`. You can add more properties to report of course. Note that what you add to the TwinCollection is not directly the object but `BuildAcknowledge()`. One done, just ask the library to update the twin through the `UpdateReportedProperties` method.
141
+
142
+
#### Receiving commands
143
+
144
+
An IoT Plug & Play command is a method callback. See further in this document how you can use them. In our case, the method is called `getMaxMinReport`. The name of the method in C# **must** be the exact same as the name from the DTDL file.
In this example, the expected result is an object. Just populate the object and serialize it as a json as the command expect and return it. If any parameter to this command, it will be in the payload.
159
+
113
160
### Getting and updating Twin
114
161
115
162
You can request your Azure IoT Twin simply by calling the `GetTwin` function.
0 commit comments