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
You see the following output, indicating the device is now ready to receive commands and property updates, and has begun sending telemetry data to the hub.
Keep the sample running as you complete the next steps.
77
+
You see messages saying that the device is connected, performing various setup steps, and waiting for service updates, followed by telemetry logs. This indicates that the device is now ready to receive commands and property updates, and has begun sending telemetry data to the hub. Keep the sample running as you complete the next steps.
82
78
83
79
## Use the Azure IoT explorer to validate the code
1. You see messages saying that the device is connected and waiting for service updates, followed by telemetry logs. This indicates that the device is now ready to receive commands and property updates, and has begun sending telemetry data to the hub. Keep the sample running as you complete the next steps. Don't close this terminal, you'll need it later to confirm the service samples also worked.
65
+
1. You see messages saying that the device is connected, performing various setup steps, and waiting for service updates, followed by telemetry logs. This indicates that the device is now ready to receive commands and property updates, and has begun sending telemetry data to the hub. Keep the sample running as you complete the next steps. Don't close this terminal, you'll need it later to confirm the service samples also worked.
66
66
67
67
## Run the sample solution
68
68
69
69
In this quickstart, you use a sample IoT solution in Java to interact with the sample device.
70
70
71
71
1. Open another terminal window (this will be your _service_ terminal). Go to the folder of your cloned repository, and navigate to the **/azure-iot-samples-java\digital-twin\Samples\service\JdkSample** folder.
72
72
73
+
1. Install the required libraries and build the simulated device application by running the following command:
74
+
75
+
```cmd/sh
76
+
mvn clean install -DskipTests
77
+
```
78
+
73
79
1. Configure the _IoT hub connection string_ and _device ID_ to allow the service to connect to both of these:
74
80
75
81
```cmd/sh
@@ -79,7 +85,7 @@ In this quickstart, you use a sample IoT solution in Java to interact with the s
79
85
80
86
### Read a property
81
87
82
-
1. When you connected the _device_ in its terminal, you saw the following message indicating its online status. The `state` property, which is used to indicate whether or not the device is online, is _true_:
88
+
1. When you connected the _device_ in its terminal, one of the output messages was the following message to indicate its online status. The `state` property, which is used to indicate whether or not the device is online, is _true_:
83
89
84
90
```cmd/sh
85
91
State of environmental sensor was set to true
@@ -133,9 +139,7 @@ In this quickstart, you use a sample IoT solution in Java to interact with the s
133
139
"desired": {
134
140
"value": "42"
135
141
}
136
-
}
137
-
}
138
-
}
142
+
},
139
143
```
140
144
141
145
1. Go to your _device_ terminal, you see the device has received the update:
@@ -152,26 +156,33 @@ In this quickstart, you use a sample IoT solution in Java to interact with the s
152
156
3. In the _service_ terminal output, under the `environmentalSensor` component, you see the updated brightness value has been reported. Note: it might take a while for the device to finish the update. You can repeat this step until the device has actually processed the property update.
153
157
154
158
```json
155
-
"environmentalSensor": {
156
-
"name": "environmentalSensor",
157
-
"properties": {
158
-
"brightness": {
159
-
"reported": {
160
-
"value": {
161
-
"value": "42"
162
-
},
163
-
"desiredState": {
164
-
"code": 200,
165
-
"version": 2,
166
-
"description": "OK"
167
-
}
168
-
},
169
-
"desired": {
170
-
"value": "42"
171
-
}
159
+
"environmentalSensor" : {
160
+
"name" : "environmentalSensor",
161
+
"properties" : {
162
+
"brightness" : {
163
+
"reported" : {
164
+
"value" : {
165
+
"value" : "42"
166
+
},
167
+
"desiredState" : {
168
+
"code" : 200,
169
+
"version" : 2,
170
+
"description" : "OK"
172
171
}
172
+
},
173
+
"desired" : {
174
+
"value" : "42"
175
+
}
176
+
},
177
+
"state" : {
178
+
"reported" : {
179
+
"value" : true,
180
+
"desiredState" : null
181
+
},
182
+
"desired" : null
173
183
}
174
-
}
184
+
}
185
+
},
175
186
```
176
187
177
188
### Invoke a command
@@ -193,14 +204,14 @@ In this quickstart, you use a sample IoT solution in Java to interact with the s
193
204
194
205
```cmd/sh
195
206
Invoking blink on device <YourDeviceID> with interface instance name environmentalSensor
196
-
Command invoked on the device successfully, the returned status was 500 and the request id was <some ID value>
207
+
Command invoked on the device successfully, the returned status was 200 and the request id was <some ID value>
197
208
The returned PAYLOAD was
198
209
```
199
210
200
211
1. Go to the _device_ terminal, you see the command has been acknowledged:
0 commit comments