求解读一段JAVA代码(解析数据结果的)

有一段代码如下

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}";
  }
}

蓝牙通讯的数据结果是

0f004425400f64 // 这个结果是已经通过数组转字符串的结果

研究了半天,不知道这段代码怎么对应,其他的蓝牙通讯结果都是直接16进制转字符串,这段直接转会是一段无意义的英文字段。

求解读数据结果,和解读的方法

阅读 487
评论 更新于 2018-10-18
    撰写回答

    登录后参与交流、获取后续更新提醒