# BluetoothClassFactory

Summary:[Ctors](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#pubctors)\|[Methods](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#)  

# BluetoothClassFactory

`
public


class
BluetoothClassFactory
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-----------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | com.google.android.things.bluetooth.BluetoothClassFactory |

<br />

*** ** * ** ***

Builder to instantiate a[BluetoothClass](https://developer.android.com/reference/android/bluetooth/BluetoothClass.html).

## Summary

|                                                                    ### Public constructors                                                                    ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[BluetoothClassFactory](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#BluetoothClassFactory())`() ` |

|                                                                                                                                                                                                                                                                                           ### Public methods                                                                                                                                                                                                                                                                                            ||
|-----------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[BluetoothClass](https://developer.android.com/reference/android/bluetooth/BluetoothClass.html) | ` `[build](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#build(int, int))`(int service, int device) ` Construct the Bluetooth Class of Device (CoD) using the Service and Device values.                                                                                                                                                                                                                                                 |
| ` static `[BluetoothClass](https://developer.android.com/reference/android/bluetooth/BluetoothClass.html) | ` `[build](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#build(byte[]))`(byte[] classOfDeviceBytes) ` Construct the Bluetooth Class of Device (CoD) value including the[BluetoothClass.Service](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Service.html),[BluetoothClass.Device.Major](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.Major.html)and minor device fields. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                                                                                                                                                                                                                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                                                                                                                                                                                                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                                                                                                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                                                                                                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long, int))`(long millis, int nanos) ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long millis) ` Causes the current thread to wait until either another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or a specified amount of time has elapsed.                                                                 | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object.                                                                                                                                  | ||

## Public constructors

### BluetoothClassFactory

```
BluetoothClassFactory ()
```

<br />

<br />

## Public methods

### build

```
BluetoothClass build (int service, 
                int device)
```

Construct the Bluetooth Class of Device (CoD) using the Service and Device values.[BluetoothClass.Service](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Service.html)and[BluetoothClass.Device](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.html)hold some common values.

<br />

|                                           Parameters                                           ||
|-----------|-------------------------------------------------------------------------------------|
| `service` | `int`: Service value of the CoD (bytes 13-23) <br />                                |
| `device`  | `int`: Combined device value, including Major and Minor values. (bytes 2-12) <br /> |

|                                                                               Returns                                                                                ||
|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| [BluetoothClass](https://developer.android.com/reference/android/bluetooth/BluetoothClass.html) | BluetoothClass which represents the specified device values. <br /> |

**See also:**

- [BluetoothClass.Service](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Service.html)
- [BluetoothClass.Device](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.html)
- [BluetoothClass.Device.Major](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.Major.html)
- [Bluetooth CoD](https://www.bluetooth.com/specifications/assigned-numbers/baseband)  

### build

```
BluetoothClass build (byte[] classOfDeviceBytes)
```

Construct the Bluetooth Class of Device (CoD) value including the[BluetoothClass.Service](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Service.html),[BluetoothClass.Device.Major](https://developer.android.com/reference/android/bluetooth/BluetoothClass.Device.Major.html)and minor device fields.

The byte representation of CoD are the Bluetooth Service, Device Major and Minor field from left to right, ie. MSB to LSB. Byte 0 is MSB and Byte 2 is LSB.

For eg., the byte representation of the Class of Device for an Audio Speaker is 0x200414. The parameters for it would be {0x20, 0x04, 0x14}.

<br />

|                                                         Parameters                                                         ||
|----------------------|------------------------------------------------------------------------------------------------------|
| `classOfDeviceBytes` | `byte`: Byte representation of Bluetooth CoD as in the Bluetooth specification. 3 byte array. <br /> |

|                                                 Returns                                                 ||
|-------------------------------------------------------------------------------------------------|--------|
| [BluetoothClass](https://developer.android.com/reference/android/bluetooth/BluetoothClass.html) | <br /> |

**See also:**

- [Bluetooth CoD](https://www.bluetooth.com/specifications/assigned-numbers/baseband)  
-

  ## Interfaces

  - [BluetoothConnectionCallback](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothConnectionCallback)
  - [BluetoothPairingCallback](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback)
-

  ## Classes

  - [BluetoothClassFactory](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothClassFactory)
  - [BluetoothConfigManager](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothConfigManager)
  - [BluetoothConnectionManager](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothConnectionManager)
  - [BluetoothPairingCallback.PairingError](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothPairingCallback.PairingError)
  - [BluetoothProfile](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothProfile)
  - [BluetoothProfileManager](https://developer.android.com/reference/com/google/android/things/bluetooth/BluetoothProfileManager)
  - [ConnectionParams](https://developer.android.com/reference/com/google/android/things/bluetooth/ConnectionParams)
  - [PairingParams](https://developer.android.com/reference/com/google/android/things/bluetooth/PairingParams)