-
public class ValueInterpreterA helper class intended for interpreting Integers, Floats and Strings that may be stored in byte arrays retrieved by readCharacteristic or setupIndication. If the data in emitted byte arrays is stored using a standardised Bluetooth Specification format This class is a copied from getIntValue, getFloatValue and getStringValue
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public @interfaceValueInterpreter.IntFormatTypepublic @interfaceValueInterpreter.FloatFormatType
-
Field Summary
Fields Modifier and Type Field Description public final static intFORMAT_UINT8public final static intFORMAT_UINT16public final static intFORMAT_UINT32public final static intFORMAT_SINT8public final static intFORMAT_SINT16public final static intFORMAT_SINT32public final static intFORMAT_SFLOATpublic final static intFORMAT_FLOAT
-
Method Summary
Modifier and Type Method Description static IntegergetIntValue(@NonNull() Array<byte> value, int formatType, int offset)Return the integer value interpreted from the passed byte array. static FloatgetFloatValue(@NonNull() Array<byte> value, int formatType, int offset)Return the float value interpreted from the passed byte array. static StringgetStringValue(@NonNull() Array<byte> value, int offset)Return the string value interpreted from the passed byte array. -
-
Method Detail
-
getIntValue
static Integer getIntValue(@NonNull() Array<byte> value, int formatType, int offset)
Return the integer value interpreted from the passed byte array.
The formatType parameter determines how the valueis to be interpreted. For example, setting formatType to FORMAT_UINT16 specifies that the first two bytes of thecharacteristic value at the given offset are interpreted to generate thereturn value.
- Parameters:
value- The byte array from which to interpret value.formatType- The format type used to interpret the value.offset- Offset at which the integer value can be found.
-
getFloatValue
static Float getFloatValue(@NonNull() Array<byte> value, int formatType, int offset)
Return the float value interpreted from the passed byte array.
- Parameters:
value- The byte array from which to interpret value.formatType- The format type used to interpret the value.offset- Offset at which the float value can be found.
-
getStringValue
static String getStringValue(@NonNull() Array<byte> value, int offset)
Return the string value interpreted from the passed byte array.
- Parameters:
offset- Offset at which the string value can be found.
-
-
-
-