This folder contains .net core samples that demonstrate an overview of the Google Cloud IoT Core platform.
This sample publishes MQTT messages based on .net core to Google Cloud Core IoT API.
general help for setting up the project on gcp available in "gen certificates help.txt".
-
before start, make sure you have pub/sub and core iot api is already enabled.
-
If you need install the gCloud CLI, just follow readme docx document to setup your IoT project in Google cloud.
-
Create a PubSub topic: ie. events
-
Create a device registry: ie. reg1
-
Register a device: ie. dev1.
-
Follow the instruction
gen certificates help.txt
to generate your signing keys. -
Run the application: dotnet gcp_iot_sample.dll -p {projectId} -r {registryId} -d {deviceId} -a {cloudRegion}
C:>dotnet gcp_iot_sample.dll -p projiotid -r reg1 -d dev1 -a us-central1 -t events
Results:
MessageId = 1 Published = True
MessageId = 2 Published = True
MessageId = 3 Published = True
...