BluetoothClassFactory

public class BluetoothClassFactory
extends Object

java.lang.Object
   ↳ com.google.android.things.bluetooth.BluetoothClassFactory


Builder to instantiate a BluetoothClass.

Summary

Public constructors

BluetoothClassFactory()

Public methods

static BluetoothClass build(int service, int device)

Construct the Bluetooth Class of Device (CoD) using the Service and Device values.

static BluetoothClass build(byte[] classOfDeviceBytes)

Construct the Bluetooth Class of Device (CoD) value including the BluetoothClass.Service, BluetoothClass.Device.Major and minor device fields.

Inherited methods

From class java.lang.Object

Public constructors

BluetoothClassFactory

BluetoothClassFactory ()

Public methods

build

BluetoothClass build (int service, 
                int device)

Construct the Bluetooth Class of Device (CoD) using the Service and Device values. BluetoothClass.Service and BluetoothClass.Device hold some common values.

Parameters
service int: Service value of the CoD (bytes 13-23)

device int: Combined device value, including Major and Minor values. (bytes 2-12)

Returns
BluetoothClass BluetoothClass which represents the specified device values.

build

BluetoothClass build (byte[] classOfDeviceBytes)

Construct the Bluetooth Class of Device (CoD) value including the BluetoothClass.Service, BluetoothClass.Device.Major 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}.

Parameters
classOfDeviceBytes byte: Byte representation of Bluetooth CoD as in the Bluetooth specification. 3 byte array.

Returns
BluetoothClass

See also: