public class MutableData extends Data
Data.FloatFormat, Data.IntFormat, Data.LongFormat, Data.ValueFormatCREATOR, FORMAT_FLOAT, FORMAT_SFLOAT, FORMAT_SINT16, FORMAT_SINT24, FORMAT_SINT32, FORMAT_SINT8, FORMAT_UINT16, FORMAT_UINT24, FORMAT_UINT32, FORMAT_UINT8, mValue| Constructor and Description |
|---|
MutableData() |
MutableData(byte[] data) |
| Modifier and Type | Method and Description |
|---|---|
static MutableData |
from(android.bluetooth.BluetoothGattCharacteristic characteristic) |
static MutableData |
from(android.bluetooth.BluetoothGattDescriptor descriptor) |
boolean |
setByte(int value,
int offset)
Updates the byte at offset position.
|
boolean |
setValue(byte[] value)
Updates the locally stored value of this data.
|
boolean |
setValue(float value,
int formatType,
int offset)
Set the locally stored value of this data.
|
boolean |
setValue(int value,
int formatType,
int offset)
Set the locally stored value of this data.
|
boolean |
setValue(int mantissa,
int exponent,
int formatType,
int offset)
Set the locally stored value of this data.
|
boolean |
setValue(long value,
int formatType,
int offset)
Set the locally stored value of this data.
|
describeContents, from, getByte, getFloatValue, getIntValue, getLongValue, getStringValue, getTypeLen, getValue, opCode, opCode, size, toString, writeToParcelpublic MutableData()
public MutableData(@Nullable
byte[] data)
public static MutableData from(@NonNull android.bluetooth.BluetoothGattCharacteristic characteristic)
public static MutableData from(@NonNull android.bluetooth.BluetoothGattDescriptor descriptor)
public boolean setValue(@Nullable
byte[] value)
value - New valuepublic boolean setByte(int value,
int offset)
value - Byte to setoffset - The offsetpublic boolean setValue(int value,
int formatType,
int offset)
See setValue(byte[]) for details.
value - New value for this dataformatType - Integer format type used to transform the value parameteroffset - Offset at which the value should be placedpublic boolean setValue(int mantissa,
int exponent,
int formatType,
int offset)
See setValue(byte[]) for details.
mantissa - Mantissa for this dataexponent - Exponent value for this dataformatType - Float format type used to transform the value parameteroffset - Offset at which the value should be placedpublic boolean setValue(long value,
int formatType,
int offset)
See setValue(byte[]) for details.
value - New value for this data. This allows to send Data.FORMAT_UINT32.formatType - Integer format type used to transform the value parameteroffset - Offset at which the value should be placedpublic boolean setValue(float value,
int formatType,
int offset)
See setValue(byte[]) for details.
value - Float value to be writtenformatType - Float format type used to transform the value parameteroffset - Offset at which the value should be placed