fix bug tts of callchat and trafficlight code
This commit is contained in:
zhongchao
2021-11-15 20:14:41 +08:00
parent 9deee6d58c
commit 0da4b20852
7 changed files with 61 additions and 25 deletions

View File

@@ -27,11 +27,13 @@ import com.mogo.eagle.core.function.hmi.ui.camera.CameraListView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeBannerView
import com.mogo.eagle.core.function.hmi.ui.notice.NoticeNormalBannerView
import com.mogo.eagle.core.function.hmi.ui.setting.DebugSettingView
import com.mogo.eagle.core.function.hmi.ui.utils.visible
import com.mogo.eagle.core.function.hmi.ui.widget.V2XNotificationView
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.utils.logger.Logger
import kotlinx.android.synthetic.main.fragment_hmi.*
import androidx.core.view.isVisible as isVisible
/**
* @author xiaoyuzhou
@@ -281,6 +283,10 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
viewTrafficLightVr?.showWarningTrafficLight(checkLightId)
}
override fun isWarningTrafficLightShow(): Boolean {
return viewTrafficLightVr.visibility == View.VISIBLE
}
/**
* 关闭红绿灯预警展示,并重制灯态
*/

View File

@@ -15,6 +15,10 @@ class TrafficLightHMIManager {
private var initView: Boolean = false
fun isWarningTrafficLightShow():Boolean{
return CallerHmiManager.isWarningTrafficLightShow()
}
fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
val currentTrafficLight = trafficLightResult.currentRoadTrafficLight()
currentTrafficLight?.let {

View File

@@ -46,6 +46,13 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
TrafficLightThreadHandler(WorkThreadHandler.newInstance("TrafficLight").looper,
{
Logger.d(TAG, "loop search roadID , mLocation : $mLocation")
//查询路口时,如果红绿灯显示,则隐藏掉
if(TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()){
TrafficLightHMIManager.INSTANCE.hideTrafficLight()
CallTrafficLightListenerManager.resetTrafficLightData()
}
mLocation?.let { it ->
val tileId = MogoApisHandler.getInstance().apis
.mapServiceApi.mapUIController.getTileId(it.longitude, it.latitude)
@@ -74,7 +81,12 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
CallTrafficLightListenerManager.invokeTrafficLightStatus(result)
},
{ errorMsg ->
//如果没有获取到正确的红绿灯数据,则取消读灯,继续读路口,防止出现一直读灯的情况
Logger.d(TAG, "request Traffic Light error : $errorMsg")
//stop loop traffic light
trafficLightNetWorkModel.cancelRequestTrafficLight()
//未查到红绿灯加入2秒延时请求路口ID
mThreadHandler?.sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD, 2_000L)
})
}
}, {
@@ -116,7 +128,7 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
&& (CoordinateUtils.calculateLineDistance(
it.longitude, it.latitude,
trafficLightResult!!.lon, trafficLightResult!!.lat
) < 5)
) < 10)
) {
trafficLightResult = null
TrafficLightHMIManager.INSTANCE.hideTrafficLight()

View File

@@ -12,6 +12,7 @@ data class TrafficLightResult(
val lat: Double, //纬度
val lon: Double, //经度
val direction: String, //航向角
val heading: String, //红绿灯方向
val lightId: Int, //红绿灯ID
val laneNo: Int, //车道号
val arrowNo: Int, //当前车道对应地面要素转向

View File

@@ -63,6 +63,11 @@ interface IMoGoWaringProvider {
*/
fun showWarningTrafficLight(checkLightId: Int)
/**
* 红绿灯是否展示
*/
fun isWarningTrafficLightShow():Boolean
/**
* 关闭红绿灯预警
*/

View File

@@ -16,15 +16,16 @@ import com.mogo.eagle.core.function.call.base.CallerBase
* HMI 调用者管理这里对外及其他模块提供功能的调用用啥写啥不要过度设计不允许直接将Provider暴露出去
*/
object CallerHmiManager : CallerBase() {
private val waringProviderApi: IMoGoWaringProvider?
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI).navigation() as IMoGoWaringProvider
private val waringProviderApi: IMoGoWaringProvider
get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI)
.navigation() as IMoGoWaringProvider;
/**
* 隐藏 脉速表
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setSpeedChartViewVisibility(visibility: Int) {
waringProviderApi?.setSpeedChartViewVisibility(visibility)
waringProviderApi.setSpeedChartViewVisibility(visibility)
}
/**
@@ -32,7 +33,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setAutopilotStatusViewVisibility(visibility: Int) {
waringProviderApi?.setAutopilotStatusViewVisibility(visibility)
waringProviderApi.setAutopilotStatusViewVisibility(visibility)
}
/**
@@ -40,7 +41,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setPerspectiveSwitchViewVisibility(visibility: Int) {
waringProviderApi?.setPerspectiveSwitchViewVisibility(visibility)
waringProviderApi.setPerspectiveSwitchViewVisibility(visibility)
}
/**
@@ -48,7 +49,7 @@ object CallerHmiManager : CallerBase() {
* @param visibility View.VISIBLE, View.INVISIBLE,View.GONE
*/
fun setCheckStatusViewVisibility(visibility: Int) {
waringProviderApi?.setCheckStatusViewVisibility(visibility)
waringProviderApi.setCheckStatusViewVisibility(visibility)
}
/**
@@ -66,7 +67,7 @@ object CallerHmiManager : CallerBase() {
tag: String?,
listenerIMoGo: IMoGoWarningStatusListener?
) {
waringProviderApi?.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo)
waringProviderApi.showWarningV2X(v2xType, alertContent, ttsContent, tag, listenerIMoGo)
}
/**
@@ -74,7 +75,7 @@ object CallerHmiManager : CallerBase() {
* @param tag 弹窗标识
*/
fun disableWarningV2X(tag: String?) {
waringProviderApi?.disableWarningV2X(tag)
waringProviderApi.disableWarningV2X(tag)
}
/**
@@ -83,35 +84,42 @@ object CallerHmiManager : CallerBase() {
* @param checkLightId 0-都是默认1-红2-黄3-绿
*/
fun showWarningTrafficLight(checkLightId: Int) {
waringProviderApi?.showWarningTrafficLight(checkLightId)
waringProviderApi.showWarningTrafficLight(checkLightId)
}
/**
* 关闭红绿灯预警
*/
fun disableWarningTrafficLight() {
waringProviderApi?.disableWarningTrafficLight()
waringProviderApi.disableWarningTrafficLight()
}
/**
* 红绿灯是否展示
*/
fun isWarningTrafficLightShow(): Boolean {
return waringProviderApi.isWarningTrafficLightShow()
}
/**
* 修改红灯倒计时
*/
fun changeCountdownRed(redNum: Int) {
waringProviderApi?.changeCountdownRed(redNum)
waringProviderApi.changeCountdownRed(redNum)
}
/**
* 修改黄灯倒计时
*/
fun changeCountdownYellow(yellowNum: Int) {
waringProviderApi?.changeCountdownYellow(yellowNum)
waringProviderApi.changeCountdownYellow(yellowNum)
}
/**
* 修改绿灯倒计时
*/
fun changeCountdownGreen(greenNum: Int) {
waringProviderApi?.changeCountdownGreen(greenNum)
waringProviderApi.changeCountdownGreen(greenNum)
}
/**
@@ -120,7 +128,7 @@ object CallerHmiManager : CallerBase() {
* @param greenNum 绿灯倒计时
*/
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
waringProviderApi?.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
waringProviderApi.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
}
/**
@@ -129,14 +137,14 @@ object CallerHmiManager : CallerBase() {
* @param limitingSpeed 限速速度
*/
fun showLimitingVelocity(limitingSpeed: Int) {
waringProviderApi?.showLimitingVelocity(limitingSpeed)
waringProviderApi.showLimitingVelocity(limitingSpeed)
}
/**
* 关闭限速预警
*/
fun disableLimitingVelocity() {
waringProviderApi?.disableLimitingVelocity()
waringProviderApi.disableLimitingVelocity()
}
/**
@@ -145,7 +153,7 @@ object CallerHmiManager : CallerBase() {
* @see WarningDirectionEnum
*/
fun showWarning(direction: WarningDirectionEnum) {
waringProviderApi?.showWarning(direction)
waringProviderApi.showWarning(direction)
}
/**
@@ -155,7 +163,7 @@ object CallerHmiManager : CallerBase() {
* @param closeTime 倒计时
*/
fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
waringProviderApi?.showWarning(direction, closeTime)
waringProviderApi.showWarning(direction, closeTime)
}
/**
@@ -164,7 +172,7 @@ object CallerHmiManager : CallerBase() {
* @param trafficStylePushData
*/
fun showTrafficBanner(trafficStylePushData: NoticeTrafficStylePushData?) {
waringProviderApi?.showNoticeForTrafficWithData(trafficStylePushData)
waringProviderApi.showNoticeForTrafficWithData(trafficStylePushData)
}
/**
@@ -172,21 +180,21 @@ object CallerHmiManager : CallerBase() {
*
*/
fun showNoticeNormalData(noticeNormal: NoticeNormalData) {
waringProviderApi?.showNoticeNormalData(noticeNormal)
waringProviderApi.showNoticeNormalData(noticeNormal)
}
/**
* 展示VIP标识
*/
fun vipIdentification(visible: Boolean) {
waringProviderApi?.vipIdentification(visible)
waringProviderApi.vipIdentification(visible)
}
fun startRoadCameraLive(flvUrl: String) {
waringProviderApi?.startRoadCameraLive(flvUrl)
waringProviderApi.startRoadCameraLive(flvUrl)
}
fun showNoSignalView() {
waringProviderApi?.showNoSignView()
waringProviderApi.showNoSignView()
}
}

View File

@@ -16,7 +16,7 @@ object IMVoiceClient {
private var intentRegister: IMogoIntentManager? = null
private const val REQUEST_VOICE_CALL = "主人,有新的小伙伴找你聊天啦,你要接听吗?你可以说“接听”开启通话。或者说“挂断”结束通话"
private const val REQUEST_CLOUD_VOICE_CALL = "您有来自管理平台的语音电话,请接听!"
private const val REQUEST_CLOUD_VOICE_CALL = "云平台请求跟你进行语音通话"
private val requestCallYArray: Array<String> = arrayOf("接听")
private val requestCallNArray: Array<String> = arrayOf("挂断")