1.网络接口请求超时10s修改为35秒
2.关机由原来的:0x04 -> turnoff接口 -> 0x18,改为:0x18-> turnoff接口
This commit is contained in:
@@ -25,6 +25,7 @@ class LiveDurationSetActivity :
|
||||
|
||||
//选中的下标
|
||||
private var mSelectIndex = -1
|
||||
private var mSelectTempIndex = -1
|
||||
|
||||
private var mMapDeviceBean: MapDeviceBean? = null
|
||||
|
||||
@@ -55,6 +56,7 @@ class LiveDurationSetActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
showToast(R.string.txt_change_successful)
|
||||
mSelectIndex = mSelectTempIndex
|
||||
ViewUtil.instance.updateDataBeanOnlySelectedItem(
|
||||
mDurationSetAdapter, mDurationSetAdapter.getData(), mSelectIndex
|
||||
)
|
||||
@@ -69,7 +71,7 @@ class LiveDurationSetActivity :
|
||||
for (time in timeList) {
|
||||
DataBean().apply {
|
||||
imageId = time
|
||||
name = String.format(getString(R.string.txt_duration_min_unit), time)
|
||||
name = String.format(getString(R.string.txt_duration_min_unit), "$time")
|
||||
durationList.add(this)
|
||||
}
|
||||
}
|
||||
@@ -96,7 +98,7 @@ class LiveDurationSetActivity :
|
||||
fun setLiveDuration(pos: Int) {
|
||||
if (mSelectIndex == pos) return
|
||||
mMapDeviceBean?.apply {
|
||||
mSelectIndex = pos
|
||||
mSelectTempIndex = pos
|
||||
val dataBean = mDurationSetAdapter.getData()[pos]
|
||||
mTrackerSetViewModel.setLiveTime(
|
||||
this@LiveDurationSetActivity, deviceId, dataBean.imageId
|
||||
|
||||
@@ -93,8 +93,12 @@ class PowerOffActivity : BaseActivity<ActivityPowerOffBinding>(ActivityPowerOffB
|
||||
val data0 = SRBleCmdUtil.instance.byteToInt(data[0])
|
||||
val data1 = SRBleCmdUtil.instance.byteToInt(data[1])
|
||||
val data2 = SRBleCmdUtil.instance.byteToInt(data[2])
|
||||
if (data0 == 4 && data1 == 1 && data2 == 0) {
|
||||
showToast(R.string.txt_done, true)
|
||||
if (data0 == 0x18 && data1 == 1) {
|
||||
if (data2 == 0) showToast(R.string.txt_done, true)
|
||||
else if (data2 == 3) {
|
||||
setButtonEnabled(mViewBinding.btnPowerOffYes)
|
||||
showToast(R.string.txt_on_charging)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,7 +126,7 @@ class PowerOffActivity : BaseActivity<ActivityPowerOffBinding>(ActivityPowerOffB
|
||||
mPetBean?.apply {
|
||||
SRBleUtil.instance.getConnectMacDevice(macID)?.let {
|
||||
setButtonEnabled(mViewBinding.btnPowerOffYes)
|
||||
val cmd = SRBleCmdUtil.instance.shutdownDevice()
|
||||
val cmd = SRBleCmdUtil.instance.forcedShutdown()
|
||||
SRBleUtil.instance.writeData(it.bleDevice, cmd)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class TrackingDurationSetActivity :
|
||||
|
||||
//选中的下标
|
||||
private var mSelectIndex = -1
|
||||
private var mSelectTempIndex = -1
|
||||
|
||||
private var mMapDeviceBean: MapDeviceBean? = null
|
||||
|
||||
@@ -62,6 +63,7 @@ class TrackingDurationSetActivity :
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
showToast(R.string.txt_change_successful)
|
||||
mSelectIndex = mSelectTempIndex
|
||||
ViewUtil.instance.updateDataBeanOnlySelectedItem(
|
||||
mDurationSetAdapter, mDurationSetAdapter.getData(), mSelectIndex
|
||||
)
|
||||
@@ -143,7 +145,7 @@ class TrackingDurationSetActivity :
|
||||
fun setTrackingDuration(pos: Int) {
|
||||
if (mSelectIndex == pos) return
|
||||
mMapDeviceBean?.apply {
|
||||
mSelectIndex = pos
|
||||
mSelectTempIndex = pos
|
||||
val dataBean = mDurationSetAdapter.getData()[pos]
|
||||
if (BleManager.getInstance().isConnected(deviceMacId)) {
|
||||
SRBleUtil.instance.isConnectBleSendCmdData(
|
||||
|
||||
@@ -361,14 +361,11 @@ class HomeTrackFragment :
|
||||
mTurnoffLiveData.observe(viewLifecycleOwner) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
// mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
||||
// mTrackMenuAdapter.notifyItemChanged(4)
|
||||
// bleTurnOff()
|
||||
mBleTrackDeviceBean?.apply {
|
||||
SRBleUtil.instance.writeData(
|
||||
bleDevice, SRBleCmdUtil.instance.forcedShutdown()
|
||||
)
|
||||
}
|
||||
// mBleTrackDeviceBean?.apply {
|
||||
// SRBleUtil.instance.writeData(
|
||||
// bleDevice, SRBleCmdUtil.instance.forcedShutdown()
|
||||
// )
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -819,8 +816,22 @@ class HomeTrackFragment :
|
||||
)
|
||||
}
|
||||
} else if (data0 == 4 && data1 == 1 && data2 == 0) {
|
||||
mMapDeviceBean?.let {
|
||||
mTrackerSetViewModel.turnOff(it.deviceServerId)
|
||||
// mMapDeviceBean?.let {
|
||||
// mTrackerSetViewModel.turnOff(it.deviceServerId)
|
||||
// }
|
||||
// mTrackMenuList[1].menuValue = ""
|
||||
// mTrackMenuList[2].menuValue = ""
|
||||
// mTrackMenuList[3].menuValue = ""
|
||||
// //取消红点显示
|
||||
// mTrackMenuList[3].isSwitch = false
|
||||
// mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
||||
// mTrackMenuAdapter.notifyItemRangeChanged(1, 4)
|
||||
} else if (data0 == 0x18 && data1 == 1 && data2 == 0) {
|
||||
mBleTrackDeviceBean?.apply {
|
||||
SRBleUtil.instance.disconnectToMac(mac)
|
||||
}
|
||||
mMapDeviceBean?.let {ble->
|
||||
mTrackerSetViewModel.turnOff(ble.deviceServerId)
|
||||
}
|
||||
mTrackMenuList[1].menuValue = ""
|
||||
mTrackMenuList[2].menuValue = ""
|
||||
@@ -829,10 +840,6 @@ class HomeTrackFragment :
|
||||
mTrackMenuList[3].isSwitch = false
|
||||
mTrackMenuList[4].menuValue = ConstantInt.Close.toString()
|
||||
mTrackMenuAdapter.notifyItemRangeChanged(1, 4)
|
||||
} else if (data0 == 0x18 && data1 == 1 && data2 == 0) {
|
||||
mBleTrackDeviceBean?.apply {
|
||||
SRBleUtil.instance.disconnectToMac(mac)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user