Builder
class Builder
| kotlin.Any | |
| ↳ | android.bluetooth.BluetoothSocketSettings.Builder | 
Builder for BluetoothSocketSettings.
Summary
| Public constructors | |
|---|---|
| Builder() | |
| Public methods | |
|---|---|
| BluetoothSocketSettings | build()Builds a  | 
| BluetoothSocketSettings.Builder | setAuthenticationRequired(authenticationRequired: Boolean)Sets the authentication requirement for the Bluetooth socket. | 
| BluetoothSocketSettings.Builder | setEncryptionRequired(encryptionRequired: Boolean)Sets the encryption requirement for the Bluetooth socket. | 
| BluetoothSocketSettings.Builder | setL2capPsm(l2capPsm: Int)Sets the L2CAP PSM (Protocol/Service Multiplexer) for the Bluetooth socket. | 
| BluetoothSocketSettings.Builder | setRfcommServiceName(rfcommServiceName: String)Sets the RFCOMM service name associated with the Bluetooth socket. | 
| BluetoothSocketSettings.Builder | setRfcommUuid(rfcommUuid: UUID)Sets the RFCOMM service UUID associated with the Bluetooth socket. | 
| BluetoothSocketSettings.Builder | setSocketType(socketType: Int)Sets the socket type. | 
Public constructors
Public methods
build
fun build(): BluetoothSocketSettings
Builds a BluetoothSocketSettings object.
| Return | |
|---|---|
| BluetoothSocketSettings | A new BluetoothSocketSettingsobject with the configured parameters. This value cannot benull. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | on invalid parameters | 
setAuthenticationRequired
fun setAuthenticationRequired(authenticationRequired: Boolean): BluetoothSocketSettings.Builder
Sets the authentication requirement for the Bluetooth socket.
Defaults to false.
| Parameters | |
|---|---|
| authenticationRequired | Boolean: trueif authentication is required for this socket,falseotherwise. | 
| Return | |
|---|---|
| BluetoothSocketSettings.Builder | This builder. This value cannot be null. | 
setEncryptionRequired
fun setEncryptionRequired(encryptionRequired: Boolean): BluetoothSocketSettings.Builder
Sets the encryption requirement for the Bluetooth socket.
Defaults to false.
| Parameters | |
|---|---|
| encryptionRequired | Boolean: trueif encryption is required for this socket,falseotherwise. | 
| Return | |
|---|---|
| BluetoothSocketSettings.Builder | This builder. This value cannot be null. | 
setL2capPsm
fun setL2capPsm(l2capPsm: Int): BluetoothSocketSettings.Builder
Sets the L2CAP PSM (Protocol/Service Multiplexer) for the Bluetooth socket.
This is only used for BluetoothSocket.TYPE_LE sockets. 
Valid PSM values for BluetoothSocket.TYPE_LE sockets is ranging from 128 (0x80) to 255 (0xFF). 
Application using this API is responsible for obtaining protocol/service multiplexer (PSM) value from remote device.
| Parameters | |
|---|---|
| l2capPsm | Int: The L2CAP PSM value. Value is between 128 and 255 inclusive | 
| Return | |
|---|---|
| BluetoothSocketSettings.Builder | This builder. This value cannot be null. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | If l2cap PSM is not in given range. | 
setRfcommServiceName
fun setRfcommServiceName(rfcommServiceName: String): BluetoothSocketSettings.Builder
Sets the RFCOMM service name associated with the Bluetooth socket.
This name is used to identify the service when a remote device searches for it using SDP.
This is only used for BluetoothSocket.TYPE_RFCOMM sockets. 
Defaults to null.
| Parameters | |
|---|---|
| rfcommServiceName | String: The RFCOMM service name. This value cannot be null. | 
| Return | |
|---|---|
| BluetoothSocketSettings.Builder | This builder. | 
setRfcommUuid
fun setRfcommUuid(rfcommUuid: UUID): BluetoothSocketSettings.Builder
Sets the RFCOMM service UUID associated with the Bluetooth socket.
This UUID is used to uniquely identify the service when a remote device searches for it using SDP.
This is only used for BluetoothSocket.TYPE_RFCOMM sockets. 
Defaults to null.
| Parameters | |
|---|---|
| rfcommUuid | UUID: The RFCOMM service UUID. This value cannot be null. | 
| Return | |
|---|---|
| BluetoothSocketSettings.Builder | This builder. | 
setSocketType
fun setSocketType(socketType: Int): BluetoothSocketSettings.Builder
Sets the socket type.
Must be one of:
Defaults to BluetoothSocket#TYPE_RFCOMM.
| Parameters | |
|---|---|
| socketType | Int: The type of socket. Value is android.bluetooth.BluetoothSocket#TYPE_RFCOMM,android.bluetooth.BluetoothSocket#TYPE_SCO,android.bluetooth.BluetoothSocket#TYPE_L2CAP, orandroid.bluetooth.BluetoothSocket#TYPE_LE | 
| Return | |
|---|---|
| BluetoothSocketSettings.Builder | This builder. This value cannot be null. | 
| Exceptions | |
|---|---|
| java.lang.IllegalArgumentException | If socketTypeis invalid. | 
