Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: retire IoT samples #241

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 4 additions & 81 deletions iot/mqtt-ciotc/README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,7 @@
# Message Queue Telemetry Transport (MQTT) client for Google Cloud IoT Core
# Deprecation Notice

This sample app demonstrates connecting to Google Cloud IoT Core and publishing
a single message.
* <h3>Google Cloud IoT Core will be <a href="https://cloud.google.com/iot/docs/release-notes#August_16_2022">retired as of August 16, 2023</a>.</h3>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the use of <h3> in markdown, and as a bullet point strikes me as odd... but whatevs. This README file will go away soon-ish.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We followed the template that was implemented in another sample repo... 🤷


## Building
* <h3>Hence, the samples in this directory are archived and are no longer maintained.</h3>

This example uses `vcpkg` and `CMake` to manage its dependencies. To compile this project:

1. **Install vcpkg.**
Clone the vcpkg repository to your preferred location. In these instructions we use`$HOME`:
```shell
git clone -C $HOME https://github.com/microsoft/vcpkg.git
```

1. **Download or clone this repo** with
```shell
git clone https://github.com/GoogleCloudPlatform/cpp-samples
```

1. **Compile this example:**
Use the `vcpkg` toolchain file to download and compile dependencies. This file would be in the directory you
cloned `vcpkg` into, `$HOME/vcpkg` if you are following the instructions to the letter. Note that building all the
dependencies may take several minutes, up to half an hour, depending on the performance of your workstation. These dependencies are cached,
so a second build should be substantially faster.
```sh
cd cpp-samples/iot/mqtt-ciotc
cmake -S. -B.build -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build .build
```

# Running

After you have successfully built the sample, you are almost ready to run the
sample.

1. Browse to the sample folder
```shell
cd mqtt-ciotc
```

1. Create a Cloud Pub/Sub topic
```shell
gcloud pubsub topics create <Your telemetry topic>
```

1. Setup the Cloud IOT environment
```shell
./setup_device.sh --registry-name <Your registry id> \
--registry-region <e.g. us-central1> \
--device-id <Your device ID> \
--telemetry-topic <Your telemetry Cloud Pub/Sub topic>
```

1. Run the sample
```shell
./mqtt_ciotc <message> \
--deviceid <your device id>\
--region <e.g. us-central1>\
--registryid <your registry id>\
--projectid <your project id>\
--keypath <e.g. ./ec_private.pem>\
--algorithm <e.g. RS256>
--rootpath <e.g. ./roots.pem>
```

You must provide the deviceid, registryid, and projectid parameters as they are
used in calculating the client ID used for connecting to the MQTT bridge. The
ecpath parameter should point to your private EC key created when you registered
your device. The rootpath parameter specifies the roots.pem file that can be
downloaded from https://pki.google.com/roots.pem. For example:

```shell
wget https://pki.google.com/roots.pem
```

The following example demonstrates usage of the sample if my device ID is
my-device, registry ID is my-registry, and project ID is blue-ocean-123.

```shell
mqtt_ciotc "Hello world!" --deviceid my-device --registryid my-registry \
--projectid blue-ocean-123 --keypath ./rsa_private.pem --algorithm RS256 \
--rootpath ./roots.pem --region us-central1
```
* <h3>If you are customer with an assigned Google Cloud account team, contact your account team for more information.</h3>