# Google Cloud IoT Core V1 Client - Class SendCommandToDeviceRequest (1.7.5)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.7.5 (latest)](https://docs.cloud.google.com/php/docs/reference/cloud-iot/latest/V1.SendCommandToDeviceRequest)
- [1.7.4](https://docs.cloud.google.com/php/docs/reference/cloud-iot/1.7.4/V1.SendCommandToDeviceRequest)
- [1.6.4](https://docs.cloud.google.com/php/docs/reference/cloud-iot/1.6.4/V1.SendCommandToDeviceRequest)
- [1.5.12](https://docs.cloud.google.com/php/docs/reference/cloud-iot/1.5.12/V1.SendCommandToDeviceRequest)
Reference documentation and code samples for the Google Cloud IoT Core V1 Client class SendCommandToDeviceRequest.

Request for `SendCommandToDevice`.

Generated from protobuf message `google.cloud.iot.v1.SendCommandToDeviceRequest`

## Namespace

Google \\ Cloud \\ Iot \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` 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}`. |
| `↳ binary_data` | `string` Required. The command data to send to the device. |
| `↳ subfolder` | `string` 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. |

### getName

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}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

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}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBinaryData

Required. The command data to send to the device.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setBinaryData

Required. The command data to send to the device.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSubfolder

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSubfolder

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `string` 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}`. Please see Google\\Cloud\\Iot\\V1\\DeviceManagerClient::deviceName() for help formatting this field. |
| `binaryData` | `string` Required. The command data to send to the device. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-iot/latest/V1.SendCommandToDeviceRequest` |   |

### static::buildFromNameBinaryDataSubfolder

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `string` 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}`. Please see Google\\Cloud\\Iot\\V1\\DeviceManagerClient::deviceName() for help formatting this field. |
| `binaryData` | `string` Required. The command data to send to the device. |
| `subfolder` | `string` 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. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-iot/latest/V1.SendCommandToDeviceRequest` |   |