Complete the code to specify the protocol used by Google Cloud IoT Core for device communication.
protocol = "[1]"
Google Cloud IoT Core primarily uses MQTT as the protocol for device communication because it is lightweight and efficient for IoT devices.
Complete the code to define the Google Cloud IoT Core resource that groups devices.
device_registry = "projects/my-project/locations/us-central1/registries/[1]"
In Google Cloud IoT Core, devices are grouped into a registry, which manages device metadata and communication.
Fix the error in the device authentication method by completing the code with the correct key format.
device_auth = {
"publicKey": {
"format": "[1]",
"key": "BASE64_ENCODED_KEY"
}
}The correct format for device public keys in Google Cloud IoT Core is RSA_X509_PEM when using RSA keys in PEM format with X.509 certificates.
Fill both blanks to create a device configuration update message with the correct fields.
{
"versionToUpdate": [1],
"binaryData": "[2]"
}The versionToUpdate is usually set to 0 to update the latest version, and binaryData must be base64 encoded, such as "SGVsbG8gd29ybGQ=" which decodes to 'Hello world'.
Fill all three blanks to define a device telemetry message with topic and payload fields.
{
"topicName": "/devices/[1]/events",
"payload": "[2]",
"qos": [3]
}The topicName includes the device ID like 'device123'. The payload is the telemetry data, here 'temperature=22.5'. The qos (quality of service) is set to 1 for at-least-once delivery.