Merge branch 'dev_robotaxi-d_241112_6.8.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robotaxi-d_241112_6.8.0

This commit is contained in:
xinfengkun
2024-11-27 10:30:44 +08:00
11 changed files with 106 additions and 75 deletions

View File

@@ -127,13 +127,20 @@ object BleManager : BaseBluetoothManager() {
if(!scanList.contains(ochBluetoothGattCallback)){
scanList.add(ochBluetoothGattCallback)
}
Log.d(TAG1, "超时返回 $ochBluetoothGattCallback scanList个数:${scanList.size}___sendDataIntDev个数:${sendDataIntDev.size}")
Log.d(TAG1, "超时返回 $ochBluetoothGattCallback scanList个数:${scanList}___sendDataIntDev个数:${sendDataIntDev}")
}
fun removeFromScandAndWrite(ochBluetoothGattCallback: OchBluetoothGattCallback) {
@SuppressLint("MissingPermission")
fun removeFromScandAndWrite(ochBluetoothGattCallback: OchBluetoothGattCallback,trySend:Boolean) {
sendDataIntDev.remove(ochBluetoothGattCallback)
scanList.remove(ochBluetoothGattCallback)
Log.d(TAG1, "链接超次 $ochBluetoothGattCallback scanList个数:${scanList.size}___sendDataIntDev个数:${sendDataIntDev.size}")
if(scanList.contains(ochBluetoothGattCallback)){
val temp = ochBluetoothGattCallback.getSendData()
// 只发送第一条
temp.firstNotNullOf {data->
sendData2Wx(ochBluetoothGattCallback.device.name,data.key)
}
}
Log.d(TAG1, "链接超次 $ochBluetoothGattCallback scanList个数:${scanList}___sendDataIntDev个数:${sendDataIntDev}")
}
}

View File

