public class Data
extends java.lang.Object
implements android.os.Parcelable
| Modifier and Type | Class and Description |
|---|---|
static interface |
Data.FloatFormat |
static interface |
Data.IntFormat |
static interface |
Data.LongFormat |
static interface |
Data.ValueFormat |
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<Data> |
CREATOR |
static int |
FORMAT_FLOAT
Data value format type float (32-bit float, IEEE-11073)
|
static int |
FORMAT_SFLOAT
Data value format type sfloat (16-bit float, IEEE-11073)
|
static int |
FORMAT_SINT16
Data value format type sint16
|
static int |
FORMAT_SINT24
Data value format type sint24
|
static int |
FORMAT_SINT32
Data value format type sint32
|
static int |
FORMAT_SINT8
Data value format type sint8
|
static int |
FORMAT_UINT16
Data value format type uint16
|
static int |
FORMAT_UINT24
Data value format type uint24
|
static int |
FORMAT_UINT32
Data value format type uint32
|
static int |
FORMAT_UINT8
Data value format type uint8
|
protected byte[] |
mValue |
| Modifier | Constructor and Description |
|---|---|
|
Data() |
|
Data(byte[] value) |
protected |
Data(android.os.Parcel in) |
| Modifier and Type | Method and Description |
|---|---|
int |
describeContents() |
static Data |
from(android.bluetooth.BluetoothGattCharacteristic characteristic) |
static Data |
from(android.bluetooth.BluetoothGattDescriptor descriptor) |
static Data |
from(java.lang.String value) |
java.lang.Byte |
getByte(int offset)
Returns a byte at the given offset from the byte array.
|
java.lang.Float |
getFloatValue(int formatType,
int offset)
Returns an float value from the given byte array.
|
java.lang.Integer |
getIntValue(int formatType,
int offset)
Returns an integer value from the byte array.
|
java.lang.Long |
getLongValue(int formatType,
int offset)
Returns a long value from the byte array.
|
java.lang.String |
getStringValue(int offset)
Return the stored value of this characteristic.
|
static int |
getTypeLen(int formatType)
Returns the size of a give value type.
|
byte[] |
getValue()
Returns the underlying byte array.
|
static Data |
opCode(byte opCode) |
static Data |
opCode(byte opCode,
byte parameter) |
int |
size()
Returns the size of underlying byte array.
|
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final int FORMAT_UINT8
public static final int FORMAT_UINT16
public static final int FORMAT_UINT24
public static final int FORMAT_UINT32
public static final int FORMAT_SINT8
public static final int FORMAT_SINT16
public static final int FORMAT_SINT24
public static final int FORMAT_SINT32
public static final int FORMAT_SFLOAT
public static final int FORMAT_FLOAT
protected byte[] mValue
public static final android.os.Parcelable.Creator<Data> CREATOR
public Data()
public Data(@Nullable
byte[] value)
protected Data(android.os.Parcel in)
public static Data from(@NonNull java.lang.String value)
public static Data from(@NonNull android.bluetooth.BluetoothGattCharacteristic characteristic)
public static Data from(@NonNull android.bluetooth.BluetoothGattDescriptor descriptor)
public static Data opCode(byte opCode)
public static Data opCode(byte opCode, byte parameter)
@Nullable public byte[] getValue()
@Nullable public java.lang.String getStringValue(int offset)
See getValue() for details.
offset - Offset at which the string value can be found.public int size()
@NonNull public java.lang.String toString()
toString in class java.lang.Object@Nullable public java.lang.Byte getByte(int offset)
offset - Offset at which the byte value can be found.@Nullable
public java.lang.Integer getIntValue(int formatType,
int offset)
The formatType parameter determines how the value
is to be interpreted. For example, setting formatType to
FORMAT_UINT16 specifies that the first two bytes of the
value at the given offset are interpreted to generate the
return value.
formatType - The format type used to interpret the value.offset - Offset at which the integer value can be found.@Nullable
public java.lang.Long getLongValue(int formatType,
int offset)
Only FORMAT_UINT32 and FORMAT_SINT32 are supported.
The formatType parameter determines how the value
is to be interpreted. For example, setting formatType to
FORMAT_UINT32 specifies that the first four bytes of the
value at the given offset are interpreted to generate the
return value.
formatType - The format type used to interpret the value.offset - Offset at which the integer value can be found.@Nullable
public java.lang.Float getFloatValue(int formatType,
int offset)
formatType - The format type used to interpret the value.offset - Offset at which the float value can be found.public static int getTypeLen(int formatType)
public void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelablepublic int describeContents()
describeContents in interface android.os.Parcelable