class ProjectsLocationsRegistriesDevices extends Resource (View source)

The "devices" collection of methods.

Typical usage is:

 $cloudiotService = new Google\Service\CloudIot(...);
 $devices = $cloudiotService->projects_locations_registries_devices;

Methods

create(string $parent, Device $postBody, array $optParams = [])

Creates a device in a device registry. (devices.create)

delete(string $name, array $optParams = [])

Deletes a device. (devices.delete)

get(string $name, array $optParams = [])

Gets details about a device. (devices.get)

listProjectsLocationsRegistriesDevices(string $parent, array $optParams = [])

List devices in a device registry.

modifyCloudToDeviceConfig(string $name, ModifyCloudToDeviceConfigRequest $postBody, array $optParams = [])

Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata. (devices.modifyCloudToDeviceConfig)

patch(string $name, Device $postBody, array $optParams = [])

Updates a device. (devices.patch)

sendCommandToDevice(string $name, SendCommandToDeviceRequest $postBody, array $optParams = [])

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.

Details

Device create(string $parent, Device $postBody, array $optParams = [])

Creates a device in a device registry. (devices.create)

Parameters

string $parent

Required. The name of the device registry where this device should be created. For example, projects/example-project/locations /us-central1/registries/my-registry.

Device $postBody
array $optParams

Optional parameters.

Return Value

Device

CloudiotEmpty delete(string $name, array $optParams = [])

Deletes a device. (devices.delete)

Parameters

string $name

Required. The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

array $optParams

Optional parameters.

Return Value

CloudiotEmpty

Device get(string $name, array $optParams = [])

Gets details about a device. (devices.get)

Parameters

string $name

Required. The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

array $optParams

Optional parameters.

Return Value

Device

ListDevicesResponse listProjectsLocationsRegistriesDevices(string $parent, array $optParams = [])

List devices in a device registry.

(devices.listProjectsLocationsRegistriesDevices)

Parameters

string $parent

Required. The device registry path. Required. For example, projects/my-project/locations/us-central1/registries/my-registry.

array $optParams

Optional parameters.

Return Value

ListDevicesResponse

DeviceConfig modifyCloudToDeviceConfig(string $name, ModifyCloudToDeviceConfigRequest $postBody, array $optParams = [])

Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata. (devices.modifyCloudToDeviceConfig)

Parameters

string $name

Required. The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

ModifyCloudToDeviceConfigRequest $postBody
array $optParams

Optional parameters.

Return Value

DeviceConfig

Device patch(string $name, Device $postBody, array $optParams = [])

Updates a device. (devices.patch)

Parameters

string $name

The resource path name. For example, projects/p1/locations/us-central1/registries/registry0/devices/dev0 or projects/p1/locations/us-central1/registries/registry0/devices/{num_id}. When name is populated as a response from the service, it always ends in the device numeric ID.

Device $postBody
array $optParams

Optional parameters.

Return Value

Device

SendCommandToDeviceResponse sendCommandToDevice(string $name, SendCommandToDeviceRequest $postBody, array $optParams = [])

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. (devices.sendCommandToDevice)

Parameters

string $name

Required. The name of the device. For example, projects/p0/locations/us-central1/registries/registry0/devices/device0 or projects/p0/locations/us-central1/registries/registry0/devices/{num_id}.

SendCommandToDeviceRequest $postBody
array $optParams

Optional parameters.

Return Value

SendCommandToDeviceResponse