[2.15.0] fixed conflict
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.datacenter.obu
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.config.HmiBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.*
|
||||
@@ -30,6 +29,10 @@ import com.mogo.support.obu.constants.MogoObuConstants
|
||||
import com.mogo.support.obu.constants.MogoObuLogLevel
|
||||
import com.mogo.support.obu.constants.MogoObuTopicId
|
||||
import com.mogo.support.obu.model.*
|
||||
import com.mogo.support.obu.model.result.BaseResult
|
||||
import com.mogo.support.obu.model.result.MogoObuCallConfigResult
|
||||
import com.mogo.support.obu.model.result.MogoObuCallRegisterResult
|
||||
import com.mogo.support.obu.model.result.MogoObuCallResult
|
||||
import com.mogo.support.obu.option.MogoObuCom
|
||||
import com.mogo.support.obu.option.MogoObuLog
|
||||
import com.mogo.support.obu.option.MogoObuOptions
|
||||
@@ -40,6 +43,7 @@ import com.zhidao.support.obu.OnObuListener
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author lixiaopeng
|
||||
@@ -106,8 +110,7 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
}
|
||||
|
||||
fun setHvInfoSendCycle(time: Int) {
|
||||
Log.d("liyz", "---setHvInfoSendCycle = time = $time")
|
||||
// ObuManager.getInstance().setHvInfoPushCycle(time);
|
||||
ObuManager.getInstance().setHvInfoPushCycle(time);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,10 +209,52 @@ class MogoPrivateObuNewManager private constructor() : OnUpgradeListener {
|
||||
* @param data 系统状态
|
||||
*/
|
||||
override fun onObuSystemStatus(data: MogoObuSystemStatusData?) {
|
||||
Log.d("liyz", "data.toString() = ${data.toString()}" )
|
||||
CallerObuInfoListenerManager.invokeGetObuInfo(data.toString())
|
||||
}
|
||||
|
||||
override fun onObuCallResult(result: BaseResult?) {
|
||||
val builder = StringBuilder("调用结果:\n")
|
||||
when (result!!.function) {
|
||||
MogoObuConstants.CALL_FUNCTION.CONFIG -> {
|
||||
val configResult = result as MogoObuCallConfigResult
|
||||
builder.append(configResult.type.desc).append("配置调用= ")
|
||||
.append(configResult.result.desc)
|
||||
}
|
||||
MogoObuConstants.CALL_FUNCTION.INIT -> {
|
||||
val initResult = result as MogoObuCallResult
|
||||
builder.append("初始化调用= ").append(initResult.result.desc)
|
||||
}
|
||||
MogoObuConstants.CALL_FUNCTION.DEINIT -> {
|
||||
val deinitResult = result as MogoObuCallResult
|
||||
builder.append("用户注销调用= ").append(deinitResult.result.desc)
|
||||
}
|
||||
|
||||
MogoObuConstants.CALL_FUNCTION.TOPIC_REGIST, MogoObuConstants.CALL_FUNCTION.TOPIC_CANCEL -> {
|
||||
val str = if (result.function === MogoObuConstants.CALL_FUNCTION.TOPIC_REGIST) "注册" else "取消注册"
|
||||
val callRegisterResult = result as MogoObuCallRegisterResult
|
||||
if (callRegisterResult.results != null && !callRegisterResult.results.isEmpty()) {
|
||||
val size = callRegisterResult.results.size
|
||||
var i = 0
|
||||
while (i < size) {
|
||||
val register = callRegisterResult.results[i]
|
||||
builder.append(str).append("Topic ID= ").append(register.topicId.desc)
|
||||
.append(" 调用= ").append(register.result.desc)
|
||||
if (i < size - 1) {
|
||||
builder.append("\n")
|
||||
}
|
||||
i++
|
||||
}
|
||||
}
|
||||
}
|
||||
MogoObuConstants.CALL_FUNCTION.SET_DATA -> {
|
||||
val setDataResult = result as MogoObuCallResult
|
||||
builder.append("OBU应用配置= ").append(setDataResult.result.desc)
|
||||
}
|
||||
}
|
||||
val str = builder.toString()
|
||||
CallerLogger.d("$M_OBU${MogoObuConst.TAG_MOGO_NEW_OBU}", "onObuCallResult str = $str")
|
||||
}
|
||||
|
||||
/**
|
||||
* HV车辆基础信息 gnssInfo
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.mogo.eagle.core.function.call.obu.*
|
||||
import com.mogo.support.obu.ObuScene
|
||||
import com.mogo.support.obu.constants.Define.ConnectStatus
|
||||
import com.mogo.support.obu.model.*
|
||||
import com.mogo.support.obu.model.result.BaseResult
|
||||
import com.zhidao.support.obu.OnObuListener
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
@@ -99,4 +100,7 @@ object MoGoObuListenerImpl : OnObuListener {
|
||||
|
||||
}
|
||||
|
||||
override fun onObuCallResult(result: BaseResult?) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.hmi.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -42,6 +43,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.selects.*
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
|
||||
/**
|
||||
@@ -60,6 +62,8 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
private var lastShowV2XJob: Job? = null
|
||||
private var context: Context? = null
|
||||
|
||||
private val scope by lazy { CoroutineScope(Dispatchers.Default + SupervisorJob()) }
|
||||
|
||||
override fun init(context: Context?) {
|
||||
this.context = context
|
||||
}
|
||||
@@ -137,13 +141,37 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
CallerV2XWarningListenerManager.dismiss()
|
||||
}
|
||||
|
||||
Log.d("CODE", "---- 00 ------ tts_content: $ttsContent")
|
||||
if (ttsContent != null && !TextUtils.isEmpty(ttsContent) && playTTS) {
|
||||
val last = lastSpeakJob.get()
|
||||
if (last != null && !last.isCompleted) {
|
||||
Log.d("CODE", "---- 0 ------: last: $last")
|
||||
if (last != null && !last.isCompleted) {
|
||||
Log.d("CODE", "---- 1 ------")
|
||||
return
|
||||
}
|
||||
ProcessLifecycleOwner.get().lifecycleScope.launch(Dispatchers.Main) {
|
||||
speak(it, ttsContent)
|
||||
scope.launch {
|
||||
Log.d("CODE", "---- 2 ------")
|
||||
val d1 = async {
|
||||
Log.d("CODE", "---- 2_1 start ------")
|
||||
speak(it, ttsContent)
|
||||
Log.d("CODE", "---- 2_1 end ------")
|
||||
}
|
||||
val d2 = async {
|
||||
Log.d("CODE", "---- 2_2 start ------")
|
||||
delay((305.75 * ttsContent.length).toLong())
|
||||
Log.d("CODE", "---- 2_2 end ------")
|
||||
}
|
||||
val ret = select<Int> {
|
||||
d1.onAwait { 1 }
|
||||
d2.onAwait { 2 }
|
||||
}
|
||||
if (ret == 1) {
|
||||
d2.cancel()
|
||||
Log.d("CODE", "---- 3 ------")
|
||||
} else {
|
||||
d1.cancel()
|
||||
Log.d("CODE", "---- 4 ------")
|
||||
}
|
||||
}.also { itx ->
|
||||
lastSpeakJob.set(itx)
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
全局路径规划的GSON格式的轨迹点数据放这里,然后使用PlanningDataUtils工具类解析一下
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mogo.eagle.core.function.utils
|
||||
|
||||
import android.content.Context
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
|
||||
object PlanningDataUtils {
|
||||
|
||||
@JvmStatic
|
||||
fun test(context: Context?): List<MessagePad.Location> {
|
||||
if (context == null) return emptyList()
|
||||
val list: MutableList<MessagePad.Location> = ArrayList()
|
||||
val jsonStr = getAssetsString(context, "planningDataTest.txt")
|
||||
try {
|
||||
val jsonElements = JSONArray(jsonStr)
|
||||
for (i in 0 until jsonElements.length()) {
|
||||
val s = jsonElements.getJSONObject(i)
|
||||
val builder = MessagePad.Location.newBuilder()
|
||||
builder.latitude = s.getDouble("latitude")
|
||||
builder.longitude = s.getDouble("longitude")
|
||||
list.add(builder.build())
|
||||
}
|
||||
} catch (e: JSONException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
private fun getAssetsString(context: Context, fileName: String): String {
|
||||
var buffer: ByteArray? = null
|
||||
var istream: InputStream? = null
|
||||
try {
|
||||
istream = context.resources.assets.open(fileName)
|
||||
buffer = ByteArray(istream.available())
|
||||
istream.read(buffer)
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
} finally {
|
||||
try {
|
||||
istream?.close()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
return String(buffer!!)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user