增加g40蓝牙一键定位功能

This commit is contained in:
2026-10-09 16:27:12 +08:00
parent 0a7a059363
commit 09acfc1564

View File

@@ -421,11 +421,21 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
if (null != data && data.isNotEmpty()) { if (null != data && data.isNotEmpty()) {
val data0 = SRBleCmdUtil.instance.byteToInt(data[0]) val data0 = SRBleCmdUtil.instance.byteToInt(data[0])
val data1 = SRBleCmdUtil.instance.byteToInt(data[1]) val data1 = SRBleCmdUtil.instance.byteToInt(data[1])
// val data2 = SRBleCmdUtil.instance.byteToInt(data[2]) val data2 = SRBleCmdUtil.instance.byteToInt(data[2])
if (data0 == 0x2C && data1 == 1) { if (data0 == 0x2C && data1 == 1) {
stopRefreshLocation()
getHomeV2Activity()?.getPet(false)?.let { getHomeV2Activity()?.getPet(false)?.let {
mMapViewModel.getMapDeviceStatus(it.deviceId, false) //g40
if (it.deviceType == ConstantInt.Type2) {
if (data2 == 0x00) {
mMapViewModel.setupRefreshLocation(it.deviceId)
} else {
stopRefreshLocation()
mMapViewModel.getMapDeviceStatus(it.deviceId, false)
}
} else {
stopRefreshLocation()
mMapViewModel.getMapDeviceStatus(it.deviceId, false)
}
} }
} }
} }
@@ -1087,10 +1097,10 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
showToast(R.string.txt_locate_works, gravity = Gravity.CENTER) showToast(R.string.txt_locate_works, gravity = Gravity.CENTER)
} else if (SRBleUtil.instance.isMacConnect(pet.macID)) { } else if (SRBleUtil.instance.isMacConnect(pet.macID)) {
//g40 //g40
if (pet.deviceType == ConstantInt.Type2) { // if (pet.deviceType == ConstantInt.Type2) {
showToast(R.string.txt_pet_close, gravity = Gravity.CENTER) // showToast(R.string.txt_pet_close, gravity = Gravity.CENTER)
return // return
} // }
val userGpsLat = MMKVUtil.getDouble(MMKVKey.UserGpsLat) val userGpsLat = MMKVUtil.getDouble(MMKVKey.UserGpsLat)
val userGpsLon = MMKVUtil.getDouble(MMKVKey.UserGpsLon) val userGpsLon = MMKVUtil.getDouble(MMKVKey.UserGpsLon)
if (userGpsLat == 0.0 && userGpsLon == 0.0) { if (userGpsLat == 0.0 && userGpsLon == 0.0) {