我接入的接口部分如下:
电池index val product = DJISDKManager.getInstance().product
val batteryList = product?.batteries
val battery1 = batteryList?.get(0)
val battery2 = batteryList?.get(1)电池电压: private fun getCellVoltages() {
battery1?.getCellVoltages(object : CommonCallbacks.CompletionCallbackWith<Array<Int>>{
override fun onSuccess(p0: Array<Int>?) {
p0?.let {
val df = DecimalFormat("00.00")
customoption.shareOption.tvVoltage =
df.format(it[0] / 100).toDouble()
customoption.shareOption.tvVoltages =
df.format(it[1] / 100).toDouble()
customoption.save()
}
}
override fun onFailure(p0: DJIError?) {
p0?.let {
KLog.e(TAG,"getCellVoltages:${it.description}")
}
}
})
}电池循环次数:
battery1?.setStateCallback { battery ->
customoption.shareOption.tvCycles = battery.lifetimeRemaining
}
请问是接口部分对接错了吗?但是我找了好久就这几个接口是这样的回调部分,有人能告知我下吗,谢谢,2块电池的获取值都是那样,对不上djipoilt的电池值。 |