|
| 1 | +<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/> |
| 2 | + |
| 3 | +# Google Cloud IoT Core NodeJS Device Management example |
| 4 | + |
| 5 | +This sample app demonstrates device management for Google Cloud IoT Core. |
| 6 | + |
| 7 | +Note that before you run this sample, you must configure a Google Cloud PubSub |
| 8 | +topic for Cloud IoT as described in the parent README. |
| 9 | + |
| 10 | +# Setup |
| 11 | + |
| 12 | +Run the following command to install the library dependencies for NodeJS: |
| 13 | + |
| 14 | + npm install |
| 15 | + |
| 16 | +# Running the sample |
| 17 | + |
| 18 | +The following command summarizes the sample usage: |
| 19 | + |
| 20 | + Usage: cloudiot_device_manager_example [options] |
| 21 | + |
| 22 | + Example Google Cloud IoT device manager integration |
| 23 | + |
| 24 | + Options: |
| 25 | + |
| 26 | + -h, --help output usage information |
| 27 | + --project_id <project_id> GCP cloud project name. |
| 28 | + --pubsub_topic <pubsub_topic> Cloud Pub/Sub topic to use. |
| 29 | + --api_key <api_key> Your API key. |
| 30 | + --ec_public_key_file <ec_public_key_file> Path to EC public key. |
| 31 | + --rsa_certificate_file <rsa_certificate_file> Path to RSA certificate file. |
| 32 | + --cloud_region <cloud_region> GCP cloud region. |
| 33 | + --service_account_json <service_account_json> Path to service account JSON file. |
| 34 | + --registry_id <registry_id> Custom registry id. If not provided, a unique registry id will be generated. |
| 35 | + |
| 36 | +For example, if your project ID is `blue-jet-123`, your service account |
| 37 | +credentials are stored in your home folder in creds.json and you have generated |
| 38 | +your credentials using the shell script provided in the parent folder, you can |
| 39 | +run the sample as: |
| 40 | + |
| 41 | + node cloudiot_device_manager_example.js \ |
| 42 | + --service_account_json=$HOME/creds.json \ |
| 43 | + --api_key=YOUR_CLIENT_ID \ |
| 44 | + --project_id=blue-jet-123 \ |
| 45 | + --pubsub_topic=projects/blue-jet-123/topics/device-events \ |
| 46 | + --ec_public_key_file=../ec_public.pem \ |
| 47 | + --rsa_certificate_file=../rsa_cert.pem |
0 commit comments