Internet of Things (IoT) service.
Securely connect and manage IoT devices.
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
DeviceManagerClient(DeviceManagerClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DeviceManagerClient const &
|
DeviceManagerClient(DeviceManagerClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DeviceManagerClient &&
|
DeviceManagerClient(std::shared_ptr< DeviceManagerConnection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< DeviceManagerConnection >
|
opts |
Options
|
Operators
operator=(DeviceManagerClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DeviceManagerClient const &
|
Returns | |
---|---|
Type | Description |
DeviceManagerClient & |
operator=(DeviceManagerClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DeviceManagerClient &&
|
Returns | |
---|---|
Type | Description |
DeviceManagerClient & |
Functions
CreateDeviceRegistry(std::string const &, google::cloud::iot::v1::DeviceRegistry const &, Options)
Creates a device registry that contains devices.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The project and cloud region where this device registry must be created. For example, |
device_registry |
google::cloud::iot::v1::DeviceRegistry const &
Required. The device registry. The field |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
CreateDeviceRegistry(google::cloud::iot::v1::CreateDeviceRegistryRequest const &, Options)
Creates a device registry that contains devices.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::CreateDeviceRegistryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetDeviceRegistry(std::string const &, Options)
Gets a device registry configuration.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device registry. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetDeviceRegistry(google::cloud::iot::v1::GetDeviceRegistryRequest const &, Options)
Gets a device registry configuration.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::GetDeviceRegistryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateDeviceRegistry(google::cloud::iot::v1::DeviceRegistry const &, google::protobuf::FieldMask const &, Options)
Updates a device registry configuration.
Parameters | |
---|---|
Name | Description |
device_registry |
google::cloud::iot::v1::DeviceRegistry const &
Required. The new values for the device registry. The |
update_mask |
google::protobuf::FieldMask const &
Required. Only updates the |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateDeviceRegistry(google::cloud::iot::v1::UpdateDeviceRegistryRequest const &, Options)
Updates a device registry configuration.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::UpdateDeviceRegistryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceRegistry) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
DeleteDeviceRegistry(std::string const &, Options)
Deletes a device registry configuration.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device registry. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
DeleteDeviceRegistry(google::cloud::iot::v1::DeleteDeviceRegistryRequest const &, Options)
Deletes a device registry configuration.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::DeleteDeviceRegistryRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
ListDeviceRegistries(std::string const &, Options)
Lists device registries.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The project and cloud region path. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::iot::v1::DeviceRegistry > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListDeviceRegistries(google::cloud::iot::v1::ListDeviceRegistriesRequest, Options)
Lists device registries.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::ListDeviceRegistriesRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::iot::v1::DeviceRegistry > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
CreateDevice(std::string const &, google::cloud::iot::v1::Device const &, Options)
Creates a device in a device registry.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The name of the device registry where this device should be created. For example, |
device |
google::cloud::iot::v1::Device const &
Required. The device registration details. The field |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > |
the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
CreateDevice(google::cloud::iot::v1::CreateDeviceRequest const &, Options)
Creates a device in a device registry.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::CreateDeviceRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > |
the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetDevice(std::string const &, Options)
Gets details about a device.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > |
the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetDevice(google::cloud::iot::v1::GetDeviceRequest const &, Options)
Gets details about a device.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::GetDeviceRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > |
the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateDevice(google::cloud::iot::v1::Device const &, google::protobuf::FieldMask const &, Options)
Updates a device.
Parameters | |
---|---|
Name | Description |
device |
google::cloud::iot::v1::Device const &
Required. The new values for the device. The |
update_mask |
google::protobuf::FieldMask const &
Required. Only updates the |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > |
the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateDevice(google::cloud::iot::v1::UpdateDeviceRequest const &, Options)
Updates a device.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::UpdateDeviceRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > |
the result of the RPC. The response message type (google.cloud.iot.v1.Device) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
DeleteDevice(std::string const &, Options)
Deletes a device.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
DeleteDevice(google::cloud::iot::v1::DeleteDeviceRequest const &, Options)
Deletes a device.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::DeleteDeviceRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
ListDevices(std::string const &, Options)
List devices in a device registry.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The device registry path. Required. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::iot::v1::Device > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListDevices(google::cloud::iot::v1::ListDevicesRequest, Options)
List devices in a device registry.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::ListDevicesRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::cloud::iot::v1::Device > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ModifyCloudToDeviceConfig(std::string const &, std::string const &, Options)
Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers.
Returns the modified configuration version and its metadata.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device. For example, |
binary_data |
std::string const &
Required. The configuration data for the device. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceConfig > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceConfig) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ModifyCloudToDeviceConfig(google::cloud::iot::v1::ModifyCloudToDeviceConfigRequest const &, Options)
Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers.
Returns the modified configuration version and its metadata.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::ModifyCloudToDeviceConfigRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceConfig > |
the result of the RPC. The response message type (google.cloud.iot.v1.DeviceConfig) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListDeviceConfigVersions(std::string const &, Options)
Lists the last few versions of the device configuration in descending order (i.e.: newest first).
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::ListDeviceConfigVersionsResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceConfigVersionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListDeviceConfigVersions(google::cloud::iot::v1::ListDeviceConfigVersionsRequest const &, Options)
Lists the last few versions of the device configuration in descending order (i.e.: newest first).
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::ListDeviceConfigVersionsRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::ListDeviceConfigVersionsResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceConfigVersionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListDeviceStates(std::string const &, Options)
Lists the last few versions of the device state in descending order (i.e.: newest first).
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device. For example, |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::ListDeviceStatesResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceStatesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
ListDeviceStates(google::cloud::iot::v1::ListDeviceStatesRequest const &, Options)
Lists the last few versions of the device state in descending order (i.e.: newest first).
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::ListDeviceStatesRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::ListDeviceStatesResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.ListDeviceStatesResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
SetIamPolicy(std::string const &, google::iam::v1::Policy const &, Options)
Sets the access control policy on the specified resource.
Replaces any existing policy.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy |
google::iam::v1::Policy const &
REQUIRED: The complete policy to be applied to the |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
SetIamPolicy(std::string const &, IamUpdater const &, Options)
Updates the IAM policy for resource
using an optimistic concurrency control loop.
The loop fetches the current policy for resource
, and passes it to updater
, which should return the new policy. This new policy should use the current etag so that the read-modify-write cycle can detect races and rerun the update when there is a mismatch. If the new policy does not have an etag, the existing policy will be blindly overwritten. If updater
does not yield a policy, the control loop is terminated and kCancelled is returned.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
Required. The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
updater |
IamUpdater const &
Required. Functor to map the current policy to a new one. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
google::iam::v1::Policy |
SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &, Options)
Sets the access control policy on the specified resource.
Replaces any existing policy.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::SetIamPolicyRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetIamPolicy(std::string const &, Options)
Gets the access control policy for a resource.
Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &, Options)
Gets the access control policy for a resource.
Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::GetIamPolicyRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TestIamPermissions(std::string const &, std::vector< std::string > const &, Options)
Returns permissions that a caller has on the specified resource.
If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions |
std::vector< std::string > const &
The set of permissions to check for the |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::TestIamPermissionsResponse > |
the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &, Options)
Returns permissions that a caller has on the specified resource.
If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::TestIamPermissionsRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::TestIamPermissionsResponse > |
the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
SendCommandToDevice(std::string const &, std::string const &, Options)
Sends a command to the specified device.
In order for a device to be able to receive commands, it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will receive commands at the top-level topic /devices/{device-id}/commands as well as commands for subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific subfolders is not supported. If the command could not be delivered to the device, this method will return an error; in particular, if the device is not subscribed, this method will return FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the device.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device. For example, |
binary_data |
std::string const &
Required. The command data to send to the device. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::SendCommandToDeviceResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.SendCommandToDeviceResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
SendCommandToDevice(std::string const &, std::string const &, std::string const &, Options)
Sends a command to the specified device.
In order for a device to be able to receive commands, it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will receive commands at the top-level topic /devices/{device-id}/commands as well as commands for subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific subfolders is not supported. If the command could not be delivered to the device, this method will return an error; in particular, if the device is not subscribed, this method will return FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the device.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the device. For example, |
binary_data |
std::string const &
Required. The command data to send to the device. |
subfolder |
std::string const &
Optional subfolder for the command. If empty, the command will be delivered to the /devices/{device-id}/commands topic, otherwise it will be delivered to the /devices/{device-id}/commands/{subfolder} topic. Multi-level subfolders are allowed. This field must not have more than 256 characters, and must not contain any MQTT wildcards ("+" or "#") or null characters. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::SendCommandToDeviceResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.SendCommandToDeviceResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
SendCommandToDevice(google::cloud::iot::v1::SendCommandToDeviceRequest const &, Options)
Sends a command to the specified device.
In order for a device to be able to receive commands, it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will receive commands at the top-level topic /devices/{device-id}/commands as well as commands for subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific subfolders is not supported. If the command could not be delivered to the device, this method will return an error; in particular, if the device is not subscribed, this method will return FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the device.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::SendCommandToDeviceRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::SendCommandToDeviceResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.SendCommandToDeviceResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
BindDeviceToGateway(std::string const &, std::string const &, std::string const &, Options)
Associates the device with the gateway.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The name of the registry. For example, |
gateway_id |
std::string const &
Required. The value of |
device_id |
std::string const &
Required. The device to associate with the specified gateway. The value of |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::BindDeviceToGatewayResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.BindDeviceToGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
BindDeviceToGateway(google::cloud::iot::v1::BindDeviceToGatewayRequest const &, Options)
Associates the device with the gateway.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::BindDeviceToGatewayRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::BindDeviceToGatewayResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.BindDeviceToGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UnbindDeviceFromGateway(std::string const &, std::string const &, std::string const &, Options)
Deletes the association between the device and the gateway.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The name of the registry. For example, |
gateway_id |
std::string const &
Required. The value of |
device_id |
std::string const &
Required. The device to disassociate from the specified gateway. The value of |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::UnbindDeviceFromGatewayResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UnbindDeviceFromGateway(google::cloud::iot::v1::UnbindDeviceFromGatewayRequest const &, Options)
Deletes the association between the device and the gateway.
Parameters | |
---|---|
Name | Description |
request |
google::cloud::iot::v1::UnbindDeviceFromGatewayRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::cloud::iot::v1::UnbindDeviceFromGatewayResponse > |
the result of the RPC. The response message type (google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |