# SharedDeviceData.Builder

# SharedDeviceData.Builder


```
class SharedDeviceData.Builder
```

<br />

*** ** * ** ***

A builder for `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData` instances. Acquire an instance via `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData#builder(java.lang.String)`.

## Summary

| ### Public functions |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData!` | `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#build()()` Constructs an instance of `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData` from this builder. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setCommissioningWindowExpirationMillis(long)( commissioningWindowExpirationMillis: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html )` Sets the expiration time of the opened commissioning window. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setDeviceName(java.lang.String)(deviceName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Sets the user-facing name of this device. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html [setDeviceType](https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setDeviceType(int))(deviceType: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0, to = 65535) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` **This function is deprecated.** this field is not expected to be populated; the vendor ID and product ID can be used to map to a device type <br /> |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setProductId(int)(productId: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0, to = 65535) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the device's product ID. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setRoomName(java.lang.String)(roomName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets the user-facing name of the room in which the device is located. |
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | `@https://errorprone.info/api/latest/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setVendorId(int)(vendorId: @https://developer.android.com/reference/androidx/annotation/IntRange.html(from = 0, to = 65535) https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the device's vendor ID. |

## Public functions

### build

```
fun build(): SharedDeviceData!
```

Constructs an instance of `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData` from this builder.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setDeviceName(java.lang.String)` was not called |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setCommissioningWindowExpirationMillis(long)` was not called |

### setCommissioningWindowExpirationMillis

```
@CanIgnoreReturnValue
fun setCommissioningWindowExpirationMillis(
    commissioningWindowExpirationMillis: @IntRange(from = 0) Long
): SharedDeviceData.Builder!
```

Sets the expiration time of the opened commissioning window. The time basis must be `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()`.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | this builder |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the value is less than zero |

### setDeviceName

```
@CanIgnoreReturnValue
fun setDeviceName(deviceName: String!): SharedDeviceData.Builder!
```

Sets the user-facing name of this device.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | this builder |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the device name is empty |

### setDeviceType

```
@CanIgnoreReturnValue
fun [setDeviceType](https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder#setDeviceType(int))(deviceType: @IntRange(from = 0, to = 65535) Int): SharedDeviceData.Builder!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> this field is not expected to be populated; the vendor ID and product ID can be used to map to a device type

Sets the device's primary Matter device type.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | this builder |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the value is not in \[0,FFFF\] |

### setProductId

```
@CanIgnoreReturnValue
fun setProductId(productId: @IntRange(from = 0, to = 65535) Int): SharedDeviceData.Builder!
```

Sets the device's product ID.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | this builder |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the value is not in \[0,FFFF\] |

### setRoomName

```
@CanIgnoreReturnValue
fun setRoomName(roomName: String?): SharedDeviceData.Builder!
```

Sets the user-facing name of the room in which the device is located. This may be set to null if there is no room for the device.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | this builder |

### setVendorId

```
@CanIgnoreReturnValue
fun setVendorId(vendorId: @IntRange(from = 0, to = 65535) Int): SharedDeviceData.Builder!
```

Sets the device's vendor ID.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/android/gms/home/matter/commissioning/SharedDeviceData.Builder!` | this builder |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the value is not in \[0,FFFF\] |