@@ -45,23 +45,26 @@ class OchBluetoothGattCallback(device: BluetoothDevice) : BluetoothGattCallback(
private var isDestory = false
private var connectStartTime = 0L
private val connectTimeOUt = 25_000
var isConnected:Boolean by Delegates.observable(false) { _, oldValue, newValue ->
if (oldValue != newValue) {
Log.i(TAG,"${device.name}:链接状态发生变化${newValue}")
if(!newValue){
OchChainLogManager.writeChainLogBluetooth("连接","连接断开")
closeAndDestory()
}
}
}
private val TAG = "GattCallback"
fun closeAndDestory(){
fun closeAndDestory(trySend:Boolean){
isDestory = true
closeConn(false)
BleManager.removeFromScandAndWrite(this)
BleManager.removeFromScandAndWrite(this,trySend)
}
/**
@@ -82,16 +85,21 @@ class OchBluetoothGattCallback(device: BluetoothDevice) : BluetoothGattCallback(
gatt.discoverServices() //启动服务发现
}else{
isConnected = false
closeAndDestory(true)
Log.i(TAG,"与[${dev.name}]连接断开")
}
}else{
Log.i(TAG,"与[${dev.name}]连接出错,错误码:$status")
when (status) {
8 -> {
closeAndDestory()
closeAndDestory(false)
}
else -> {
connect()
if(System.currentTimeMillis()-connectStartTime>=connectTimeOUt){
closeAndDestory(true)
}else {
connect()
}
}
}
@@ -168,6 +176,7 @@ class OchBluetoothGattCallback(device: BluetoothDevice) : BluetoothGattCallback(
mBluetoothGatt?.disconnect()
mBluetoothGatt?.close()
mBluetoothGatt = null
isConnected = false
currentTryCount = 0
if(needCopy&&!isDestory) {
BleManager.copy2ScanList(this)
@@ -201,13 +210,13 @@ class OchBluetoothGattCallback(device: BluetoothDevice) : BluetoothGattCallback(
waitSendData.remove(text)
if(waitSendData.isEmpty()){
OchChainLogManager.writeChainLogBluetooth("写数据","写15s超时")
closeAndDestory()
closeAndDestory(true)
}
sendData()
}
}else{
OchChainLogManager.writeChainLogBluetooth("发现服务","server 为null 没有链接服务")
closeAndDestory()
closeAndDestory(false)
}
}
@@ -221,7 +230,7 @@ class OchBluetoothGattCallback(device: BluetoothDevice) : BluetoothGattCallback(
}else {
if (isDestory) {
OchChainLogManager.writeChainLogBluetooth("连接","已销毁")
closeAndDestory()
closeAndDestory(false)
return
}
connect()
@@ -229,6 +238,10 @@ class OchBluetoothGattCallback(device: BluetoothDevice) : BluetoothGattCallback(
}
}
fun getSendData():MutableMap<String,UUID>{
return waitSendData
}
/**
* 链接成功后发送
* 写超时后 写下一条
@@ -253,13 +266,14 @@ class OchBluetoothGattCallback(device: BluetoothDevice) : BluetoothGattCallback(
if(currentTryCount>maxTryCount||isDestory){
// 重新扫描该设备
OchChainLogManager.writeChainLogBluetooth("连接","超过次数")
closeAndDestory()
closeAndDestory(false)
return
}
currentTryCount += 1
val temp = currentTryCount
closeConn(false)
currentTryCount = temp
connectStartTime = System.currentTimeMillis()
mBluetoothGatt = _device.connectGatt(AbsMogoApplication.getApp(), false, this, TRANSPORT_LE)
}

View File

@@ -208,6 +208,7 @@ object TicketModel {
1006 -> sendMessage2Driver("车票路线信息与当前车辆执行任务的路线信息不符合", phone,1006)
1008 -> sendMessage2Driver("车票剩余可用次数为0", phone,99)
6001 -> sendMessage2Driver("二维码已过期", phone,6001)
6003 -> sendMessage2Driver("车票站点信息与当前车辆执行任务的站点信息不符合", phone,6003)
1012 -> sendMessage2Driver("当前用户下单路线非当前的车辆所属公司", phone,1012)
else -> {
try {

View File

@@ -164,7 +164,7 @@ class WriteOffCacheRepository : IWriteOffRepository {
siteId = it.startStationId
} else {
throw DataException(
1006,
6003,
"车票站点信息与当前车辆执行任务的站点信息不符合"
)
}

View File

@@ -78,9 +78,6 @@ object BindingCarManager : IMoGoAutopilotCarConfigListener, IMoGoCloudListener {
"${M_DEVA}${TAG}",
"onAutopilotCarConfig carConfigResp.macAddress = ${carConfigResp.macAddress} "
)
if (SharedPrefsMgr.getInstance().sn.isNullOrEmpty()) {
return
}
this.carConfigResp = carConfigResp
getBindingCarInfo(carConfigResp.macAddress, SharedPrefsMgr.getInstance().sn)
}

View File

@@ -14,6 +14,7 @@ import com.mogo.eagle.core.function.api.driver.video.IDriveSeatVideoProvider.Eve
import com.mogo.eagle.core.function.api.driver.video.IDriveSeatVideoProvider.Event.Failed
import com.mogo.eagle.core.function.api.driver.video.IDriveSeatVideoProvider.Event.Loading
import com.mogo.eagle.core.function.api.driver.video.IDriveSeatVideoProvider.Event.Playing
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.tencent.liteav.basic.log.TXCLog
@@ -58,8 +59,10 @@ class DriveSeatVideoProviderImpl: IDriveSeatVideoProvider {
override suspend fun requestVideoInfo(): VideoUrlData? {
val plateNumber = AppConfigInfo.plateNumber
if (TextUtils.isEmpty(plateNumber)) {
val plateNumber = CallerDataCenterBizListener.getPlateNumber()
// val plateNumber = "京A40188D"
Log.d(TAG, "requestVideoInfo -> $plateNumber")
if (plateNumber == null || TextUtils.isEmpty(plateNumber)) {
Log.e(TAG, "-- isVideoLiveUsable -- plate number is empty.")
return null
}

View File

@@ -95,6 +95,10 @@ class UpgradeAppNetWorkManager private constructor() {
Log.d(TAG, "getAppUpgradeInfo: -> records:" + records?.entries?.joinToString(",") { itx -> "key:${itx.key} -> value:[${itx.value.joinToString(",") { "${it.first},${it.second}" } }]"})
val versionCode = AppUtils.getAppVersionCode()
val versionName = AppUtils.getAppVersionName()
val latestMacAddress = BindingCarManager.getMacAddress()
if (latestMacAddress != null && !TextUtils.equals(latestMacAddress, macAddress)) {
macAddress = latestMacAddress
}
Log.d(SceneConstant.M_DEVA + TAG, "getAppUpgradeInfo mac = $macAddress---type = $type---sn = $sn---versionCode =$versionCode---versionName =$versionName")
val request = UpgradeAppRequest(sn, macAddress, type, versionName, "1")
val requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request))

View File

@@ -4,6 +4,7 @@ import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import android.util.Log
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -54,6 +55,7 @@ import com.mogo.eagle.core.function.hmi.ui.operate.preferences.PreferenceWithWel
import com.mogo.eagle.core.function.hmi.ui.tools.SweeperModeChangedConfirmDialog
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog.Companion.hmiAction
import com.mogo.eagle.core.function.hmi.ui.utils.SOPAnalyticsManager.clickEventAnalytics
import com.mogo.eagle.core.utilcode.floating.MoGoPopWindow
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -898,8 +900,14 @@ class OperatePanelLayout : LinearLayout {
clickEventAnalytics("视频流驾驶位开关", isChecked)
val map = HashMap<String, String>()
map["open"] = if (isChecked) "1" else "0"
map["playUrl"] = CallerDevaToolsManager.driveSeatVideoProvider()?.getLastData()?.livePlayUrl ?: ""
val playUrl = CallerDevaToolsManager.driveSeatVideoProvider()?.getLastData()?.livePlayUrl ?: ""
map["playUrl"] = playUrl
CallerTelematicManager.sendMsgToAllClients(TelematicConstant.DRIVE_SEAT_VIDEO_STREAM_REQ, toJson(map).toByteArray())
// CallerDevaToolsManager.driveSeatVideoProvider()?.getDriveVideoView(playUrl) { event ->
// Log.d(TAG, "event -> $event")
// }?.also {
// showVideoView(it)
// }
return false
}
}
@@ -909,6 +917,18 @@ class OperatePanelLayout : LinearLayout {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.operate_panel_preference_details_business, rootKey)
}
private fun showVideoView(target: View) {
val activity = AppStateManager.currentActivity() ?: return
MoGoPopWindow.Builder()
.attachToActivity(activity)
.contentView(target)
.draggable(false)
.width(AutoSizeUtils.dp2px(activity, 640.0f))
.height(AutoSizeUtils.dp2px(activity, 480.0f))
.gravityInActivity(Gravity.CENTER)
.build().show()
}
}
class MoFangPreferenceFragmentCompat : OperatePanelDetailBase(), IMoGoMoFangProvider.OnMoFangStatusListener {

View File

@@ -4,7 +4,6 @@ import android.animation.Animator
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.content.Context
import android.graphics.drawable.TransitionDrawable
import android.os.CountDownTimer
import android.text.TextUtils
import android.util.AttributeSet
@@ -12,7 +11,6 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoColdStartStateListener
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
@@ -52,8 +50,6 @@ class ColdStartProcessView @JvmOverloads constructor(
const val TAG = "ColdStartProcessView"
const val LOAD_SSM_WAITING_TIME = 180000L //SSM加载超时等待时间
const val COLD_START_WAITING_TIME = 600000L //冷启动超时等待时间
const val COLD_START_SUCCESS_SHOW_TIME = 3000L //冷启动成功视图展示时长
const val COLD_START_SUCCESS_TICK_TIME = 500L //冷启动成功视图呼吸时长
}
private var ipcConnectStatus = false //连接域控状态,默认是未连接
@@ -71,8 +67,8 @@ class ColdStartProcessView @JvmOverloads constructor(
private var coldStartProcessNormalAnim: FrameAnimatorContainerUtils ?= null
private var coldStartProcessAbnormalAnim: FrameAnimatorContainerUtils ?= null
private var transition: TransitionDrawable ?= null
private var coldStartSuccessTimer: CountDownTimer?= null //冷启动成功动画倒计时
private var successAlpha: ObjectAnimator ?= null //冷启动成功呼吸动画
private var failAlpha: ObjectAnimator ?= null //冷启动失败呼吸动画
init {
LayoutInflater.from(context).inflate(R.layout.view_cold_start_process, this, true)
@@ -80,15 +76,6 @@ class ColdStartProcessView @JvmOverloads constructor(
}
private fun initView(){
transition = TransitionDrawable(
arrayOf(
ContextCompat.getDrawable(context, R.drawable.icon_cold_start_success_01), // 当前图片
ContextCompat.getDrawable(context, R.drawable.icon_cold_start_success_02) // 要渐变到的图片
)
)
ivColdStartResult.setImageDrawable(transition)
transition?.isCrossFadeEnabled = true
clColdStartLayout.setOnClickListener {
CallerHmiManager.showColdStartWindow()
}
@@ -110,15 +97,25 @@ class ColdStartProcessView @JvmOverloads constructor(
coldStartProcessAbnormalAnim?.release()
connectSSMTimer?.cancel()
connectColdStartTimer?.cancel()
successAlpha?.cancel()
failAlpha?.cancel()
}
override fun showColdStartProcessView() {
super.showColdStartProcessView()
ThreadUtils.runOnUiThread {
if(this.visibility != View.VISIBLE){
if(this@ColdStartProcessView.visibility != View.VISIBLE){
this.visibility = View.VISIBLE
coldStartProcessNormalAnim = FrameAnimatorContainerUtils(R.array.cold_start_process_normal,40,ivColdStartProcess)
coldStartProcessAbnormalAnim = FrameAnimatorContainerUtils(R.array.cold_start_process_abnormal,40,ivColdStartProcess)
coldStartProcessNormalAnim = FrameAnimatorContainerUtils(R.array.cold_start_process_normal,40,ivColdStartProcess)
ipcConnectStatus = true
ssmConnectStatus = false
coldStartStatus = false
newColdStart = false
//域控连接成功
coldStartNormalView()
//开启连接SSM倒计时
connectSSMProcess()
}
}
}
@@ -212,6 +209,8 @@ class ColdStartProcessView @JvmOverloads constructor(
//冷启动就绪
coldStartStatus = true
showColdStartSuccessView()
//取消冷启动等待
connectColdStartTimer?.cancel()
}
//记录冷启动成功时间
ColdStartConfig.setColdStartSuccessTime(System.currentTimeMillis())
@@ -274,19 +273,21 @@ class ColdStartProcessView @JvmOverloads constructor(
}
ivColdStartProcess.visibility = View.GONE
ivColdStartResult.visibility = View.VISIBLE
failAlpha?.cancel()
ivColdStartResult.setImageDrawable((ResourceUtils.getDrawable(R.drawable.icon_cold_start_success_02)))
val successAlpha: ObjectAnimator = ObjectAnimator.ofFloat(ivColdStartResult,"alpha",1f,0.5f)
successAlpha.duration = 500
successAlpha.repeatMode = ValueAnimator.REVERSE
successAlpha.repeatCount = 6
successAlpha.start()
successAlpha.addListener(object: Animator.AnimatorListener{
successAlpha = ObjectAnimator.ofFloat(ivColdStartResult,"alpha",1f,0.5f)
successAlpha?.duration = 500
successAlpha?.repeatMode = ValueAnimator.REVERSE
successAlpha?.repeatCount = 6
successAlpha?.start()
successAlpha?.addListener(object: Animator.AnimatorListener{
override fun onAnimationStart(animation: Animator) {
}
override fun onAnimationEnd(animation: Animator) {
ivColdStartResult.visibility = View.GONE
this@ColdStartProcessView.visibility = View.GONE
}
override fun onAnimationCancel(animation: Animator) {
@@ -299,31 +300,6 @@ class ColdStartProcessView @JvmOverloads constructor(
})
// var label = true
// coldStartSuccessTimer = object: CountDownTimer(COLD_START_SUCCESS_SHOW_TIME,COLD_START_SUCCESS_TICK_TIME){
// override fun onTick(millisUntilFinished: Long) {
// ThreadUtils.runOnUiThread {
// label = if(label){
// transition?.startTransition(500)
// false
// }else{
// transition?.reverseTransition(500)
// true
// }
// }
// }
//
// override fun onFinish() {
// ThreadUtils.runOnUiThread {
// this@ColdStartProcessView.visibility = View.GONE
// coldStartProcessNormalAnim?.release()
// coldStartProcessAbnormalAnim?.release()
// }
// }
//
// }
// coldStartSuccessTimer?.start()
}
}
@@ -340,12 +316,13 @@ class ColdStartProcessView @JvmOverloads constructor(
}
ivColdStartProcess.visibility = View.GONE
ivColdStartResult.visibility = View.VISIBLE
successAlpha?.cancel()
ivColdStartResult.setImageDrawable((ResourceUtils.getDrawable(R.drawable.icon_cold_start_fail_02)))
val failAlpha: ObjectAnimator = ObjectAnimator.ofFloat(ivColdStartResult,"alpha",1f,0.5f)
failAlpha.duration = 500
failAlpha.repeatMode = ValueAnimator.REVERSE
failAlpha.repeatCount = ValueAnimator.INFINITE
failAlpha.start()
failAlpha = ObjectAnimator.ofFloat(ivColdStartResult,"alpha",1f,0.5f)
failAlpha?.duration = 500
failAlpha?.repeatMode = ValueAnimator.REVERSE
failAlpha?.repeatCount = ValueAnimator.INFINITE
failAlpha?.start()
}
}

View File

@@ -716,7 +716,9 @@ class TravelRealityView @JvmOverloads constructor(
if (mLocation != null) {
boundsBuilder.include(LatLng(mLocation!!.latitude, mLocation!!.longitude))
}
mSiteList.forEach {
boundsBuilder.include(LatLng(it.latLng.lat!!, it.latLng.lon!!))
}
val cameraUpdate = CameraUpdateFactory.newLatLngBoundsRect(
boundsBuilder.build(),
AutoSizeUtils.dp2px(context, leftPadding.toFloat()),
@@ -1335,7 +1337,9 @@ class TravelRealityView @JvmOverloads constructor(
if (mLocation != null) {
boundsBuilder.include(LatLng(mLocation!!.latitude, mLocation!!.longitude))
}
mSiteList.forEach {
boundsBuilder.include(LatLng(it.latLng.lat!!, it.latLng.lon!!))
}
val cameraUpdate = CameraUpdateFactory.newLatLngBoundsRect(
boundsBuilder.build(),
AutoSizeUtils.dp2px(context, leftPadding.toFloat()),

View File

@@ -116,4 +116,8 @@ object CallerDataCenterBizListener : CallerBase<IDataCenterBizListener>() {
fun getCarModel(): Carmodel? {
return carModel
}
fun getPlateNumber(): String? {
return no
}
}