|
46 | 46 | * IoT devices and registries, using both RSA and eliptic curve keys for authentication.
|
47 | 47 | *
|
48 | 48 | * <p>To start, follow the instructions on the Developer Guide at cloud.google.com/iot to create a
|
49 |
| - * service_account.json file. Also create a Cloud Pub/Sub topic as discussed in the guide. After |
50 |
| - * doing this, you should have service_account.json in your directory. Tell gcloud about this file |
51 |
| - * by setting it in an environment variable: |
52 |
| - * |
53 |
| - * <pre> |
54 |
| - * <code> |
55 |
| - * $ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json |
56 |
| - * </code> |
57 |
| - * </pre> |
| 49 | + * service_account.json file and Cloud Pub/Sub topic as discussed in the guide. You will then need |
| 50 | + * to point to the service_account.json file as described in |
| 51 | + * https://developers.google.com/identity/protocols/application-default-credentials#howtheywork |
58 | 52 | *
|
59 | 53 | * <p>Before running the example, we have to create private and public keys, as described in
|
60 | 54 | * cloud.google.com/iot. Since we are interacting with the device manager, we will only use the
|
61 |
| - * public keys. The private keys are used to sign JWTs to authenticate devices. See the MQTT client |
62 |
| - * example in the developer guide for an example of this. |
| 55 | + * public keys. The private keys are used to sign JWTs to authenticate devices. See the |
| 56 | + * <a href="https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/iot/api-client/mqtt_example">MQTT client example</a> |
| 57 | + * for more information. |
63 | 58 | *
|
64 | 59 | * <p>Finally, compile and run the example with:
|
65 | 60 | *
|
|
76 | 71 | * </pre>
|
77 | 72 | */
|
78 | 73 | public class DeviceRegistryExample {
|
79 |
| - // CloudIot service for administering Cloud IoT devices, registries and projects. |
| 74 | + // Service for administering Cloud IoT Core devices, registries and projects. |
80 | 75 | private CloudIot service;
|
81 | 76 | // Path to the project and location: "projects/my-project-id/locations/us-central1"
|
82 | 77 | private String projectPath;
|
@@ -255,7 +250,7 @@ public void modifyCloudToDeviceConfig(String deviceId, String configData) throws
|
255 | 250 | ModifyCloudToDeviceConfigRequest request = new ModifyCloudToDeviceConfigRequest();
|
256 | 251 | DeviceConfigData data = new DeviceConfigData();
|
257 | 252 | data.setBinaryData(DatatypeConverter.printBase64Binary(configData.getBytes(Charsets.UTF_8)));
|
258 |
| - request.setVersionToUpdate(0L); |
| 253 | + request.setVersionToUpdate(0L); // 0L indicates update all versions |
259 | 254 | request.setData(data);
|
260 | 255 | DeviceConfig config =
|
261 | 256 | service
|
|
0 commit comments