there is a code like this
package com.pmi.reader.data.battery_info;
import android.annotation.TargetApi;
import android.bluetooth.BluetoothGattCharacteristic;
import android.util.Log;
import com.pmi.reader.data.CharacteristicData;
import com.pmi.reader.helpers.BinaryHelper;
@TargetApi(18)
public class BatteryInformation
extends CharacteristicData
{
private static final String TAG = BatteryInformation.class.getSimpleName();
private Integer chargerBatteryLevel;
private Integer chargerBatteryTemperature;
private Integer chargerBatteryVoltage;
private int flags;
private Integer holder1BatteryLevel;
private Integer holder1BatteryTemperature;
private Integer holder1BatteryVoltage;
private Integer holder2BatteryLevel;
private Integer holder2BatteryTemperature;
private Integer holder2BatteryVoltage;
public BatteryInformation(BluetoothGattCharacteristic paramBluetoothGattCharacteristic)
{
Log.d(TAG, BinaryHelper.arrayToHexString(paramBluetoothGattCharacteristic.getValue()));
this.flags = paramBluetoothGattCharacteristic.getIntValue(18, 0).intValue();
int j = 0 + 2;
int i = j;
if (isFlag(0))
{
this.chargerBatteryLevel = paramBluetoothGattCharacteristic.getIntValue(17, j);
i = j + 1;
}
j = i;
if (isFlag(1))
{
this.chargerBatteryTemperature = paramBluetoothGattCharacteristic.getIntValue(17, i);
j = i + 1;
}
i = j;
if (isFlag(2))
{
this.chargerBatteryVoltage = paramBluetoothGattCharacteristic.getIntValue(18, j);
i = j + 2;
}
j = i;
if (isFlag(3))
{
this.holder1BatteryLevel = paramBluetoothGattCharacteristic.getIntValue(17, i);
j = i + 1;
}
i = j;
if (isFlag(4))
{
this.holder1BatteryTemperature = paramBluetoothGattCharacteristic.getIntValue(17, j);
i = j + 1;
}
j = i;
if (isFlag(5))
{
this.holder1BatteryVoltage = paramBluetoothGattCharacteristic.getIntValue(18, i);
j = i + 2;
}
i = j;
if (isFlag(6))
{
this.holder2BatteryLevel = paramBluetoothGattCharacteristic.getIntValue(17, j);
i = j + 1;
}
j = i;
if (isFlag(7))
{
this.holder2BatteryTemperature = paramBluetoothGattCharacteristic.getIntValue(17, i);
j = i + 1;
}
if (isFlag(8)) {
this.holder2BatteryVoltage = paramBluetoothGattCharacteristic.getIntValue(18, j);
}
}
public Integer getChargerBatteryLevel()
{
return this.chargerBatteryLevel;
}
public Integer getChargerBatteryTemperature()
{
return this.chargerBatteryTemperature;
}
public Integer getChargerBatteryVoltage()
{
return this.chargerBatteryVoltage;
}
public int getFlags()
{
return this.flags;
}
public Integer getHolder1BatteryLevel()
{
return this.holder1BatteryLevel;
}
public Integer getHolder1BatteryTemperature()
{
return this.holder1BatteryTemperature;
}
public Integer getHolder1BatteryVoltage()
{
return this.holder1BatteryVoltage;
}
public Integer getHolder2BatteryLevel()
{
return this.holder2BatteryLevel;
}
public Integer getHolder2BatteryTemperature()
{
return this.holder2BatteryTemperature;
}
public Integer getHolder2BatteryVoltage()
{
return this.holder2BatteryVoltage;
}
public boolean isFlag(int paramInt)
{
return isFlag(this.flags, paramInt);
}
public String toString()
{
return "BatteryInformation{\n flags (binary)=" + Integer.toBinaryString(this.flags) + ",\n chargerBatteryLevel=" + this.chargerBatteryLevel + ",\n chargerBatteryTemperature=" + this.chargerBatteryTemperature + ",\n chargerBatteryVoltage=" + this.chargerBatteryVoltage + ",\n holder1BatteryLevel=" + this.holder1BatteryLevel + ",\n holder1BatteryTemperature=" + this.holder1BatteryTemperature + ",\n holder1BatteryVoltage=" + this.holder1BatteryVoltage + ",\n holder2BatteryLevel=" + this.holder2BatteryLevel + ",\n holder2BatteryTemperature=" + this.holder2BatteryTemperature + ",\n holder2BatteryVoltage=" + this.holder2BatteryVoltage + "\n}";
}
}
the data result of Bluetooth communication is
0f004425400f64
/ / this result is the result that has been converted to a string through the array
studied for a long time, do not know how this code corresponds, other Bluetooth communication results are direct hexadecimal transfer string, this direct transfer is a meaningless English field.
seek to interpret the results of the data, and the method of interpretation