Merge branch 'dev_arch_opt_3.0' into dev_robosweeper-d_app-module_221230_1.1.0
# Conflicts: # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/model/SweeperOrderModel.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/util/SweeperAnalyticsManager.java # OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/SweeperTrafficDataView.java # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SteeringWheelView.java
This commit is contained in:
@@ -15,7 +15,9 @@ import com.mogo.eagle.core.data.deva.scene.SceneModule
|
||||
import com.mogo.eagle.core.data.deva.scene.SceneTAG
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
|
||||
import com.mogo.eagle.core.function.api.devatools.apm.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.zhjt.mogo_core_function_devatools.apm.*
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
|
||||
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
|
||||
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager.Companion.bindingCarManager
|
||||
@@ -44,6 +46,11 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
private val apmEnvProvider by lazy { ApmEnvProviderImpl }
|
||||
|
||||
@Volatile
|
||||
private var mDockerVersion: String? = null
|
||||
|
||||
override fun init(context: Context) {
|
||||
mContext = context
|
||||
}
|
||||
@@ -63,6 +70,7 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
iPCReportManager.initServer()
|
||||
moFangManager.init(mContext!!)
|
||||
bindingCarManager.init(mContext!!)
|
||||
apmEnvProvider.init(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
}
|
||||
|
||||
override fun checkMonitorDb() {
|
||||
@@ -200,10 +208,13 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
}
|
||||
|
||||
override fun envConfigChange(cityCode: String, netMode: Int) {
|
||||
apmEnvProvider.onEnvChanged(if(DebugConfig.isDebug()) "0" else "1", "${ DebugConfig.getNetMode() }", mDockerVersion ?: "")
|
||||
EnvChangeManager.changeTo(cityCode, netMode)
|
||||
}
|
||||
|
||||
override fun dockerVersion(dockerVersion: String?) {
|
||||
mDockerVersion = dockerVersion
|
||||
apmEnvProvider.onEnvChanged(if(DebugConfig.isDebug()) "0" else "1","${ DebugConfig.getNetMode() }", dockerVersion ?: "")
|
||||
BadCaseConfig.dockerVersion = dockerVersion
|
||||
}
|
||||
|
||||
@@ -227,4 +238,5 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
bindingCarManager.queryAppUpgrade()
|
||||
}
|
||||
|
||||
override fun apmEnvProvider(): IApmEnvProvider = apmEnvProvider
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.zhjt.mogo_core_function_devatools.apm
|
||||
|
||||
import android.os.Process
|
||||
import android.text.TextUtils
|
||||
import android.util.*
|
||||
import android.widget.Toast
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.function.api.devatools.apm.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.zhjt.mogo_core_function_devatools.apm.config.*
|
||||
import kotlinx.coroutines.*
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.coroutines.*
|
||||
|
||||
object ApmEnvProviderImpl: IApmEnvProvider, CoroutineScope {
|
||||
|
||||
private const val TAG = "ApmEnvProvider"
|
||||
|
||||
private val scope by lazy { CoroutineScope(Dispatchers.IO + SupervisorJob()) }
|
||||
|
||||
private val hasInit by lazy { AtomicBoolean(false) }
|
||||
|
||||
private val mBuildType by lazy { AtomicReference<String>() }
|
||||
private val mNetType by lazy { AtomicReference<String>() }
|
||||
private val mDockerVersion by lazy { AtomicReference<String>() }
|
||||
|
||||
override val coroutineContext: CoroutineContext
|
||||
get() = scope.coroutineContext
|
||||
|
||||
override fun init(buildType: String, netType: String, dockerVersion: String) {
|
||||
launch {
|
||||
if (ApmEnvConfig.isFirstEnter()) {
|
||||
if (!TextUtils.isEmpty(buildType)) {
|
||||
ApmEnvConfig.setBuildType(buildType)
|
||||
}
|
||||
if (!TextUtils.isEmpty(netType)) {
|
||||
ApmEnvConfig.setNetType(netType)
|
||||
}
|
||||
if (!TextUtils.isEmpty(dockerVersion)) {
|
||||
ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
}
|
||||
}
|
||||
hasInit.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEnvChanged(buildType: String, netType: String, dockerVersion: String) {
|
||||
if (!hasInit.get()) {
|
||||
return
|
||||
}
|
||||
if (mBuildType.get() == buildType && mNetType.get() == netType && mDockerVersion.get() == dockerVersion) {
|
||||
return
|
||||
}
|
||||
launch {
|
||||
Log.d(TAG, "onEnvChanged[1]:[buildType: $buildType, netType:$netType, dockerVersion:$dockerVersion]")
|
||||
var buildTypeChanged = false
|
||||
if (ApmEnvConfig.getBuildType() != buildType) {
|
||||
buildTypeChanged = true
|
||||
ApmEnvConfig.setBuildType(buildType)
|
||||
}
|
||||
var netTypeChanged = false
|
||||
if (ApmEnvConfig.getNetType() != netType) {
|
||||
netTypeChanged = true
|
||||
ApmEnvConfig.setNetType(netType)
|
||||
}
|
||||
var dockerVersionChanged = false
|
||||
val version = ApmEnvConfig.getDockerVersion()
|
||||
if (!TextUtils.isEmpty(version) && !TextUtils.isEmpty(dockerVersion) && version != dockerVersion) {
|
||||
dockerVersionChanged = true
|
||||
ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
}
|
||||
var isFirstDockerVersionSet = false
|
||||
if (TextUtils.isEmpty(version) && !TextUtils.isEmpty(dockerVersion)) {
|
||||
isFirstDockerVersionSet = true
|
||||
ApmEnvConfig.setDockerVersion(dockerVersion)
|
||||
}
|
||||
var isEnvValid = true
|
||||
if (dockerVersionChanged || isFirstDockerVersionSet) {
|
||||
isEnvValid = buildType == "0" || (buildType == "1" && netType == DebugConfig.NET_MODE_RELEASE.toString() && dockerVersion.endsWith("release", true))
|
||||
}
|
||||
val appRelaunched = ApmEnvConfig.isAppRelaunched()
|
||||
Log.d(TAG, "onEnvChanged[2]: buildTypeChanged: $buildTypeChanged, netTypeChanged: $netTypeChanged, dockerVersionChanged:$dockerVersionChanged], isAppLaunched:$appRelaunched")
|
||||
if ((!isEnvValid || (buildTypeChanged || netTypeChanged || dockerVersionChanged)) && !appRelaunched) {
|
||||
ApmEnvConfig.setAppRelaunched(true)
|
||||
restartApp()
|
||||
return@launch
|
||||
}
|
||||
if (isFirstDockerVersionSet) {
|
||||
return@launch
|
||||
}
|
||||
|
||||
if (appRelaunched) {
|
||||
ApmEnvConfig.setAppRelaunched(false)
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(buildType)) {
|
||||
mBuildType.set(buildType)
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(netType)) {
|
||||
mNetType.set(netType)
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(dockerVersion)) {
|
||||
mDockerVersion.set(dockerVersion)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun restartApp() {
|
||||
launch(Dispatchers.Main) {
|
||||
Log.d(TAG, "restartApp ---")
|
||||
Toast.makeText(Utils.getApp(), "发现系统环境不一致,正在重启...", Toast.LENGTH_SHORT).show()
|
||||
delay(50)
|
||||
Utils.getApp().startActivity(Utils.getApp().packageManager.getLaunchIntentForPackage(Utils.getApp().packageName))
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
}
|
||||
|
||||
override fun isDebugEnabled(): Boolean? {
|
||||
return runBlocking {
|
||||
val oldBuildType = ApmEnvConfig.getBuildType()
|
||||
val oldNetType = ApmEnvConfig.getNetType()
|
||||
val oldDockerVersion = ApmEnvConfig.getDockerVersion()
|
||||
if (TextUtils.isEmpty(oldBuildType) || TextUtils.isEmpty(oldNetType) || TextUtils.isEmpty(oldDockerVersion)) {
|
||||
null
|
||||
} else {
|
||||
DebugConfig.isDebug() || (oldBuildType != "1" || oldNetType != DebugConfig.NET_MODE_RELEASE.toString() || !(oldDockerVersion?.endsWith("release", true) ?: false))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.zhjt.mogo_core_function_devatools.apm.config
|
||||
|
||||
import androidx.datastore.core.*
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.zhjt.mogo_core_function_devatools.apm.generated.ApmEnv
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.*
|
||||
import java.io.*
|
||||
|
||||
object ApmEnvConfig {
|
||||
|
||||
private val serializer = object : Serializer<ApmEnv> {
|
||||
|
||||
override val defaultValue: ApmEnv
|
||||
get() = ApmEnv.getDefaultInstance()
|
||||
|
||||
override suspend fun readFrom(input: InputStream): ApmEnv {
|
||||
return withContext(Dispatchers.IO) {
|
||||
ApmEnv.parseFrom(input)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun writeTo(t: ApmEnv, output: OutputStream) {
|
||||
withContext(Dispatchers.IO) {
|
||||
t.writeTo(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val store: DataStore<ApmEnv> by lazy {
|
||||
DataStoreFactory.create(serializer) { File(Utils.getApp().filesDir, "apm_env.pb")}
|
||||
}
|
||||
|
||||
suspend fun isFirstEnter() = store.data.firstOrNull()?.let { it.buildType.isNullOrEmpty() || it.netType.isNullOrEmpty() || it.dockerVersion.isNullOrEmpty() } ?: true
|
||||
|
||||
suspend fun setBuildType(type: String) = store.updateData { it.toBuilder().setBuildType(type).build() }
|
||||
|
||||
suspend fun setDockerVersion(version: String) = store.updateData { it.toBuilder().setDockerVersion(version).build() }
|
||||
|
||||
suspend fun setNetType(type: String) = store.updateData { it.toBuilder().setNetType(type).build() }
|
||||
|
||||
suspend fun getBuildType(): String? = store.data.catch { if (it is IOException) emit(ApmEnv.getDefaultInstance()) }.map { it.buildType }.firstOrNull()
|
||||
|
||||
suspend fun getDockerVersion(): String? = store.data.catch { if (it is IOException) emit(ApmEnv.getDefaultInstance()) }.map { it.dockerVersion }.firstOrNull()
|
||||
|
||||
suspend fun getNetType(): String? = store.data.catch { if (it is IOException) emit(ApmEnv.getDefaultInstance()) }.map { it.netType }.firstOrNull()
|
||||
|
||||
suspend fun setAppRelaunched(isReLaunched: Boolean) = store.updateData { it.toBuilder().setIsRelaunchApp(isReLaunched).build() }
|
||||
|
||||
suspend fun isAppRelaunched(): Boolean = store.data.catch { if (it is IOException) emit(ApmEnv.getDefaultInstance()) }.map { it.isRelaunchApp }.firstOrNull() ?: false
|
||||
}
|
||||
@@ -152,6 +152,9 @@ class BindingCarNetWorkManager private constructor() {
|
||||
}
|
||||
|
||||
private fun updateCarVrIconRes(brandId: String?) {
|
||||
if(!DebugConfig.isCarModelChange()){
|
||||
return
|
||||
}
|
||||
if (brandId == null || brandId.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -7,18 +7,33 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.view.KeyEvent
|
||||
import com.mogo.commons.context.ContextHolderUtil
|
||||
import com.mogo.eagle.core.data.mofang.MfConstants
|
||||
import com.mogo.eagle.core.function.api.mofang.IMoGoMoFangListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorChangeLaneLeft
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorChangeLaneRight
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorSetAcceleratedSpeed
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendOperatorSetHorn
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager.invokeMoFangStatus
|
||||
import com.mogo.eagle.core.function.call.mofang.CallerMofangListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_F
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import java.util.*
|
||||
|
||||
|
||||
/**
|
||||
* 魔方连接状态和设备管理
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
class MoFangManager private constructor() {
|
||||
class MoFangManager private constructor() : IMoGoMoFangListener{
|
||||
|
||||
companion object {
|
||||
val moFangManager: MoFangManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
@@ -31,6 +46,29 @@ class MoFangManager private constructor() {
|
||||
private lateinit var mBluetoothAdapter: BluetoothAdapter
|
||||
private var isMfConnect: Boolean = false //添加状态判断
|
||||
|
||||
private val isShowToast = false //toast 控制,自测使用
|
||||
private var startPressTime: Long = 0 //开始按键时间
|
||||
private var isPressEnd = false //按键是否结束
|
||||
@Volatile
|
||||
private var isCombinationKey = 0 //是否是组合按键 1单击,2长按,3组合
|
||||
private var pressADownTime: Long = 0
|
||||
private var pressAUpTime: Long = 0
|
||||
private var pressBDownTime: Long = 0
|
||||
private var pressBUpTime: Long = 0
|
||||
private var pressCDownTime: Long = 0
|
||||
private var pressCUpTime: Long = 0
|
||||
private var pressDDownTime: Long = 0
|
||||
private var pressDUpTime: Long = 0
|
||||
private var pressEDownTime: Long = 0
|
||||
private var pressEUpTime: Long = 0
|
||||
|
||||
private val clickTime = 300 //单击
|
||||
private val clickTimeInterval = 330
|
||||
private val longPressTime = 670
|
||||
private val longPressTimeInterval = 700
|
||||
private var timerHorn: Timer? = null
|
||||
private var timerAcc: Timer? = null
|
||||
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
@@ -41,6 +79,12 @@ class MoFangManager private constructor() {
|
||||
}
|
||||
mBluetoothAdapter.startDiscovery()
|
||||
showBondedDevice(mBluetoothAdapter)
|
||||
|
||||
CallerMofangListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
fun release() {
|
||||
CallerMofangListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +133,7 @@ class MoFangManager private constructor() {
|
||||
private val bluetoothMonitorReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态 TODO
|
||||
BluetoothAdapter.ACTION_STATE_CHANGED -> { //中间状态
|
||||
CallerLogger.d("$M_F${TAG}","bluetoothMonitorReceiver ACTION_STATE_CHANGED action = ${intent.action}")
|
||||
}
|
||||
|
||||
@@ -115,5 +159,190 @@ class MoFangManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔方按键处理
|
||||
*/
|
||||
override fun onMofangHandle(keyCode: Int, action: Int): Boolean {
|
||||
val bluetoothName = SharedPrefsMgr.getInstance(ContextHolderUtil.getContext()).getString(MfConstants.BLUETOOTH_NAME)
|
||||
if (bluetoothName == "MINI_KEYBOARD") {
|
||||
if (!isPressEnd) {
|
||||
isPressEnd = true
|
||||
startPressTime = System.currentTimeMillis()
|
||||
}
|
||||
e(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent ------ bluetoothName = $bluetoothName ---code = $keyCode -----action = $action ")
|
||||
if (keyCode == KeyEvent.KEYCODE_A) { //单击 -1,长按无操作,AB组合-2
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressADownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent A down pressADownTime = " + pressADownTime + "---" + (pressADownTime - startPressTime) + "----isCombinationKey = " + isCombinationKey + "--pressBDownTime = " + pressBDownTime)
|
||||
if (pressADownTime - startPressTime in (clickTimeInterval + 1) until longPressTime && pressBDownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 A 按AB组合 +1 ")
|
||||
}
|
||||
sendAcc(true, +1.0)
|
||||
isCombinationKey = 3
|
||||
}
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if (pressADownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按A -2 ")
|
||||
}
|
||||
sendAcc(true, -2.0)
|
||||
isCombinationKey = 2
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressAUpTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent A up pressAUpTime = " + pressAUpTime + "---" + (pressAUpTime - startPressTime) + "--pressBDownTime = " + pressBDownTime + "---isCombinationKey = $isCombinationKey")
|
||||
if (pressAUpTime - startPressTime < clickTime && isCombinationKey != 3) {
|
||||
isCombinationKey = 1
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击A -1 ")
|
||||
}
|
||||
sendAcc(true, -1.0)
|
||||
}
|
||||
pressADownTime = 0
|
||||
isPressEnd = false
|
||||
UiThreadHandler.postDelayed({ isCombinationKey = 0 }, 300)
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_B) { //单击复原,长按+1,AB组合-2
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressBDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent B down pressBDownTime = " + pressBDownTime + "--差-" + (pressBDownTime - startPressTime) + "---isCombinationKey = " + isCombinationKey + "--pressADownTime = " + pressADownTime
|
||||
)
|
||||
if (pressBDownTime - startPressTime > clickTimeInterval && pressBDownTime - startPressTime < longPressTime && pressADownTime > 0) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 B 按AB组合 +1 ")
|
||||
}
|
||||
sendAcc(true, +1.0)
|
||||
isCombinationKey = 3
|
||||
}
|
||||
if (isCombinationKey != 3 && isCombinationKey != 1) {
|
||||
if (pressBDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按B 无操作 ")
|
||||
}
|
||||
isCombinationKey = 2
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressBUpTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent B up pressBUpTime = " + pressBUpTime + "--差-" + (pressBUpTime - startPressTime) + "--pressADownTime = " + pressADownTime + "----isCombinationKey = $isCombinationKey")
|
||||
if (pressBUpTime - startPressTime < clickTime && isCombinationKey != 3) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击B 0 ")
|
||||
}
|
||||
sendAcc(false, 0.0)
|
||||
isCombinationKey = 1
|
||||
}
|
||||
pressBDownTime = 0
|
||||
isPressEnd = false
|
||||
UiThreadHandler.postDelayed({ isCombinationKey = 0 }, 300)
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_C) { //单击左变道,长按无操作
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressCDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 长按C 无操作 time dif = " + (pressCDownTime - startPressTime))
|
||||
if (pressCDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按C 无操作 ")
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressCUpTime = System.currentTimeMillis()
|
||||
isPressEnd = false
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 单击C ← 向左变道 time dif = " + (pressCUpTime - startPressTime))
|
||||
if (pressCUpTime - startPressTime < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击C ← 向左变道 ")
|
||||
}
|
||||
sendOperatorChangeLaneLeft()
|
||||
}
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_D) { //单击向右变道,双击无操作
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressDDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 长按D 无操作 time dif = " + (pressDDownTime - startPressTime))
|
||||
if (pressDDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按D 无操作 ")
|
||||
}
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressDUpTime = System.currentTimeMillis()
|
||||
isPressEnd = false
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 单击D → 向右变道 time dif = " + (pressDUpTime - startPressTime))
|
||||
if (pressDUpTime - startPressTime < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击D → 向右变道 ")
|
||||
}
|
||||
sendOperatorChangeLaneRight()
|
||||
}
|
||||
}
|
||||
} else if (keyCode == KeyEvent.KEYCODE_E) { //单击启动自驾,长按鸣笛
|
||||
if (action == KeyEvent.ACTION_DOWN) {
|
||||
pressEDownTime = System.currentTimeMillis()
|
||||
d(M_F + "MoFangManager",
|
||||
"dispatchKeyEvent 方块 长按E 鸣笛 time dif = " + (pressEDownTime - startPressTime))
|
||||
if (pressEDownTime - startPressTime > longPressTimeInterval) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 长按E 鸣笛 ")
|
||||
}
|
||||
sendOperatorSetHorn(1.0)
|
||||
if (timerHorn == null) {
|
||||
timerHorn = Timer()
|
||||
}
|
||||
timerHorn!!.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
sendOperatorSetHorn(2.0)
|
||||
timerHorn = null
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
} else if (action == KeyEvent.ACTION_UP) {
|
||||
pressEUpTime = System.currentTimeMillis()
|
||||
isPressEnd = false
|
||||
d(M_F + "MoFangManager",
|
||||
"方块 单击E 开启自动驾驶 time dif = " + (pressEUpTime - startPressTime))
|
||||
if (pressEUpTime - startPressTime < clickTime) {
|
||||
if (isShowToast) {
|
||||
ToastUtils.showShort("方块 单击E 开启自动驾驶 ")
|
||||
}
|
||||
startAutoPilot(getAutoPilotStatusInfo().autopilotControlParameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun sendAcc(isSend: Boolean, acc: Double) {
|
||||
if (isSend) {
|
||||
if (timerAcc == null) {
|
||||
timerAcc = Timer()
|
||||
timerAcc!!.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
sendOperatorSetAcceleratedSpeed(acc)
|
||||
}
|
||||
}, 0, 500)
|
||||
}
|
||||
} else {
|
||||
if (timerAcc != null) {
|
||||
timerAcc!!.cancel()
|
||||
timerAcc = null
|
||||
}
|
||||
sendOperatorSetAcceleratedSpeed(acc)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.getMisChannelCode
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_DEVA
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
@@ -38,6 +39,7 @@ object SyncConfig {
|
||||
AppConfigInfo.mapSdkOptVersion = DebugConfig.getMapOptVersion()
|
||||
AppConfigInfo.isConnectNet = NetworkUtils.isConnected(context)
|
||||
AppConfigInfo.isConnectSocket = MogoStatusManager.getInstance().isSocketOnLine
|
||||
AppConfigInfo.role = AppIdentityModeUtils.getMisChannelCode(FunctionBuildConfig.appIdentityMode)
|
||||
when {
|
||||
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode) -> {// 司机端
|
||||
AppConfigInfo.isDriver = true
|
||||
|
||||
@@ -43,7 +43,7 @@ class TraceManager : IMoGoCloudListener, IMoGoAutopilotCarConfigListener {
|
||||
// 初始化Trace抓取服务
|
||||
val pkgName = Utils.getApp().packageName
|
||||
ChainTraceStarter.start(pkgName, DeviceUtils.getMacAddress(), false)
|
||||
CallerCloudListenerManager.registerCloudListener(TAG, this)
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
|
||||
// Trace过程中进行日志抓取,对日志进行配置
|
||||
|
||||
@@ -23,7 +23,7 @@ class TtsManager : IMoGoCloudListener {
|
||||
fun initTts(context: Context) {
|
||||
val sn = SharedPrefsMgr.getInstance(context).getString("sn")
|
||||
if (sn.isNullOrEmpty()) {
|
||||
CallerCloudListenerManager.registerCloudListener(TraceManager.TAG, this)
|
||||
CallerCloudListenerManager.addListener(TraceManager.TAG, this)
|
||||
}
|
||||
AIAssist.getInstance(context)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option java_multiple_files = true;
|
||||
option java_package = "com.zhjt.mogo_core_function_devatools.apm.generated";
|
||||
|
||||
|
||||
message ApmEnv {
|
||||
|
||||
/**
|
||||
* 构建类型: release:1; debug:0
|
||||
*/
|
||||
string buildType = 1;
|
||||
|
||||
/**
|
||||
* 网络类型: 1:dev; 2: qa; 3: online; 4: demo
|
||||
*/
|
||||
string netType = 2;
|
||||
/**
|
||||
* docker版本
|
||||
*/
|
||||
string dockerVersion = 3;
|
||||
|
||||
/**
|
||||
* 是否重启了应用
|
||||
*/
|
||||
bool isRelaunchApp = 4;
|
||||
}
|
||||
Reference in New Issue
Block a user