[3.4.0-map-sdk] loc wgs84 opt , get instead of callback , add func of traffic light cross road

This commit is contained in:
zhongchao
2023-09-21 19:33:37 +08:00
parent 056ec28709
commit 39b7d8907f
13 changed files with 175 additions and 245 deletions

View File

@@ -46,28 +46,26 @@ class SteeringBrakeView(context: Context, attrs: AttributeSet?) : ConstraintLayo
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
if (gnssInfo != null) {
//设置刹车信息,小于默认认为是刹车 //todo 优化sp获取不要每次回调都去调用sp
brakeLight =
if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(
MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f
)
) {
1
} else {
0
}
CallerLogger.d(
"$M_HMI$TAG",
"---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight
)
ThreadUtils.runOnUiThread {
if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效
brakeView.visibility = View.VISIBLE
brakeView.setBrakeLight(brakeLight)
} else {
brakeView.visibility = View.GONE
}
//设置刹车信息,小于默认认为是刹车 //todo 优化sp获取不要每次回调都去调用sp
brakeLight =
if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(
MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f
)
) {
1
} else {
0
}
CallerLogger.d(
"$M_HMI$TAG",
"---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight
)
ThreadUtils.runOnUiThread {
if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效
brakeView.visibility = View.VISIBLE
brakeView.setBrakeLight(brakeLight)
} else {
brakeView.visibility = View.GONE
}
}
}

View File

@@ -9,13 +9,11 @@ import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.deva.bindingcar.AdUpgradeStateHelper
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
@@ -42,7 +40,7 @@ class SystemVersionView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener,
IMoGoDevaToolsListener, IMoGoCheckAutoPilotBtnListener, IMoGoChassisLocationWGS84Listener {
IMoGoDevaToolsListener, IMoGoCheckAutoPilotBtnListener {
companion object {
const val TAG = "SystemVersionView"
@@ -57,7 +55,6 @@ class SystemVersionView @JvmOverloads constructor(
private var currentProgress: Int = -1 //当前已下载包体大小
private var isHDCached = false
private var location: MogoLocation? = null
init {
LayoutInflater.from(context).inflate(R.layout.view_system_version, this, true)
@@ -141,17 +138,17 @@ class SystemVersionView @JvmOverloads constructor(
ivHDCache.setOnClickListener {
hmiAction(
"$M_HMI$TAG",
"HD map view click , isHDCached:$isHDCached , lon:${location?.longitude} , lat:${location?.latitude}"
"HD map view click , isHDCached:$isHDCached , lon:${getChassisLocationWGS84().longitude} , lat:${getChassisLocationWGS84().latitude}"
)
if (isHDCached) {// 已缓存
ToastUtils.showShort(resources.getString(R.string.offline_had_downloaded))
} else {// 未缓存
if (CallerMapUIServiceManager.getCityCode().isNullOrEmpty()) {// 未拿到高德的cityCode
if (location == null || (location!!.longitude <= 0.0 && location!!.latitude <= 0.0)) {// 未拿到高精的经纬度
if ((getChassisLocationWGS84().longitude <= 0.0 && getChassisLocationWGS84().latitude <= 0.0)) {// 未拿到高精的经纬度
ToastUtils.showShort(resources.getString(R.string.location_try_again))
} else {// 拿到了高精的经纬度
val dialog = OfflineMapDialog(context)
dialog.location = location
dialog.location = getChassisLocationWGS84()
dialog.show()
}
} else {// 拿到高德的cityCode
@@ -313,7 +310,6 @@ class SystemVersionView @JvmOverloads constructor(
CallerHmiListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerDevaToolsListenerManager.addListener(TAG, this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
needQueryContainers = true
}
@@ -325,7 +321,6 @@ class SystemVersionView @JvmOverloads constructor(
CallerHmiListenerManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerDevaToolsListenerManager.removeListener(TAG)
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
needQueryContainers = false
}
@@ -368,10 +363,6 @@ class SystemVersionView @JvmOverloads constructor(
adCircularProgressView?.visibility = View.GONE
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
location = gnssInfo
}
/**
* 状态查询应答
* @param status 数据