[2.15.0] fixed conflict

This commit is contained in:
lixiaopeng
2023-03-23 15:00:29 +08:00
8 changed files with 176 additions and 10 deletions

View File

@@ -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
*/

View File

@@ -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?) {
}
}

View File

@@ -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)
}

View File

@@ -0,0 +1 @@
全局路径规划的GSON格式的轨迹点数据放这里然后使用PlanningDataUtils工具类解析一下

View File

@@ -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!!)
}
}

View File

@@ -18,6 +18,7 @@ import com.mogo.support.obu.model.MogoObuRsmWarningData;
import com.mogo.support.obu.model.MogoObuRvWarningData;
import com.mogo.support.obu.model.MogoObuSpatWarningData;
import com.mogo.support.obu.model.MogoObuSystemBConfigData;
import com.mogo.support.obu.model.MogoObuSystemStatusData;
import com.mogo.support.obu.model.advance.AccFourAxes;
import com.mogo.support.obu.model.advance.DateTime;
import com.mogo.support.obu.model.advance.NodeId;
@@ -31,6 +32,7 @@ import com.mogo.support.obu.model.advance.VehControl;
import com.mogo.support.obu.model.advance.VehSize;
import com.mogo.support.obu.model.advance.VerticalLLV;
import com.mogo.support.obu.model.advance.WarningData;
import com.mogo.support.obu.model.result.BaseResult;
import com.mogo.support.obu.option.MogoObuLog;
import com.mogo.support.obu.option.MogoObuOptions;
import com.mogo.support.obu.upgrade.OnUpgradeListener;
@@ -246,6 +248,17 @@ public class ObuManager {
MogoObuManager.getInstance().unregisterTopic(topicIds);
}
/**
* HV 数据推送周期
* 连接成功后调用生效OBU重启失效
*
* @param pushCycle 周期 单位ms 默认值100ms
* @since 1.1.0
*/
public void setHvInfoPushCycle(int pushCycle) {
MogoObuManager.getInstance().setHvInfoPushCycle(pushCycle);
}
/**
* OBU SDK 日志配置
* 支持日志输出至LogCat和写入文件
@@ -328,6 +341,22 @@ public class ObuManager {
}
}
@Override
public void onMogoObuCallResult(BaseResult result) {
super.onMogoObuCallResult(result);
if (listener != null) {
listener.onObuCallResult(result);
}
}
@Override
public void onMogoObuSystemStatus(MogoObuSystemStatusData data) {
super.onMogoObuSystemStatus(data);
if (listener != null) {
listener.onObuSystemStatus(data);
}
}
@Override
public void onMogoObuHvBasics(MogoObuHvBasicsData data) {
if (listener != null) {

View File

@@ -3,6 +3,7 @@ package com.zhidao.support.obu;
import com.mogo.support.obu.ObuScene;
import com.mogo.support.obu.constants.Define;
import com.mogo.support.obu.model.MogoObuSystemStatusData;
import com.mogo.support.obu.model.result.BaseResult;
import mogo.telematics.pad.MessagePad;
@@ -16,6 +17,14 @@ public interface OnObuListener {
*/
void onConnectStatus(@Define.ConnectStatus int connectStatus);
/**
* OBU 函数调用 返回状态
*
* @param result 调用结果
* @since 1.0.0
*/
void onObuCallResult(BaseResult result);
/**
* OBU 系统状态
*

View File

@@ -24,7 +24,7 @@ class IFlyTekTts : IMogoTTS, InitListener {
private var ttsEngine: SpeechSynthesizer? = null
private var engineType = SpeechConstant.TYPE_CLOUD
private var voicer: String = "xiaoyan"
private var voicer: String = "x4_lingxiaoying_en"
private var voicerEntries: Array<String>? = null
// 等级由低到高为0、1、2、3默认为-1表示没有正在tts的
@@ -266,7 +266,7 @@ class IFlyTekTts : IMogoTTS, InitListener {
if (curTtsEntity != null) {// 多语言
val langTtsEntity = curTtsEntity!!.ttsNext()
if (langTtsEntity != null) {
speakVoiceMap[curTtsEntity.toString()]?.onSpeakEnd(curTtsEntity.toString())
// speakVoiceMap[curTtsEntity.toString()]?.onSpeakEnd(curTtsEntity.toString())
ttsNextLanguage(langTtsEntity)
} else {
speakVoiceMap.remove(curTtsEntity.toString())?.onSpeakEnd(curTtsEntity.toString())
@@ -389,7 +389,7 @@ class IFlyTekTts : IMogoTTS, InitListener {
)
//设置合成音量
ttsEngine?.setParameter(
SpeechConstant.VOLUME, "50"
SpeechConstant.VOLUME, "100"
)
} else {
ttsEngine?.setParameter(SpeechConstant.ENGINE_TYPE, SpeechConstant.TYPE_LOCAL)