Google Cloud IoT Core verrà ritirato il 16 agosto 2023. Per saperne di più, contatta il team dedicato al tuo account Google Cloud.

Tutti gli esempi di codice di Cloud IoT Core

This page contains code samples for IoT Core. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.

Add ES256 authentication

Add ES256 authentication to a device.

Add RSA256 authentication

Add RSA256 authentication to a device.

View in documentation

Attach a device

Attach a device to a gateway.

Clear registry

Remove all devices from a registry and delete the registry.

Connect to MQTT server

Connect to MQTT server.

Create a client

Create a client.

Create a device

Create a device in a registry.

View in documentation

Create a device registry

Create a device registry associated with a Pub/Sub topic.

Create a device using ES256

Create a device using ES256 for authentication.

View in documentation

Create a device using RSA

Create a device using RSA256 for authentication.

View in documentation

Create a device without authentication

Create a device without authentication.

Create a gateway

Create a new gateway with a given ID, public key, and authentication method.

Delete a device registry

Delete a device registry if it is empty.

Delete a gateway

Delete the gateway with the given ID.

Detach a device

Detach a device from a gateway.

Get a device

Retrieve a specific device and prints its details.

View in documentation

Get a device registry

Retrieve a device registry.

Get device configurations

Retrieve and list device configurations.

View in documentation

Get device states

Retrieve and list device states.

Get IAM policy for a device registry

Retrieve the IAM policy for a device registry.

View in documentation

IoT gateway tutorial

Create a registry, create a gateway, bind a device, listen for messages, and publish messages.

View in documentation

List device registries

List device registries.

List devices

Retrieves the identifiers of devices for a specific registry.

View in documentation

List devices for a gateway

Retrieves devices bound to a gateway.

View in documentation

List gateways

List all the gateways in a specific registry.

View in documentation

List gateways for device

List all of a device's gateways.

List registries

Retrieve device registries given a project or region.

View in documentation

Listen for configuration messages

Listen for configuration messages.

Listen for error messages

Listen for error messages.

View in documentation

Listen for messages

Listen for messages.

Lookup registry

Lookup a registry.

Send a command

Send a command to a device listening for commands.

View in documentation

Send a command to a device

Send a command to a device listening for commands.

View in documentation

Send data from a bound device

Send data on behalf of a bound device.

Set device configuration

Send configuration data to a device.

View in documentation

Set device state

Set a device's state.

Subscribe a gateway to a bound device

Create a gateway client that subscribes to a topic of a bound device.

View in documentation

Unbind a device from a gateway

Unbind a device from a gateway.

View in documentation

Unbind device from gateway

Unbind a device from gateway.

Update the IAM policy of a registry

Update the IAM policy of a device registry.

View in documentation