添加钛方科技碰撞报警相关逻辑,主要增加碰撞阈值设置临时入口和碰撞报警事件转发
This commit is contained in:
@@ -39,22 +39,6 @@ class ObuManager: IMogoObuManager,Handler.Callback {
|
||||
|
||||
private var handler = Handler(Looper.getMainLooper(), this)
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG,"init=======")
|
||||
if (DebugConfig.isUseMockObuData()) {
|
||||
@@ -68,34 +52,6 @@ class ObuManager: IMogoObuManager,Handler.Callback {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun createView(context: Context?): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return "moduleObu"
|
||||
}
|
||||
|
||||
override fun getAppName(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun registerObuDataChangedListener(listener: IMogoObuDataChangedListener?) {
|
||||
this.dataChangedListener = listener
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zhidao.mogo.module.obu.crashwarn
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.obu.IMogoCrashWarnProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.manager.constent.Common
|
||||
import com.zhidao.manager.power.ZDPowerManager
|
||||
import com.zhidao.manager.ts.TsSensorChannel
|
||||
import com.zhidao.manager.ts.TsThreshold
|
||||
|
||||
/**
|
||||
* 碰撞报警provider
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_CRASH_WARNING)
|
||||
class CrashWarningProvider:IMogoCrashWarnProvider {
|
||||
companion object{
|
||||
const val TAG = "CrashWarningProvider"
|
||||
}
|
||||
|
||||
val crashThreshold = TsThreshold(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
|
||||
|
||||
override fun setCrashThreshold(threshold: TsThreshold?) {
|
||||
ZDPowerManager.getInstance().setTsThreshold(threshold)
|
||||
}
|
||||
|
||||
override fun getCurrentCrashThreshold(): TsThreshold = crashThreshold
|
||||
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG, "init---->")
|
||||
ZDPowerManager.getInstance().setTsBoxStatusListener(object : ZDPowerManager.TsBoxStatusListener{
|
||||
override fun onBoxSelfCheckChanged(p0: TsSensorChannel?) {
|
||||
}
|
||||
|
||||
override fun onBoxThresholdChanged(threshold: TsThreshold?) {
|
||||
threshold?.let {
|
||||
Logger.d(TAG, "获取到当前阈值: $threshold")
|
||||
crashThreshold.copy(threshold)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTimeChanged(p0: Int, p1: Int, p2: Int, p3: Int, p4: Int, p5: Int) {
|
||||
}
|
||||
|
||||
override fun onVersionChanged(p0: String?) {
|
||||
}
|
||||
|
||||
override fun onBoxSwitchChanged(p0: Int, p1: Int, p2: Int, p3: Int) {
|
||||
}
|
||||
/**
|
||||
* 碰撞报警事件
|
||||
* @param position 碰撞位置 1:右前车门,2:右后车门,3:左后车门,4:左前车门,5:前保险杠,6:后保险杠
|
||||
* @param levelH 高力度级数(1--5)
|
||||
* @param levelL 低力度级数 (1--5)
|
||||
*/
|
||||
override fun onAlarmChanged(position: Int, levelH: Int, levelL: Int) {
|
||||
// 发送广播通知adas
|
||||
Logger.d(TAG, "碰撞事件报警------ position: $position, levelH: $levelH,levelL: $levelL")
|
||||
val intent = Intent("com.mogo.launcher.action.CRASH_WARNING")
|
||||
intent.putExtra("position", position)
|
||||
intent.putExtra("levelH", levelH)
|
||||
intent.putExtra("levelL", levelL)
|
||||
context.sendBroadcast(intent)
|
||||
}
|
||||
|
||||
override fun onSerialNumChanged(p0: String?) {
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
val getThresholdResult = ZDPowerManager.getInstance().tsBoxStatus
|
||||
Logger.d(TAG, "获取当前碰撞阈值: $getThresholdResult")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user