diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5d572339ef..69dd353cde 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -16,6 +16,12 @@
+
+
+
+
+
+
@@ -64,6 +70,7 @@
+
diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java
index b79437d81e..22f2afcbb2 100644
--- a/app/src/main/java/com/mogo/launcher/MogoApplication.java
+++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java
@@ -319,6 +319,8 @@ public class MogoApplication extends AbsMogoApplication {
// widgets 模块
MogoModulePaths.addModuleFunction(new MogoModule(MogoServicePaths.PATH_V2X_WARNING, "IMoGoWaringProvider"));
+ // V2X 模块
+ MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_V2X_MODULE, "V2XProvider"));
// 自动驾驶系统检测模块
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_CHECK, "CheckProvider"));
// 推送模块
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt
index c012eac757..10a8769628 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt
@@ -373,4 +373,8 @@ class MoGoHmiFragment : MvpFragment
override fun onDestroy() {
super.onDestroy()
}
+ override fun vipIdentification(visible: Boolean) {
+ flVipIdentificationView.visibility = if (visible) View.VISIBLE else View.GONE
+ }
+
}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt
index c1692dae3f..fe505c8970 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoWarningContract.kt
@@ -133,5 +133,10 @@ interface MoGoWarningContract {
* @param normalData
*/
fun showNoticeNormal(normalData: NoticeNormalData)
+
+ /**
+ * 展示VIP标识
+ */
+ fun vipIdentification(visible: Boolean)
}
}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/VipIdentificationView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/VipIdentificationView.kt
new file mode 100644
index 0000000000..9ebfc434dc
--- /dev/null
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/VipIdentificationView.kt
@@ -0,0 +1,30 @@
+package com.mogo.eagle.core.function.hmi.ui.widget
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import androidx.constraintlayout.widget.ConstraintLayout
+import com.mogo.eagle.core.function.hmi.R
+import com.mogo.utils.UiThreadHandler
+import kotlinx.android.synthetic.main.view_vip_identification.view.*
+
+/**
+ * VIP标识控件
+ */
+class VipIdentificationView @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
+) : ConstraintLayout(context, attrs, defStyleAttr) {
+
+ init {
+ LayoutInflater.from(context).inflate(R.layout.view_vip_identification, this, true)
+ }
+
+ fun setVipIdentificationVisible(visible: Boolean) {
+ UiThreadHandler.post {
+ ivVipIdentification.visibility = visibility
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt
index 884d2cc8db..5459b2225e 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/warning/MoGoWarningProvider.kt
@@ -120,6 +120,10 @@ class MoGoWarningProvider : IMoGoWaringProvider {
}
}
+ override fun vipIdentification(visible: Boolean) {
+ mMoGoHmiFragment?.vipIdentification(visible)
+ }
+
override fun onDestroy() {
Log.d(TAG, "onDestroy")
}
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/v2x_vip_identification_vr.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/v2x_vip_identification_vr.png
new file mode 100644
index 0000000000..b4f1cc779c
Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/v2x_vip_identification_vr.png differ
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml
index d061568580..a856e8ea80 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml
+++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml
@@ -24,6 +24,14 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/build.gradle b/core/function-impl/mogo-core-function-v2x/build.gradle
index 0cf2df7226..39259f338f 100644
--- a/core/function-impl/mogo-core-function-v2x/build.gradle
+++ b/core/function-impl/mogo-core-function-v2x/build.gradle
@@ -43,6 +43,8 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
+ implementation rootProject.ext.dependencies.coroutinescore
+ implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
@@ -54,11 +56,17 @@ dependencies {
implementation rootProject.ext.dependencies.adasHigh
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
+ implementation rootProject.ext.dependencies.mogoutils //TODO 待将util中网络请求部分转移完毕后解除依赖关系
+ implementation rootProject.ext.dependencies.modulecommon
+
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_api
implementation rootProject.ext.dependencies.mogo_core_function_call
} else {
+ implementation project(":foudations:mogo-utils") //TODO 待将util中网络请求部分转移完毕后解除依赖关系
+ implementation project(':modules:mogo-module-common')
+
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-api')
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/V2XProvider.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/V2XProvider.kt
new file mode 100644
index 0000000000..5b9758baec
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/V2XProvider.kt
@@ -0,0 +1,24 @@
+package com.mogo.eagle.core.function.v2x
+
+import android.content.Context
+import com.alibaba.android.arouter.facade.annotation.Route
+import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_V2X_MODULE
+import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
+import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightManager
+import com.mogo.eagle.core.function.v2x.vip.VipCarManager
+
+@Route(path = PATH_V2X_MODULE)
+class V2XProvider : IMoGoFunctionServerProvider {
+
+ override val functionName: String
+ get() = "V2XProvider"
+
+ override fun init(context: Context) {
+ CallTrafficLightManager.getTrafficLightProvider().initTrafficLightServer(context)
+ VipCarManager.INSTANCE.initServer(context)
+ }
+
+ override fun onDestroy() {
+ VipCarManager.INSTANCE.destroy()
+ }
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightConst.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightConst.kt
new file mode 100644
index 0000000000..bb1dc56689
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightConst.kt
@@ -0,0 +1,26 @@
+package com.mogo.eagle.core.function.v2x.trafficlight
+
+import com.mogo.commons.debug.DebugConfig
+
+class TrafficLightConst {
+
+ companion object {
+ const val MODULE_NAME = "MODULE_V2X_TRAFFIC_LIGHT"
+
+ private const val HOST_DEV = "http://dzt-test.zhidaozhixing.com"
+ private const val HOST_TEST = "http://dzt-test.zhidaozhixing.com"
+ private const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com"
+ private const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com"
+
+ fun getNetHost(): String {
+ return when (DebugConfig.getNetMode()) {
+ DebugConfig.NET_MODE_DEV -> HOST_DEV
+ DebugConfig.NET_MODE_QA -> HOST_TEST
+ DebugConfig.NET_MODE_DEMO -> HOST_DEMO
+ else -> HOST_PRODUCT
+ }
+ }
+ }
+}
+
+
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightHMIManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightHMIManager.kt
new file mode 100644
index 0000000000..77d9c1ae24
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightHMIManager.kt
@@ -0,0 +1,66 @@
+package com.mogo.eagle.core.function.v2x.trafficlight
+
+import android.content.Context
+import com.mogo.eagle.core.data.trafficlight.*
+import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
+
+class TrafficLightHMIManager {
+
+ companion object {
+ const val TAG = "TrafficLightHMIManager"
+
+ val INSTANCE: TrafficLightHMIManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+ TrafficLightHMIManager()
+ }
+ }
+
+ private var mContext: Context? = null
+ private var initView: Boolean = false
+
+ fun init(context: Context) {
+ mContext = context
+ }
+
+ fun updateTrafficLight(trafficLightResult: TrafficLightResult) {
+ if (!initView) {
+ initView = true
+ CallerHmiManager.showWarningTrafficLight(0)
+ }
+ //todo 需要确认场景是否一致
+// val leftTrafficLightStatus = trafficLightResult.laneList.left
+// callerHMIToChangeLight(leftTrafficLightStatus)
+//
+// val midTrafficLightStatus = trafficLightResult.laneList.mid
+// callerHMIToChangeLight(midTrafficLightStatus)
+//
+// val rightTrafficLightStatus = trafficLightResult.laneList.right
+// callerHMIToChangeLight(rightTrafficLightStatus)
+ }
+
+ private fun callerHMIToChangeLight(trafficLightStatus: TrafficLightStatus) {
+ when {
+ trafficLightStatus.isGreen() -> {
+ CallerHmiManager.showWarningTrafficLight(3)
+ if (trafficLightStatus.remain != 99999) {
+ CallerHmiManager.changeCountdownGreen(trafficLightStatus.remain)
+ }
+ }
+ trafficLightStatus.isFlashGreen() -> {
+ CallerHmiManager.showWarningTrafficLight(3)
+ CallerHmiManager.changeCountdownGreen(trafficLightStatus.remain)
+ }
+ trafficLightStatus.isYellow() -> {
+ CallerHmiManager.showWarningTrafficLight(2)
+ CallerHmiManager.changeCountdownYellow(trafficLightStatus.remain)
+ }
+ trafficLightStatus.isRed() -> {
+ CallerHmiManager.showWarningTrafficLight(1)
+ CallerHmiManager.changeCountdownRed(trafficLightStatus.remain)
+ }
+ }
+ }
+
+ fun hideTrafficLight() {
+ CallerHmiManager.disableWarningTrafficLight()
+ }
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightProvider.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightProvider.kt
new file mode 100644
index 0000000000..6bf1237f1b
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/TrafficLightProvider.kt
@@ -0,0 +1,45 @@
+package com.mogo.eagle.core.function.v2x.trafficlight
+
+import android.content.Context
+import com.alibaba.android.arouter.facade.annotation.Route
+import com.mogo.eagle.core.data.constants.MogoServicePaths
+import com.mogo.eagle.core.data.trafficlight.TrafficLightDetail
+import com.mogo.eagle.core.function.api.trafficlight.ITrafficLightProvider
+import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightConst.Companion.MODULE_NAME
+import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager
+import com.mogo.utils.logger.Logger
+
+@Route(path = MogoServicePaths.PATH_TRAFFIC_LIGHT)
+class TrafficLightProvider : ITrafficLightProvider {
+
+ override val functionName: String
+ get() = MODULE_NAME
+
+ override fun init(context: Context) {
+
+ }
+
+ override fun initTrafficLightServer(context: Context) {
+ MogoTrafficLightManager.INSTANCE.initServer(context)
+ TrafficLightHMIManager.INSTANCE.init(context)
+ }
+
+ override fun getTrafficLightCurrentState(): TrafficLightDetail? {
+ return MogoTrafficLightManager.INSTANCE.getTrafficLightCurrentState()
+ }
+
+ override fun turnLightToGreen(
+ lightId: Int,
+ crossingNo: String,
+ heading: Double,
+ onSuccess: (() -> Unit),
+ onError: ((String) -> Unit)
+ ) {
+ return MogoTrafficLightManager.INSTANCE.turnLightToGreen(lightId, crossingNo,heading,onSuccess, onError)
+ }
+
+ override fun onDestroy() {
+ //todo MogoTrafficLightManager onDestroy
+ }
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt
new file mode 100644
index 0000000000..82430b304a
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt
@@ -0,0 +1,134 @@
+package com.mogo.eagle.core.function.v2x.trafficlight.core
+
+import android.content.Context
+import android.location.Location
+import android.os.Handler
+import com.mogo.cloud.commons.utils.CoordinateUtils
+import com.mogo.eagle.core.data.map.MogoLatLng
+import com.mogo.eagle.core.data.trafficlight.TrafficLightDetail
+import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
+import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
+import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightHMIManager
+import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_CROSS_ROAD
+import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT
+import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_CROSS_ROAD
+import com.mogo.eagle.core.function.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT
+import com.mogo.eagle.core.function.v2x.trafficlight.network.TrafficLightNetWorkModel
+import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
+import com.mogo.map.navi.IMogoCarLocationChangedListener2
+import com.mogo.module.common.MogoApisHandler
+import com.mogo.utils.logger.Logger
+
+class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
+
+ companion object {
+
+ const val TAG = "MogoTrafficLightManager"
+
+ val INSTANCE: MogoTrafficLightManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+ MogoTrafficLightManager()
+ }
+ }
+
+ private var mContext: Context? = null
+ private val trafficLightNetWorkModel = TrafficLightNetWorkModel()
+ private var mLocation: Location? = null
+ private var roadId: String? = null
+ private var trafficLightResult: TrafficLightResult? = null
+
+ private var mThreadHandler: Handler? = null
+
+ fun initServer(context: Context) {
+ mContext = context
+ MogoApisHandler.getInstance().apis.registerCenterApi.registerCarLocationChangedListener(TAG, this)
+ Logger.d(TAG, "ready to start mThreadHandler")
+ mThreadHandler =
+ TrafficLightThreadHandler(WorkThreadHandler.newInstance("TrafficLight").looper,
+ {
+ Logger.d(TAG, "loop search roadID , mLocation : $mLocation")
+ mLocation?.let { it ->
+ val tileId =
+ MogoApisHandler.getInstance().apis.mapServiceApi.mapUIController.getTileId(
+ it.longitude,
+ it.latitude
+ )
+ trafficLightNetWorkModel.requestRoadID(tileId, it.latitude, it.longitude, {
+ mThreadHandler!!.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD)
+ roadId = it
+ }, {
+ Logger.d(TAG, "request road id error : $it")
+ })
+ }
+ }, {
+ //stop loop search road id
+ trafficLightNetWorkModel.cancelRequestRoadID()
+ //开始请求红绿灯
+ mThreadHandler!!.sendEmptyMessage(MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT)
+ }, {
+ //start loop traffic light
+ mLocation?.let {
+ trafficLightNetWorkModel.requestTrafficLight(
+ it.latitude, it.longitude, it.bearing.toDouble(), roadId!!, { result ->
+ trafficLightResult = result
+ TrafficLightHMIManager.INSTANCE.updateTrafficLight(result)
+ CallTrafficLightListenerManager.invokeTrafficLightStatus(result)
+ },
+ { errorMsg ->
+ Logger.d(TAG, "request Traffic Light error : $errorMsg")
+ })
+ }
+ }, {
+ //stop loop traffic light
+ trafficLightNetWorkModel.cancelRequestTrafficLight()
+ //刚经过红绿灯,加入3秒延时请求路口ID
+ mThreadHandler!!.sendEmptyMessageDelayed(
+ MSG_WHAT_LOOP_SEARCH_CROSS_ROAD,
+ 3_000L
+ )
+ })
+ mThreadHandler!!.sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD, 5_000L)
+ }
+
+ fun getTrafficLightCurrentState(): TrafficLightDetail? {
+ trafficLightResult?.let {
+ return it.laneList
+ }
+ return null
+ }
+
+ fun turnLightToGreen(
+ lightId: Int,
+ crossingNo: String,
+ heading: Double,
+ onSuccess: (() -> Unit),
+ onError: ((String) -> Unit)
+ ) {
+ trafficLightNetWorkModel.turnLightToGreen(lightId, crossingNo, heading, onSuccess, onError)
+ }
+
+ override fun onCarLocationChanged(latLng: MogoLatLng?) {
+
+ }
+
+ override fun onCarLocationChanged2(latLng: Location?) {
+ latLng?.let {
+ mLocation = latLng
+
+ // 检测是否开过路口,开过路口则停止读灯。并重置 trafficLightResult 值为 null
+ if (trafficLightResult != null
+ && (CoordinateUtils.calculateLineDistance(
+ it.longitude,
+ it.latitude,
+ trafficLightResult!!.lon,
+ trafficLightResult!!.lat
+ ) < 5)
+ ) {
+ trafficLightResult = null
+ TrafficLightHMIManager.INSTANCE.hideTrafficLight()
+ CallTrafficLightListenerManager.resetTrafficLightData()
+ mThreadHandler!!.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT)
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightThreadHandler.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightThreadHandler.kt
new file mode 100644
index 0000000000..9bddcf3ac6
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/TrafficLightThreadHandler.kt
@@ -0,0 +1,64 @@
+package com.mogo.eagle.core.function.v2x.trafficlight.core
+
+import android.os.Handler
+import android.os.Looper
+import android.os.Message
+import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightConst
+import com.mogo.utils.logger.Logger
+
+class TrafficLightThreadHandler : Handler {
+
+ private var loopSearchCrossRoad: (() -> Unit)? = null
+ private var stopSearchCrossRoad: (() -> Unit)? = null
+ private var loopSearchTrafficLight: (() -> Unit)? = null
+ private var stopSearchTrafficLight: (() -> Unit)? = null
+
+ constructor(
+ looper: Looper,
+ loopSearchCrossRoad: (() -> Unit),
+ stopSearchCrossRoad: (() -> Unit),
+ loopSearchTrafficLight: (() -> Unit),
+ stopSearchTrafficLight: (() -> Unit)
+ ) : super(looper) {
+ this.loopSearchCrossRoad = loopSearchCrossRoad
+ this.stopSearchCrossRoad = stopSearchCrossRoad
+ this.loopSearchTrafficLight = loopSearchTrafficLight
+ this.stopSearchTrafficLight = stopSearchTrafficLight
+ }
+
+ companion object {
+ const val MSG_WHAT_LOOP_SEARCH_CROSS_ROAD = 1
+ const val MSG_WHAT_STOP_SEARCH_CROSS_ROAD = 2
+ const val MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT = 3
+ const val MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT = 4
+ }
+
+ override fun handleMessage(msg: Message) {
+ super.handleMessage(msg)
+ when (msg.what) {
+ MSG_WHAT_LOOP_SEARCH_CROSS_ROAD -> {
+ //handler轮询,后续从地图处获取到车道线(前提获取车道线没有异步调用),来优化轮询时长
+ Logger.d(TrafficLightConst.MODULE_NAME,"MSG_WHAT_LOOP_SEARCH_CROSS_ROAD")
+ loopSearchCrossRoad?.invoke()
+ sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD,1_000L)
+ }
+ MSG_WHAT_STOP_SEARCH_CROSS_ROAD -> {
+ if(hasMessages(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD)){
+ removeMessages(MSG_WHAT_LOOP_SEARCH_CROSS_ROAD)
+ }
+ stopSearchCrossRoad?.invoke()
+ }
+ MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT -> {
+ loopSearchTrafficLight?.invoke()
+ sendEmptyMessageDelayed(MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT,500L)
+ }
+ MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT -> {
+ if(hasMessages(MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT)){
+ removeMessages(MSG_WHAT_LOOP_SEARCH_TRAFFIC_LIGHT)
+ }
+ stopSearchTrafficLight?.invoke()
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/network/TrafficLightApiService.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/network/TrafficLightApiService.kt
new file mode 100644
index 0000000000..6badf1f773
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/network/TrafficLightApiService.kt
@@ -0,0 +1,27 @@
+package com.mogo.eagle.core.function.v2x.trafficlight.network
+
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.eagle.core.data.trafficlight.RoadIDResult
+import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
+import retrofit2.http.FieldMap
+import retrofit2.http.FormUrlEncoded
+import retrofit2.http.POST
+
+interface TrafficLightApiService {
+
+ //获取前方路口RoadID
+ @FormUrlEncoded
+ @POST("ai-roadInfo-service/cross/near")
+ suspend fun getFrontRoadID(@FieldMap roadID: Map): BaseResponse
+
+ //获取前方红绿灯状态
+ @FormUrlEncoded
+ @POST("mec-etl-server/light//bgd/channel/realTime")
+ suspend fun getTrafficLight(@FieldMap status: Map): BaseResponse
+
+ //变灯
+ @FormUrlEncoded
+ @POST("mec-etl-server/light/bdg/newTask")
+ suspend fun changeLight(@FieldMap turnLight: Map): BaseResponse
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/network/TrafficLightNetWorkModel.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/network/TrafficLightNetWorkModel.kt
new file mode 100644
index 0000000000..aabdac0ea3
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/network/TrafficLightNetWorkModel.kt
@@ -0,0 +1,123 @@
+package com.mogo.eagle.core.function.v2x.trafficlight.network
+
+import com.google.gson.Gson
+import com.mogo.cloud.network.RetrofitFactory
+import com.mogo.cloud.passport.MoGoAiCloudClientConfig
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.eagle.core.data.trafficlight.*
+import com.mogo.eagle.core.function.v2x.trafficlight.TrafficLightConst
+import com.mogo.utils.network.apiCall
+import com.mogo.utils.network.cancel
+import com.mogo.utils.network.request
+
+class TrafficLightNetWorkModel {
+
+ private fun getNetWorkApi(baseUrl: String = TrafficLightConst.getNetHost()): TrafficLightApiService {
+ return RetrofitFactory.getInstanceNoCallAdapter(baseUrl)!!
+ .create(TrafficLightApiService::class.java)
+ }
+
+ fun requestRoadID(
+ tileID: Long,
+ lat: Double,
+ lon: Double,
+ onSuccess: ((String) -> Unit),
+ onError: ((String) -> Unit),
+ ) {
+ request>("requestRoadID") {
+ val map = hashMapOf()
+ start {
+ val roadIDRequestData = RoadIDRequestData(tileID, lat, lon)
+ map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
+ map["data"] = Gson().toJson(roadIDRequestData)
+ }
+ loader {
+ apiCall {
+ getNetWorkApi().getFrontRoadID(map)
+ }
+ }
+ onSuccess {
+ if(it.result!= null){
+ onSuccess.invoke(it.result.crossId)
+ }else{
+ onSuccess.invoke("11078")
+ }
+ }
+ onError {
+ if (it.message != null) {
+ onError.invoke(it.message!!)
+ }
+ }
+ }
+ }
+
+ fun cancelRequestRoadID() {
+ cancel("requestRoadID")
+ }
+
+ fun requestTrafficLight(
+ lat: Double,
+ lon: Double,
+ bearing: Double,
+ roadId: String,
+ onSuccess: ((TrafficLightResult) -> Unit),
+ onError: ((String) -> Unit),
+ ) {
+ request>("requestTrafficLight") {
+ val map = hashMapOf()
+ start {
+ val trafficLightRequestData = TrafficLightRequestData(lat, lon, bearing, roadId)
+ map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
+ map["data"] = Gson().toJson(trafficLightRequestData)
+ }
+ loader {
+ apiCall {
+ getNetWorkApi().getTrafficLight(map)
+ }
+ }
+ onSuccess {
+ onSuccess.invoke(it.result)
+ }
+ onError {
+ if (it.message != null) {
+ onError.invoke(it.message!!)
+ }
+ }
+ }
+ }
+
+ fun cancelRequestTrafficLight() {
+ cancel("requestTrafficLight")
+ }
+
+ fun turnLightToGreen(
+ lightId: Int,
+ crossingNo: String,
+ heading: Double,
+ onSuccess: (() -> Unit),
+ onError: ((String) -> Unit)
+ ) {
+ request> {
+ val map = hashMapOf()
+ start {
+ val trafficLightRequestData = ChangeLightRequestData(lightId,crossingNo,heading)
+ map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
+ map["data"] = Gson().toJson(trafficLightRequestData)
+ }
+ loader {
+ apiCall {
+ getNetWorkApi().changeLight(map)
+ }
+ }
+ onSuccess {
+ onSuccess.invoke()
+ }
+ onError {
+ if (it.message != null) {
+ onError.invoke(it.message!!)
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt
new file mode 100644
index 0000000000..d3c0d29fc6
--- /dev/null
+++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/vip/VipCarManager.kt
@@ -0,0 +1,141 @@
+package com.mogo.eagle.core.function.v2x.vip
+
+import android.content.Context
+import android.location.Location
+import com.mogo.cloud.commons.utils.CoordinateUtils
+import com.mogo.eagle.core.data.map.MogoLatLng
+import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
+import com.mogo.eagle.core.data.trafficlight.turnRedAtOnce
+import com.mogo.eagle.core.data.v2x.VipMessage
+import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
+import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
+import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
+import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager
+import com.mogo.eagle.core.function.v2x.trafficlight.core.MogoTrafficLightManager
+import com.mogo.map.location.MogoLocation
+import com.mogo.map.navi.IMogoCarLocationChangedListener2
+import com.mogo.module.common.MogoApisHandler
+import com.mogo.module.common.enums.EventTypeEnum
+import com.mogo.service.cloud.socket.IMogoOnMessageListener
+import com.mogo.utils.logger.Logger
+
+class VipCarManager : IMogoOnMessageListener, IMoGoTrafficLightListener,
+ IMogoCarLocationChangedListener2 {
+
+ companion object {
+
+ const val TAG = "VipCarManager"
+
+ val INSTANCE: VipCarManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
+ VipCarManager()
+ }
+ }
+
+ private var mContext: Context? = null
+ private var mLocation: Location? = null
+ private var turnLightEnd = true
+ private var result: TrafficLightResult? = null
+
+ override fun init(context: Context?) {
+ Logger.d(TAG, "init provider")
+ }
+
+ fun initServer(context: Context) {
+ mContext = context
+ MogoApisHandler.getInstance().apis.registerCenterApi.registerCarLocationChangedListener(TAG, this)
+ MogoApisHandler.getInstance().apis.getSocketManagerApi(context)
+ .registerOnMessageListener(401025, this)
+ }
+
+ override fun target(): Class {
+ return VipMessage::class.java
+ }
+
+ override fun onMsgReceived(vipMessage: VipMessage?) {
+ vipMessage?.let {
+ when (it.vipType) {
+ 0 -> {
+ CallerHmiManager.vipIdentification(false)
+ CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG)
+ }
+ 1 -> {
+ CallerHmiManager.vipIdentification(true)
+ CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this)
+ }
+ }
+ }
+ }
+
+ override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) {
+ turnLight()
+ this.result = trafficLightResult
+ //如果上次结果和本次灯态结果变化比较大,则已变灯,控制HMI展示弹窗
+ if ((result!!.laneList.mid.remain - trafficLightResult.laneList.mid.remain) > 3) {
+ CallerHmiManager.showWarningV2X(EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType.toInt(),
+ "",
+ EventTypeEnum.TYPE_VIP_IDENTIFICATION.tts,
+ EventTypeEnum.TYPE_VIP_IDENTIFICATION.poiType,
+ object : IMoGoWarningStatusListener {
+ override fun onShow() {}
+ override fun onDismiss() {
+ }
+ })
+ }
+
+ //可作为补偿措施,暂不启用
+// mLocation?.let {
+// if (canGetThroughCross(it, trafficLightResult)) {
+// turnLight()
+// }
+// }
+ }
+
+ private fun canGetThroughCross(
+ it: MogoLocation,
+ trafficLightResult: TrafficLightResult
+ ): Boolean {
+ return if (CoordinateUtils.calculateLineDistance(
+ it.longitude,
+ it.latitude,
+ trafficLightResult.lon,
+ trafficLightResult.lat
+ ) < 20
+ && turnLightEnd
+ && trafficLightResult.laneList.mid.turnRedAtOnce()
+ ) {
+ turnLightEnd = false
+ false
+ } else {
+ true
+ }
+ }
+
+ private fun turnLight() {
+ result?.let {
+ MogoTrafficLightManager.INSTANCE.turnLightToGreen(
+ it.lightId,
+ it.crossId,
+ mLocation!!.bearing.toDouble(), {
+ Logger.d(TAG, "变灯请求成功")
+ }, { errorMsg ->
+ Logger.d(TAG, "变灯请求失败 msg : $errorMsg")
+ })
+ }
+ }
+
+ fun destroy() {
+ MogoApisHandler.getInstance().apis.getSocketManagerApi(mContext)
+ .unregisterLifecycleListener(401025)
+ mContext = null
+ }
+
+ override fun onCarLocationChanged(latLng: MogoLatLng?) {
+ }
+
+ override fun onCarLocationChanged2(latLng: Location?) {
+ latLng?.let {
+ mLocation = it
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/占位文件.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/占位文件.java
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/BaseResponse.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/BaseResponse.kt
new file mode 100644
index 0000000000..3e5649b218
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/BaseResponse.kt
@@ -0,0 +1,5 @@
+package com.mogo.eagle.core.data
+
+class BaseResponse(val code: Int, val msg: String, val result: T) {
+
+}
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java
index 6139a3b512..1645e0c300 100644
--- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java
@@ -334,6 +334,17 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_CHECK = "/check/api";
+ /**
+ * v2x 模块
+ */
+ public static final String PATH_V2X_MODULE = "/v2x/module";
+
+ /**
+ * 红绿灯模块
+ */
+ @Keep
+ public static final String PATH_TRAFFIC_LIGHT = "/v2x/trafficlight";
+
/**
* 前方碰撞预警 未碰撞
*/
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/BaseLaneInfoList.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/BaseLaneInfoList.kt
new file mode 100644
index 0000000000..fa38264246
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/BaseLaneInfoList.kt
@@ -0,0 +1,6 @@
+package com.mogo.eagle.core.data.trafficlight
+
+//驶入路口需要经过路段
+class BaseLaneInfoList(val tileId: Int, val roadId: String, val laneNo: Int) {
+
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/ChangeLightRequestData.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/ChangeLightRequestData.kt
new file mode 100644
index 0000000000..ddac2bda46
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/ChangeLightRequestData.kt
@@ -0,0 +1,9 @@
+package com.mogo.eagle.core.data.trafficlight
+
+class ChangeLightRequestData(
+ val lightId: Int, //红绿灯ID
+ val crossingNo: String, //路口ID
+ val heading: Double, //行车航向角
+ val action: String? = "" //保留字段,暂时没用
+) {
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadIDRequestData.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadIDRequestData.kt
new file mode 100644
index 0000000000..7d5ea6ab9d
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadIDRequestData.kt
@@ -0,0 +1,5 @@
+package com.mogo.eagle.core.data.trafficlight
+
+//获取路口ID请求数据
+class RoadIDRequestData(val tileId: Long, val lat: Double, val lon: Double) {
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadIDResult.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadIDResult.kt
new file mode 100644
index 0000000000..1066b628cb
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadIDResult.kt
@@ -0,0 +1,16 @@
+package com.mogo.eagle.core.data.trafficlight
+
+//车辆行驶前方100米范围内的 路口ID 查询结果
+/**
+ * RSCrossId : RS系统对应路口id
+ * crossId : ai云路口id
+ * distance : 当前车道需驶入到距离终点距离
+ * baseLaneInfoList : 驶入路口需要经过路段
+ */
+class RoadIDResult(
+ val RSCrossId: String,
+ val crossId: String,
+ val distance: Double,
+ val baseLaneInfoList: BaseLaneInfoList
+) {
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightDetail.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightDetail.kt
new file mode 100644
index 0000000000..a9e8efb243
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightDetail.kt
@@ -0,0 +1,12 @@
+package com.mogo.eagle.core.data.trafficlight
+
+/**
+ * 具体灯态信息
+ */
+class TrafficLightDetail(
+ val left: TrafficLightStatus, //左灯
+ val mid: TrafficLightStatus, //中间灯
+ val right: TrafficLightStatus //右灯
+) {
+
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightRequestData.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightRequestData.kt
new file mode 100644
index 0000000000..1f9fcd5bec
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightRequestData.kt
@@ -0,0 +1,12 @@
+package com.mogo.eagle.core.data.trafficlight
+
+/**
+ * 路口信号灯请求数据
+ */
+class TrafficLightRequestData(
+ val lat: Double,
+ val lon: Double,
+ val bearing: Double, //航向角
+ val roadId: String //路口ID
+) {
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightResult.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightResult.kt
new file mode 100644
index 0000000000..0736ec429d
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightResult.kt
@@ -0,0 +1,14 @@
+package com.mogo.eagle.core.data.trafficlight
+
+/**
+ * 路口红绿灯请求返回数据
+ */
+class TrafficLightResult(
+ val crossId: String, //roadID
+ val lat: Double, //纬度
+ val lon: Double, //经度
+ val direction: String, //航向角
+ val lightId:Int, //红绿灯ID
+ val laneList: TrafficLightDetail //灯态具体信息
+) {
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightStatus.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightStatus.kt
new file mode 100644
index 0000000000..0a69985019
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightStatus.kt
@@ -0,0 +1,37 @@
+package com.mogo.eagle.core.data.trafficlight
+
+
+fun TrafficLightStatus.isRed(): Boolean {
+ return color == "R"
+}
+
+fun TrafficLightStatus.isGreen(): Boolean {
+ return color == "G"
+}
+
+fun TrafficLightStatus.isFlashGreen(): Boolean {
+ return color == "FG"
+}
+
+fun TrafficLightStatus.isYellow(): Boolean {
+ return color == "Y"
+}
+
+fun TrafficLightStatus.isBlack(): Boolean {
+ return color == "B"
+}
+
+fun TrafficLightStatus.turnRedAtOnce(): Boolean {
+ return isFlashGreen() || isYellow()
+}
+
+/**
+ * 红绿灯路口具体灯态信息
+ */
+class TrafficLightStatus(
+ val phaseNo: String, //相位编号
+ val color: String, //灯态: 红灯-R,绿灯-G,绿闪-FG,黄-Y,B-黑
+ val remain: Int //倒计时-秒
+) {
+
+}
\ No newline at end of file
diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/v2x/VipMessage.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/v2x/VipMessage.kt
new file mode 100644
index 0000000000..ab9fd581af
--- /dev/null
+++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/v2x/VipMessage.kt
@@ -0,0 +1,10 @@
+package com.mogo.eagle.core.data.v2x
+
+/**
+ * 变更Vip消息
+ * timeOut: 超时时间
+ * vipType: Vip --1 变成VIP,--0 撤销VIP
+ * content: VIP消息
+ */
+class VipMessage(val timeOut: Long, val vipType: Int, val content: String) {
+}
\ No newline at end of file
diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt
index 88e703e84c..624ec9de3b 100644
--- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt
+++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt
@@ -45,11 +45,11 @@ interface IMoGoWaringProvider : IMoGoFunctionProvider {
* @param tag tag绑定弹窗的标志
*/
fun showWarningV2X(
- v2xType: Int,
- alertContent: String?,
- ttsContent: String?,
- tag: String?,
- listenerIMoGo: IMoGoWarningStatusListener?
+ v2xType: Int,
+ alertContent: String?,
+ ttsContent: String?,
+ tag: String?,
+ listenerIMoGo: IMoGoWarningStatusListener?
)
/**
@@ -132,4 +132,9 @@ interface IMoGoWaringProvider : IMoGoFunctionProvider {
* @param normalData 推送消息体
*/
fun showNoticeNormalData(normalData: NoticeNormalData?)
+
+ /**
+ * 展示VIP标识
+ */
+ fun vipIdentification(visible: Boolean)
}
\ No newline at end of file
diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/IMoGoTrafficLightListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/IMoGoTrafficLightListener.kt
new file mode 100644
index 0000000000..d5feef61a6
--- /dev/null
+++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/IMoGoTrafficLightListener.kt
@@ -0,0 +1,13 @@
+package com.mogo.eagle.core.function.api.trafficlight
+
+import com.alibaba.android.arouter.facade.template.IProvider
+import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
+
+interface IMoGoTrafficLightListener :IProvider{
+
+ /**
+ * 当前红绿灯状态,包含红绿灯灯态,倒计时秒数,灯态经纬度,时间戳,剩余时间
+ */
+ fun onTrafficLightStatus(trafficLightResult: TrafficLightResult)
+
+}
\ No newline at end of file
diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/ITrafficLightProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/ITrafficLightProvider.kt
new file mode 100644
index 0000000000..90f34dd3f8
--- /dev/null
+++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/trafficlight/ITrafficLightProvider.kt
@@ -0,0 +1,26 @@
+package com.mogo.eagle.core.function.api.trafficlight
+
+import android.content.Context
+import com.mogo.eagle.core.data.trafficlight.TrafficLightDetail
+import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
+
+interface ITrafficLightProvider : IMoGoFunctionServerProvider {
+
+ fun initTrafficLightServer(context: Context)
+
+ /**
+ * 获取当前红绿灯数据状态
+ */
+ fun getTrafficLightCurrentState(): TrafficLightDetail?
+
+ /**
+ * 变灯
+ */
+ fun turnLightToGreen(
+ lightId: Int,
+ crossingNo: String,
+ heading: Double,
+ onSuccess: (() -> Unit),
+ onError: ((String) -> Unit)
+ )
+}
\ No newline at end of file
diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
index 1fa8193f60..0138c4fb7b 100644
--- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
+++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt
@@ -174,4 +174,12 @@ object CallerHmiManager : CallerBase() {
fun showNormalBanner(noticeNormal: NoticeNormalData) {
waringProviderApi.showNoticeNormalData(noticeNormal)
}
+
+ /**
+ * 展示VIP标识
+ */
+ fun vipIdentification(visible: Boolean){
+ waringProviderApi.vipIdentification(visible)
+ }
+
}
\ No newline at end of file
diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt
new file mode 100644
index 0000000000..ee96f69987
--- /dev/null
+++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightListenerManager.kt
@@ -0,0 +1,66 @@
+package com.mogo.eagle.core.function.call.trafficlight
+
+import androidx.annotation.Nullable
+import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
+import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
+import com.mogo.eagle.core.utilcode.mogo.logger.Logger
+
+object CallTrafficLightListenerManager {
+
+ private val TAG = "CallTrafficLightListenerManager"
+
+ private val M_TRAFFIC_LIGHT_LISTENER: HashMap =
+ HashMap()
+
+ private var trafficLightResult:TrafficLightResult? = null
+
+ /**
+ * 添加监听
+ * @param tag 标记,用来注销监听使用
+ * @param listener 监听回调
+ */
+ fun registerTrafficLightListener(
+ @Nullable tag: String,
+ @Nullable listener: IMoGoTrafficLightListener
+ ) {
+ trafficLightResult?.let {
+ listener.onTrafficLightStatus(it)
+ }
+ M_TRAFFIC_LIGHT_LISTENER[tag] = listener
+ }
+
+ /**
+ * 删除监听
+ * @param tag 标记,用来注销监听使用
+ */
+ fun unRegisterTrafficLightListener(@Nullable tag: String) {
+ M_TRAFFIC_LIGHT_LISTENER.remove(tag)
+ }
+
+ /**
+ * 删除自动驾驶按钮选中监听
+ * @param listener 要删除的监听对象
+ */
+ fun unRegisterTrafficLightListener(@Nullable listener: IMoGoTrafficLightListener) {
+ M_TRAFFIC_LIGHT_LISTENER.forEach {
+ if (it.value == listener) {
+ M_TRAFFIC_LIGHT_LISTENER.remove(it.key)
+ }
+ }
+ }
+
+ fun invokeTrafficLightStatus(trafficLightResult: TrafficLightResult) {
+ this.trafficLightResult = trafficLightResult
+ M_TRAFFIC_LIGHT_LISTENER.forEach {
+ val tag = it.key
+ Logger.d(TAG, "invokeTrafficLightStatus tag is : $tag")
+ val listener = it.value
+ listener.onTrafficLightStatus(trafficLightResult)
+ }
+ }
+
+ fun resetTrafficLightData(){
+ trafficLightResult = null
+ }
+
+}
\ No newline at end of file
diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightManager.kt
new file mode 100644
index 0000000000..efc7a7d7ee
--- /dev/null
+++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/trafficlight/CallTrafficLightManager.kt
@@ -0,0 +1,20 @@
+package com.mogo.eagle.core.function.call.trafficlight
+
+import com.mogo.eagle.core.data.constants.MogoServicePaths
+import com.mogo.eagle.core.function.api.trafficlight.ITrafficLightProvider
+import com.mogo.eagle.core.function.call.base.CallerBase
+
+object CallTrafficLightManager : CallerBase() {
+
+ fun getTrafficLightProvider(): ITrafficLightProvider {
+ return getApiInstance(
+ ITrafficLightProvider::class.java,
+ MogoServicePaths.PATH_TRAFFIC_LIGHT
+ )
+ }
+
+ fun getTrafficLightCurrentState() {
+ getTrafficLightProvider().getTrafficLightCurrentState()
+ }
+
+}
\ No newline at end of file
diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable-xxhdpi/icon_warning_v2x_vip_turn_light.png b/core/mogo-core-res/src/main/function-hmi-res/drawable-xxhdpi/icon_warning_v2x_vip_turn_light.png
new file mode 100644
index 0000000000..bba50f297a
Binary files /dev/null and b/core/mogo-core-res/src/main/function-hmi-res/drawable-xxhdpi/icon_warning_v2x_vip_turn_light.png differ
diff --git a/core/mogo-core-res/src/main/res/values-xhdpi-2560x1440/dimens.xml b/core/mogo-core-res/src/main/res/values-xhdpi-2560x1440/dimens.xml
index e6be547ae2..1e494a769f 100644
--- a/core/mogo-core-res/src/main/res/values-xhdpi-2560x1440/dimens.xml
+++ b/core/mogo-core-res/src/main/res/values-xhdpi-2560x1440/dimens.xml
@@ -4,6 +4,10 @@
460px
70px
+ 104px
+ 104px
+ 40px
+
30px
130px
diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml
index 17ef05908d..1176968c24 100644
--- a/core/mogo-core-res/src/main/res/values/dimens.xml
+++ b/core/mogo-core-res/src/main/res/values/dimens.xml
@@ -4,6 +4,10 @@
300px
60px
+ 104px
+ 104px
+ 40px
+
20px
110px
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/WorkThreadHandler.java b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/thread/WorkThreadHandler.java
similarity index 97%
rename from foudations/mogo-utils/src/main/java/com/mogo/utils/WorkThreadHandler.java
rename to core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/thread/WorkThreadHandler.java
index 64d967c261..bd1442c6be 100644
--- a/foudations/mogo-utils/src/main/java/com/mogo/utils/WorkThreadHandler.java
+++ b/core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/mogo/thread/WorkThreadHandler.java
@@ -1,4 +1,4 @@
-package com.mogo.utils;
+package com.mogo.eagle.core.utilcode.mogo.thread;
import android.os.Handler;
import android.os.HandlerThread;
diff --git a/foudations/mogo-utils/build.gradle b/foudations/mogo-utils/build.gradle
index c619e0f3ab..f7efc7fe2a 100644
--- a/foudations/mogo-utils/build.gradle
+++ b/foudations/mogo-utils/build.gradle
@@ -32,6 +32,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api rootProject.ext.dependencies.glide
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
+ implementation rootProject.ext.dependencies.coroutinescore
+ implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.glideanno
implementation rootProject.ext.dependencies.glideokhttp3
implementation rootProject.ext.dependencies.androidxannotation
@@ -43,6 +45,11 @@ dependencies {
api rootProject.ext.dependencies.mogoaicloudnetwork
api rootProject.ext.dependencies.mogoaicloudpassport
+ if (Boolean.valueOf(RELEASE)) {
+ implementation rootProject.ext.dependencies.mogo_core_data
+ } else {
+ implementation project(':core:mogo-core-data')
+ }
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/CoroutineDSL.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/CoroutineDSL.kt
similarity index 62%
rename from modules/mogo-module-chat/src/main/java/com/mogo/chat/net/CoroutineDSL.kt
rename to foudations/mogo-utils/src/main/java/com/mogo/utils/network/CoroutineDSL.kt
index 0ee5dcd7c3..bd3d643822 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/CoroutineDSL.kt
+++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/CoroutineDSL.kt
@@ -1,14 +1,15 @@
-package com.mogo.chat.net
+package com.mogo.utils.network
import androidx.lifecycle.LifecycleOwner
-import com.mogo.chat.exception.ApiException
-import com.mogo.chat.exception.ApiException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
-import com.mogo.chat.exception.CommonException.Companion.NETWORK_EXCEPTION
-import com.mogo.chat.exception.CommonException.Companion.NULL_EXCEPTION
-import com.mogo.chat.base.BaseResponse
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.utils.network.exception.ApiException
+import com.mogo.utils.network.exception.CommonException.Companion.NETWORK_EXCEPTION
+import com.mogo.utils.network.exception.CommonException.Companion.NULL_EXCEPTION
+import com.mogo.utils.network.exception.CommonException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
import kotlinx.coroutines.*
import java.net.SocketTimeoutException
import java.net.UnknownHostException
+import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.TimeoutException
class Request {
@@ -24,7 +25,6 @@ class Request {
private var addLifecycle: LifecycleOwner? = null
-
infix fun loader(loader: suspend () -> T) {
this.loader = loader
}
@@ -49,8 +49,9 @@ class Request {
this.addLifecycle = addLifecycle
}
- fun request() {
+ fun request(requestKey: String? = null) {
+ //todo list 缓存result ,在停止时关闭
GlobalScope.launch(context = Dispatchers.Main) {
start?.invoke()
@@ -58,9 +59,14 @@ class Request {
val deferred = GlobalScope.async(Dispatchers.IO, start = CoroutineStart.LAZY) {
loader()
}
+
+ requestKey?.let {
+ deferredMap[requestKey] = deferred as Deferred
+ }
+
val result = deferred.await()
if (result != null && result is BaseResponse<*>) {
- if (result.code == 0) {
+ if (result.code == 0 || result.code == 200) {
onSuccess?.invoke(result)
} else {
throw ApiException(result.code, result.msg)
@@ -81,12 +87,30 @@ class Request {
else -> onError?.invoke(java.lang.Exception(e.message))
}
} finally {
+ requestKey?.let {
+ if (deferredMap.contains(requestKey)) {
+ deferredMap.remove(requestKey)
+ }
+ }
onComplete?.invoke()
}
}
}
+
}
-inline fun request(buildRequest: Request.() -> Unit) {
- Request().apply(buildRequest).request()
+inline fun request(requestKey: String? = "", buildRequest: Request.() -> Unit) {
+ Request().apply(buildRequest).request(requestKey)
+}
+
+private val deferredMap = ConcurrentHashMap>()
+
+fun cancel(requestKey: String) {
+ if (deferredMap.contains(requestKey)) {
+ deferredMap[requestKey]!!.cancel(CancellationException("manual cancel !"))
+ }
+}
+
+suspend fun apiCall(call: suspend () -> BaseResponse): BaseResponse {
+ return call.invoke()
}
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/network/exception/ApiException.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/exception/ApiException.kt
new file mode 100644
index 0000000000..05ab7decfb
--- /dev/null
+++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/exception/ApiException.kt
@@ -0,0 +1,10 @@
+package com.mogo.utils.network.exception
+
+class ApiException : CommonException {
+
+ constructor(code: Int, msg: String) : super(code, msg)
+
+ fun getErrorMsg():String{
+ return msg
+ }
+}
\ No newline at end of file
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/network/exception/CommonException.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/exception/CommonException.kt
new file mode 100644
index 0000000000..0ee1a1e525
--- /dev/null
+++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/network/exception/CommonException.kt
@@ -0,0 +1,19 @@
+package com.mogo.utils.network.exception
+
+open class CommonException :Exception{
+
+ companion object{
+ val NETWORK_EXCEPTION = CommonException(1, "network is error")
+ val NULL_EXCEPTION = CommonException(1, "exception is null")
+ val NULL_REQUEST_DATA_API_EXCEPTION = CommonException(1, "request data is null")
+ }
+
+ protected var code: Int = 0
+ protected var msg: String = ""
+
+ constructor(code: Int, msg: String) : super(msg) {
+ this.code = code
+ this.msg = msg
+ }
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-authorize/build.gradle b/modules/mogo-module-authorize/build.gradle
index 43e24f4ae1..18784e1f09 100644
--- a/modules/mogo-module-authorize/build.gradle
+++ b/modules/mogo-module-authorize/build.gradle
@@ -59,12 +59,16 @@ dependencies {
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
+
+ implementation rootProject.ext.dependencies.mogo_core_utils
+ implementation rootProject.ext.dependencies.mogo_core_data
} else {
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
implementation project(':services:mogo-service-api')
implementation project(":modules:mogo-module-common")
+ implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-data')
}
}
diff --git a/modules/mogo-module-carchatting/src/main/AndroidManifest.xml b/modules/mogo-module-carchatting/src/main/AndroidManifest.xml
index 1641da03d7..b7799dd97e 100644
--- a/modules/mogo-module-carchatting/src/main/AndroidManifest.xml
+++ b/modules/mogo-module-carchatting/src/main/AndroidManifest.xml
@@ -1,14 +1,4 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatCenter.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatCenter.kt
index db5a88ac08..0d0bb4abe1 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatCenter.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatCenter.kt
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_SERVICE_APIS
import com.mogo.module.carchatting.R
import com.mogo.module.carchatting.bean.UserInfo
import com.mogo.module.carchatting.card.CallChatConstant.Companion.MODULE_NAME
+import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
import com.mogo.module.carchatting.util.*
import com.mogo.module.carchatting.view.CallingWindowManager.Companion.callingWindowManager
import com.mogo.module.carchatting.view.MapViewManager.Companion.mapViewManager
@@ -35,7 +36,6 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
IVoiceIntentListener {
companion object {
- const val TAG: String = "CallChatCenter"
val callChatCenter by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
CallChatCenter()
@@ -383,6 +383,7 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
private fun hideLauncherCallingView() {
callWindowHideCallBack()
callingWindowManager.hideCallingView()
+ callingWindowManager.hideIncomingView()
}
private fun callWindowShowCallBack() {
@@ -407,6 +408,7 @@ class CallChatCenter private constructor() : IBizCallChat.IBizCallBack, IVoiceCo
Logger.d(TAG, "answerCall")
taskMainLaunch {
callingWindowManager.hideIncomingView()
+ showLauncherCallingView()
}
}
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatManager.kt
index 5947485aa0..935fdb405e 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatManager.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/CallChatManager.kt
@@ -1,7 +1,6 @@
package com.mogo.module.carchatting.biz
import com.google.gson.Gson
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.callcenter.*
import com.mogo.chat.callcenter.CallController.Companion.callController
import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager
@@ -15,6 +14,7 @@ import com.mogo.chat.util.CallTimer.Companion.callTimer
import com.mogo.chat.util.UserInfoHelper.currentCallType
import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo
import com.mogo.chat.util.log
+import com.mogo.eagle.core.data.BaseResponse
import com.mogo.module.carchatting.R
import com.mogo.module.carchatting.bean.EnthusiasmIndex
import com.mogo.module.carchatting.bean.Result
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/Test.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/Test.kt
deleted file mode 100644
index 3bdc4f8dcb..0000000000
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/biz/Test.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.mogo.module.carchatting.biz
-
-import android.content.BroadcastReceiver
-import android.content.Context
-import android.content.Intent
-import com.mogo.module.carchatting.bean.UserInfo
-
-class Test:BroadcastReceiver() {
-
- override fun onReceive(context: Context?, intent: Intent?) {
- CallChatCenter.callChatCenter.showIncomingCall(UserInfo("123",123,"","","","","","","",""))
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/CoroutineDSL.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/CoroutineDSL.kt
index 942f10abbd..063f1c81f5 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/CoroutineDSL.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/CoroutineDSL.kt
@@ -1,11 +1,11 @@
package com.mogo.module.carchatting.net
import androidx.lifecycle.LifecycleOwner
-import com.mogo.chat.base.BaseResponse
-import com.mogo.chat.exception.ApiException
-import com.mogo.chat.exception.ApiException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
+import com.mogo.chat.exception.CallApiException
import com.mogo.chat.exception.CommonException.Companion.NETWORK_EXCEPTION
import com.mogo.chat.exception.CommonException.Companion.NULL_EXCEPTION
+import com.mogo.chat.exception.CommonException.Companion.NULL_REQUEST_DATA_API_EXCEPTION
+import com.mogo.eagle.core.data.BaseResponse
import kotlinx.coroutines.*
import java.net.SocketTimeoutException
import java.net.UnknownHostException
@@ -63,7 +63,7 @@ class Request {
if (result.code == 0) {
onSuccess?.invoke(result)
} else {
- throw ApiException(result.code, result.msg)
+ throw CallApiException(result.code, result.msg)
}
} else {
throw NULL_REQUEST_DATA_API_EXCEPTION
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpApi.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpApi.kt
index 8b09d70e94..eb5fae79af 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpApi.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/HttpApi.kt
@@ -1,7 +1,7 @@
package com.mogo.module.carchatting.net
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.model.bean.TeammateInfo
+import com.mogo.eagle.core.data.BaseResponse
import com.mogo.module.carchatting.bean.Result
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/Repository.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/Repository.kt
index 62cf2a49f4..44ef42d7d2 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/Repository.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/net/Repository.kt
@@ -1,7 +1,7 @@
package com.mogo.module.carchatting.net
import com.alibaba.android.arouter.launcher.ARouter
-import com.mogo.chat.base.BaseResponse
+import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.service.IMogoServiceApis
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/CallingWindowManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/CallingWindowManager.kt
index d2f28bd6f7..8021797f80 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/CallingWindowManager.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/CallingWindowManager.kt
@@ -21,7 +21,6 @@ import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.debug.DebugConfig.CAR_MACHINE_TYPE_BYD
import com.mogo.module.carchatting.R
import com.mogo.module.carchatting.bean.UserInfo
-import com.mogo.module.carchatting.biz.CallChatCenter
import com.mogo.module.carchatting.view.VrModeHelper.Companion.vrModeHelper
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.glide.SkinAbleBitmapTarget
@@ -94,7 +93,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
quitVehicleTeam: () -> Unit,
moveToCenter: () -> Unit
) {
- Logger.d(CallChatCenter.TAG, "CallingWindowManager init --->")
+ Logger.d(TAG, "CallingWindowManager init --->")
this.mContext = context
this.serviceApi = serviceApi
this.match = match
@@ -106,7 +105,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
}
private fun initView() {
- Logger.d(CallChatCenter.TAG, "CallingWindowManager initView --->")
+ Logger.d(TAG, "CallingWindowManager initView --->")
launcherCallingView = vrModeHelper.getCallingWindowLayoutView(mContext!!)
launcherCallingView?.setOnClickListener { }
launcherCallingView?.let { view ->
@@ -176,27 +175,27 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
fun showInitView() {
if (DebugConfig.getCarMachineType() != CAR_MACHINE_TYPE_BYD) {
- Logger.d(CallChatCenter.TAG, "showInitView Mogo车机不执行")
+ Logger.d(TAG, "showInitView Mogo车机不执行")
return
}
if (launcherCallingView == null) {
- Logger.d(CallChatCenter.TAG, "展示Launcher浮窗 showInitView")
+ Logger.d(TAG, "展示Launcher浮窗 showInitView")
initView()
showCallingWindow()
- Logger.d(CallChatCenter.TAG, "添加浮窗成功 showInitView")
+ Logger.d(TAG, "添加浮窗成功 showInitView")
}
}
fun showMatchingView() {
if (launcherCallingView == null) {
- Logger.d(CallChatCenter.TAG, "展示Launcher浮窗 showMatchingView")
+ Logger.d(TAG, "展示Launcher浮窗 showMatchingView")
initView()
matchView?.visibility = View.GONE
moduleCarchattingTeamRlView?.visibility = View.GONE
callingView?.visibility = View.GONE
matchingView?.visibility = View.VISIBLE
showCallingWindow()
- Logger.d(CallChatCenter.TAG, "添加浮窗成功 showMatchingView")
+ Logger.d(TAG, "添加浮窗成功 showMatchingView")
}
}
@@ -205,7 +204,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
hangUpIncomingBack: () -> Unit
) {
Logger.d(
- CallChatCenter.TAG,
+ TAG,
"展示Launcher来电浮窗 showIncomingView===$isLauncherCallingViewShown"
)
this.agreeIncomingBack = agreeIncomingBack
@@ -253,7 +252,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
params.topMargin = y.toInt()
serviceApi?.windowManagerApi?.addView(launcherIncomingView, params, true)
isLauncherIncomingViewShown = true
- Logger.d(CallChatCenter.TAG, "添加浮窗成功 addIncomingView===$isLauncherCallingViewShown")
+ Logger.d(TAG, "添加浮窗成功 addIncomingView===$isLauncherCallingViewShown")
}
}
@@ -261,14 +260,14 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
currentUserInfo: UserInfo?,
hangUpCallBack: () -> Unit
) {
- Logger.d(CallChatCenter.TAG, "展示Launcher浮窗 showCallingView===$isLauncherCallingViewShown")
+ Logger.d(TAG, "展示Launcher浮窗 showCallingView===$isLauncherCallingViewShown")
if (!isLauncherCallingViewShown) {
addCallWindowView(hangUpCallBack) {
refreshCallWindowData(currentUserInfo)
}
} else {
Logger.d(
- CallChatCenter.TAG,
+ TAG,
"刷新Launcher浮窗数据 showCallingView===currentUserInfo :$currentUserInfo"
)
refreshCallWindowData(currentUserInfo)
@@ -294,7 +293,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
showCallingWindow()
refreshData.invoke()
isLauncherCallingViewShown = true
- Logger.d(CallChatCenter.TAG, "添加浮窗成功 addCallWindowView===$isLauncherCallingViewShown")
+ Logger.d(TAG, "添加浮窗成功 addCallWindowView===$isLauncherCallingViewShown")
}
private fun refreshCallWindowData(currentUserInfo: UserInfo?) {
@@ -329,7 +328,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
if (!isLauncherIncomingViewShown) {
return
}
- Logger.d(CallChatCenter.TAG, "隐藏Launcher来电浮窗===$isLauncherCallingViewShown")
+ Logger.d(TAG, "隐藏Launcher来电浮窗===$isLauncherCallingViewShown")
releaseAudioAndVoice()
if (isLauncherIncomingViewShown) {
isLauncherIncomingViewShown = false
@@ -340,7 +339,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
}
fun hideCallingView() {
- Logger.d(CallChatCenter.TAG, "隐藏Launcher浮窗===$isLauncherCallingViewShown")
+ Logger.d(TAG, "隐藏Launcher浮窗===$isLauncherCallingViewShown")
if (isLauncherCallingViewShown) {
callingTimer?.text = null
callingNickName?.text = null
@@ -360,13 +359,13 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
}
fun updateTimer(timeStr: String) {
- Logger.d(CallChatCenter.TAG, "CallingWindowManager updateView===$timeStr")
+ Logger.d(TAG, "CallingWindowManager updateView===$timeStr")
callingTimer?.text = timeStr
}
fun showVehicleTeamView() {
Logger.d(
- CallChatCenter.TAG,
+ TAG,
"showVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown"
)
if (!isLauncherCallingViewShown) {
@@ -386,7 +385,7 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
fun hideVehicleTeamView() {
Logger.d(
- CallChatCenter.TAG,
+ TAG,
"hideVehicleTeamView isLauncherCallingViewShown ===$isLauncherCallingViewShown"
)
callingView?.visibility = View.GONE
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TeamInvitationWindowManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TeamInvitationWindowManager.kt
index 73f3f55e89..58d80d64d4 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TeamInvitationWindowManager.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/TeamInvitationWindowManager.kt
@@ -9,6 +9,7 @@ import com.mogo.module.carchatting.R
import com.mogo.module.carchatting.bean.UserInfo
import com.mogo.module.carchatting.biz.CallChatCenter
import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter
+import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
import com.mogo.module.carchatting.view.VrModeHelper.Companion.vrModeHelper
import com.mogo.module.carchatting.voice.IVoiceCommandListener
import com.mogo.module.carchatting.voice.VoiceUtil
@@ -89,7 +90,7 @@ class TeamInvitationWindowManager private constructor() {
try {
job = GlobalScope.launch(Dispatchers.Main) {
delay(1000 * 20)
- Logger.d(CallChatCenter.TAG, "refuseCall()--->executed")
+ Logger.d(TAG, "refuseCall()--->executed")
callChatCenter.refuseCall(userInfo!!.sn)
hideTeamInvitationView()
}
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserDialog.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserDialog.kt
index d2dc3e168e..f79d481a38 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserDialog.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserDialog.kt
@@ -11,7 +11,6 @@ import com.mogo.commons.AbsMogoApplication
import com.mogo.module.carchatting.R
import com.mogo.module.carchatting.bean.EnthusiasmIndex
import com.mogo.module.carchatting.bean.UserInfo
-import com.mogo.module.carchatting.biz.CallChatCenter
import com.mogo.module.carchatting.biz.CallChatCenter.Companion.callChatCenter
import com.mogo.module.carchatting.voice.IVoiceCommandListener
import com.mogo.module.carchatting.voice.VoiceUtil
@@ -52,7 +51,6 @@ class UserDialog : BaseFloatDialog {
constructor(mogoDriverInfo: MogoDriverInfo, context: Context) : super(context) {
driverInfo = mogoDriverInfo
- Logger.i(CallChatCenter.TAG, "构造函数赋值 driverInfo:$driverInfo")
initView()
}
@@ -83,12 +81,10 @@ class UserDialog : BaseFloatDialog {
if (moduleCallChatRatingBar!!.visibility == View.VISIBLE) {
moduleCallChatRatingBar!!.visibility = View.GONE
}
- Logger.i(CallChatCenter.TAG, "initView driverInfo sn === ${driverInfo?.sn}")
val sn = driverInfo?.sn
sn?.let {
if (it != MoGoAiCloudClientConfig.getInstance().sn) {
callChatCenter.updateUserCallStatus { status ->
- Logger.i(CallChatCenter.TAG, "刷新用户信息打电话状态=== $status")
if (status) {
moduleCallChatUserCaller?.visibility = View.VISIBLE
}
@@ -101,7 +97,6 @@ class UserDialog : BaseFloatDialog {
}
private fun refreshUserWindowData() {
- Logger.i(CallChatCenter.TAG, "refreshUserWindowData")
val options: RequestOptions =
RequestOptions().circleCrop()
.placeholder(R.mipmap.module_carchatting_default_head_img)
@@ -126,7 +121,6 @@ class UserDialog : BaseFloatDialog {
}
fun updateUserInfo(mogoDriverInfo: MogoDriverInfo?) {
- Logger.i(CallChatCenter.TAG, "updateUserInfo 赋值前 mogoDriverInfo: $mogoDriverInfo")
mogoDriverInfo?.let {
driverInfo?.let { driverInfo ->
if (driverInfo.userHead.isNullOrBlank()) {
@@ -137,7 +131,6 @@ class UserDialog : BaseFloatDialog {
}
}
}
- Logger.i(CallChatCenter.TAG, "updateUserInfo 赋值后 driverInfo : $driverInfo , 准备更新用户信息")
refreshUserWindowData()
}
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserWindowManager.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserWindowManager.kt
index ad5233429d..5526edc369 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserWindowManager.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/UserWindowManager.kt
@@ -3,6 +3,7 @@ package com.mogo.module.carchatting.view
import com.mogo.commons.context.ContextHolderUtil
import com.mogo.module.carchatting.bean.EnthusiasmIndex
import com.mogo.module.carchatting.biz.CallChatCenter
+import com.mogo.module.carchatting.card.CallChatConstant.Companion.TAG
import com.mogo.utils.logger.Logger
import com.zhidao.carchattingprovider.MogoDriverInfo
@@ -26,7 +27,7 @@ class UserWindowManager private constructor() {
mogoDriverInfo: MogoDriverInfo,
userWindowListener: ((Boolean) -> Unit)
) {
- Logger.d(CallChatCenter.TAG, "展示用户信息浮窗===mogoDriverInfo : $mogoDriverInfo")
+ Logger.d(TAG, "展示用户信息浮窗===mogoDriverInfo : $mogoDriverInfo")
this.userWindowListener = userWindowListener
val context = ContextHolderUtil.getContext()
context?.let {
@@ -34,22 +35,22 @@ class UserWindowManager private constructor() {
userDialog = UserDialog(mogoDriverInfo, it)
userDialog!!.show()
userDialog!!.setOnDismissListener {
- Logger.d(CallChatCenter.TAG, "主动隐藏用户信息浮窗===")
+ Logger.d(TAG, "主动隐藏用户信息浮窗===")
userDialog = null
this.userWindowListener?.invoke(false)
this.userWindowListener = null
}
this.userWindowListener?.invoke(true)
- Logger.d(CallChatCenter.TAG, "添加用户信息浮窗成功===")
+ Logger.d(TAG, "添加用户信息浮窗成功===")
} else {
- Logger.d(CallChatCenter.TAG, "刷新用户信息浮窗数据===mogoDriverInfo :$mogoDriverInfo")
+ Logger.d(TAG, "刷新用户信息浮窗数据===mogoDriverInfo :$mogoDriverInfo")
updateUserInfo(mogoDriverInfo)
}
}
}
fun updateUserEnthusiasmIndex(enthusiasmIndex: EnthusiasmIndex) {
- Logger.d(CallChatCenter.TAG, "刷新用户热心指数=== $enthusiasmIndex")
+ Logger.d(TAG, "刷新用户热心指数=== $enthusiasmIndex")
userDialog?.let {
if(it.isShowing){
userDialog?.updateUserEnthusiasmIndex(enthusiasmIndex)
@@ -58,7 +59,7 @@ class UserWindowManager private constructor() {
}
fun updateUserInfo(mogoDriverInfo: MogoDriverInfo) {
- Logger.d(CallChatCenter.TAG, "刷新用户信息=== $mogoDriverInfo")
+ Logger.d(TAG, "刷新用户信息=== $mogoDriverInfo")
userDialog?.let {
if(it.isShowing){
userDialog?.updateUserInfo(mogoDriverInfo)
@@ -67,7 +68,7 @@ class UserWindowManager private constructor() {
}
fun hideUserView() {
- Logger.d(CallChatCenter.TAG, "隐藏用户信息浮窗===")
+ Logger.d(TAG, "隐藏用户信息浮窗===")
userDialog?.dismiss()
userWindowListener?.invoke(false)
userWindowListener = null
diff --git a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamModel.kt b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamModel.kt
index dd4c1747a6..91aa1ea0fd 100644
--- a/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamModel.kt
+++ b/modules/mogo-module-carchatting/src/main/java/com/mogo/module/carchatting/view/VehicleTeamModel.kt
@@ -1,8 +1,8 @@
package com.mogo.module.carchatting.view
import com.google.gson.Gson
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.model.bean.TeammateInfo
+import com.mogo.eagle.core.data.BaseResponse
import com.mogo.module.carchatting.net.Repository
import com.mogo.module.carchatting.net.request
diff --git a/modules/mogo-module-chat/build.gradle b/modules/mogo-module-chat/build.gradle
index 3f23219e72..69264033e9 100644
--- a/modules/mogo-module-chat/build.gradle
+++ b/modules/mogo-module-chat/build.gradle
@@ -78,24 +78,19 @@ dependencies {
implementation rootProject.ext.dependencies.mogowebsocket
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
-
- implementation rootProject.ext.dependencies.mogomap
- implementation rootProject.ext.dependencies.mogoutils
- implementation rootProject.ext.dependencies.mogocommons
- implementation rootProject.ext.dependencies.mogoserviceapi
- implementation rootProject.ext.dependencies.modulecommon
-
- implementation rootProject.ext.dependencies.mogo_core_data
+ compileOnly rootProject.ext.dependencies.mogomap
+ compileOnly rootProject.ext.dependencies.mogoutils
+ compileOnly rootProject.ext.dependencies.mogoserviceapi
+ compileOnly rootProject.ext.dependencies.modulecommon
} else {
-
- implementation project(":libraries:mogo-map")
- implementation project(":foudations:mogo-utils")
- implementation project(":foudations:mogo-commons")
- implementation project(':services:mogo-service-api')
+ api project(":libraries:mogo-map")
+ api project(":foudations:mogo-utils")
+ api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
-
- implementation project(':core:mogo-core-data')
}
+ implementation project(':core:mogo-core-utils')
+ implementation project(':core:mogo-core-data')
}
+
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseController.kt
index 4712d13b6c..bdf676d454 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseController.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseController.kt
@@ -5,16 +5,17 @@ import com.mogo.chat.model.ChatServiceModel
import com.mogo.chat.model.bean.AllUnit
import com.mogo.chat.model.bean.LocationCarsWithRadius
import com.mogo.chat.model.bean.toSns
-import com.mogo.chat.net.request
import com.mogo.chat.util.UserInfoHelper
import com.mogo.chat.util.log
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.utils.network.request
open class BaseController {
val chatServiceModel: ChatServiceModel = ChatServiceModel()
fun getUserInfo(onSuccess: (() -> Unit)? = null, onError: ((Exception) -> Unit)? = null) {
- if (!UserInfoHelper.userInfo.sn.isBlank()) {
+ if (UserInfoHelper.userInfo.sn.isNotBlank()) {
log(TAG, "userInfo getSn : ${UserInfoHelper.userInfo}")
onSuccess?.invoke()
return
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseRepository.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseRepository.kt
index 74f167e4cc..fcd41ef1db 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseRepository.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseRepository.kt
@@ -13,6 +13,7 @@ import com.mogo.chat.util.UserInfoHelper.userInfo
import com.mogo.chat.util.log
import com.mogo.chat.util.sp.getRoomId
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
+import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.service.IMogoServiceApis
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseResponse.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseResponse.kt
deleted file mode 100644
index cdc6adb513..0000000000
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/base/BaseResponse.kt
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.mogo.chat.base
-
-import com.mogo.chat.constant.HttpConstants
-
-class BaseResponse(val code: Int, val msg: String, val result: T) {
-
- fun isSuccess(baseUrl: String): Boolean {
- return when (baseUrl) {
- HttpConstants.getBaseUrl() -> true
- else -> false
- }
- }
-}
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/ApiException.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/ApiException.kt
deleted file mode 100644
index 524e99d93e..0000000000
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/ApiException.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.mogo.chat.exception
-
-class ApiException : CommonException {
-
- companion object {
- val NULL_REQUEST_DATA_API_EXCEPTION = ApiException(2, "request data is null")
- val ENTER_ROOM_API_EXCEPTION = ApiException(3, "roomId is null or already enter room")
- }
-
- constructor(code: Int, msg: String) : super(code, msg)
-
- fun getErrorMsg():String{
- return msg
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CallApiException.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CallApiException.kt
new file mode 100644
index 0000000000..5a0fd605be
--- /dev/null
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CallApiException.kt
@@ -0,0 +1,15 @@
+package com.mogo.chat.exception
+
+class CallApiException : CommonException {
+
+ companion object {
+
+ val ENTER_ROOM_API_EXCEPTION = CallApiException(3, "roomId is null or already enter room")
+ }
+
+ constructor(code: Int, msg: String) : super(code, msg)
+
+ fun getErrorMsg():String{
+ return msg
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CommonException.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CommonException.kt
index ec09f347a4..3204b5f03e 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CommonException.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/exception/CommonException.kt
@@ -5,6 +5,7 @@ open class CommonException :Exception{
companion object{
val NETWORK_EXCEPTION = CommonException(1, "network is error")
val NULL_EXCEPTION = CommonException(1, "exception is null")
+ val NULL_REQUEST_DATA_API_EXCEPTION = CommonException(1, "request data is null")
}
protected var code: Int = 0
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/ChatServiceModel.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/ChatServiceModel.kt
index a58b36fb6a..6b903d7c90 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/ChatServiceModel.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/ChatServiceModel.kt
@@ -1,11 +1,11 @@
package com.mogo.chat.model
import com.mogo.chat.base.BaseRepository
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.constant.HttpConstants.Companion.getConfig
import com.mogo.chat.model.bean.OnLineStatus
import com.mogo.chat.model.bean.UserInfoBySns
import com.mogo.chat.model.bean.UserInfoBySnsRequest
+import com.mogo.eagle.core.data.BaseResponse
class ChatServiceModel : BaseRepository() {
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FocusModel.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FocusModel.kt
index 5b12e79c6e..5d81253d7a 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FocusModel.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FocusModel.kt
@@ -2,11 +2,11 @@ package com.mogo.chat.model
import com.google.gson.Gson
import com.mogo.chat.base.BaseRepository
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.model.bean.FocusBlackListRequest
import com.mogo.chat.model.bean.FocusData
import com.mogo.chat.model.bean.FriendRequest
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
+import com.mogo.eagle.core.data.BaseResponse
class FocusModel : BaseRepository() {
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FriendModel.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FriendModel.kt
index a8266c4078..77e4c8e7f0 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FriendModel.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/FriendModel.kt
@@ -2,11 +2,11 @@ package com.mogo.chat.model
import com.google.gson.Gson
import com.mogo.chat.base.BaseRepository
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.model.bean.FriendData
import com.mogo.chat.model.bean.FriendOrSelfOnLine
import com.mogo.chat.model.bean.FriendRequest
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
+import com.mogo.eagle.core.data.BaseResponse
class FriendModel : BaseRepository() {
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/OnLineStatus.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/OnLineStatus.kt
index f81d4fb40a..e8ece98a32 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/OnLineStatus.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/bean/OnLineStatus.kt
@@ -1,8 +1,5 @@
package com.mogo.chat.model.bean
-fun OnLineStatus.onLine(): Boolean {
- return carOnLine == 1 && onLine == 1
-}
/**
* carOnLine:ACC ON状态 1:在线 2:不在线
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/ChatController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/ChatController.kt
index 19faa1638d..95d2f16490 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/ChatController.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/ChatController.kt
@@ -2,7 +2,6 @@ package com.mogo.chat.model.control
import com.mogo.chat.R
import com.mogo.chat.base.BaseController
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.callcenter.CallController.Companion.callController
import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager
import com.mogo.chat.callcenter.exchangeToCallType
@@ -12,9 +11,8 @@ import com.mogo.chat.constant.CALL_TYPE_VOICE
import com.mogo.chat.constant.PUSH_MSG_DENY_ENTER
import com.mogo.chat.constant.PUSH_MSG_HANG_UP
import com.mogo.chat.constant.TAG
-import com.mogo.chat.exception.ApiException.Companion.ENTER_ROOM_API_EXCEPTION
+import com.mogo.chat.exception.CallApiException.Companion.ENTER_ROOM_API_EXCEPTION
import com.mogo.chat.model.bean.RoomInfo
-import com.mogo.chat.net.request
import com.mogo.chat.util.CallTimer.Companion.callTimer
import com.mogo.chat.util.MediaController
import com.mogo.chat.util.UserInfoHelper
@@ -23,6 +21,8 @@ import com.mogo.chat.util.log
import com.mogo.chat.util.sp.saveRoomId
import com.mogo.chat.util.trackCall
import com.mogo.commons.AbsMogoApplication
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.utils.network.request
object ChatController : BaseController(), IGMEEventCallBack {
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/MatchController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/MatchController.kt
index 4499e004c7..2a952bdb80 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/MatchController.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/MatchController.kt
@@ -3,18 +3,18 @@ package com.mogo.chat.model.control
import com.mogo.chat.R
import com.mogo.chat.aspect.DebugLog
import com.mogo.chat.base.BaseController
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager
import com.mogo.chat.callcenter.IMType
import com.mogo.chat.callcenter.canMatchTimeout
import com.mogo.chat.constant.TAG
import com.mogo.chat.model.bean.MatchRequestParam
-import com.mogo.chat.net.request
import com.mogo.chat.net.taskDelayAsync
import com.mogo.chat.provider.ServiceApi
import com.mogo.chat.util.*
import com.mogo.chat.util.audio.AudioFocusUtil
import com.mogo.commons.AbsMogoApplication
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.utils.network.request
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.withContext
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/VehicleTeamController.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/VehicleTeamController.kt
index b367e9000e..af7139271d 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/VehicleTeamController.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/model/control/VehicleTeamController.kt
@@ -1,20 +1,19 @@
package com.mogo.chat.model.control
import com.mogo.chat.base.BaseController
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.common.gme.IGMEEventCallBack
import com.mogo.chat.constant.CALL_TYPE_VEHICLE_TEAM
import com.mogo.chat.constant.PUSH_MSG_DENY_ENTER
import com.mogo.chat.constant.PUSH_MSG_HANG_UP
import com.mogo.chat.constant.TAG
import com.mogo.chat.model.bean.CallRequestParam
-import com.mogo.chat.net.request
import com.mogo.chat.provider.ServiceApi
import com.mogo.chat.util.UserInfoHelper
import com.mogo.chat.util.log
import com.mogo.chat.util.sp.getRoomId
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
-import com.mogo.commons.network.Utils
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.utils.network.request
object VehicleTeamController : BaseController(), IGMEEventCallBack {
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/HttpApi.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/HttpApi.kt
index 37e772f232..cd17ba6d4a 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/HttpApi.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/net/HttpApi.kt
@@ -1,7 +1,7 @@
package com.mogo.chat.net
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.model.bean.*
+import com.mogo.eagle.core.data.BaseResponse
import retrofit2.http.*
interface HttpApi {
diff --git a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/ChatServiceHandler.kt b/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/ChatServiceHandler.kt
index 3e2b3515fb..8732628ddf 100644
--- a/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/ChatServiceHandler.kt
+++ b/modules/mogo-module-chat/src/main/java/com/mogo/chat/service/ChatServiceHandler.kt
@@ -2,7 +2,6 @@ package com.mogo.chat.service
import com.google.gson.Gson
import com.mogo.chat.base.BaseController
-import com.mogo.chat.base.BaseResponse
import com.mogo.chat.callcenter.CallTypeManager.Companion.callTypeManager
import com.mogo.chat.callcenter.exchangeToCallType
import com.mogo.chat.callcenter.isCalling
@@ -12,11 +11,9 @@ import com.mogo.chat.constant.*
import com.mogo.chat.model.bean.FocusStatus
import com.mogo.chat.model.bean.OnLineStatus
import com.mogo.chat.model.bean.UserInfoBySns
-import com.mogo.chat.model.bean.onLine
import com.mogo.chat.model.control.ChatController
import com.mogo.chat.model.control.MatchController
import com.mogo.chat.model.control.VehicleTeamController
-import com.mogo.chat.net.request
import com.mogo.chat.service.InvokeDataProxy.Companion.covertMapToSns
import com.mogo.chat.util.UserInfoHelper.currentCallType
import com.mogo.chat.util.UserInfoHelper.tmpSenderInfo
@@ -24,13 +21,15 @@ import com.mogo.chat.util.log
import com.mogo.chat.util.sp.setCarOnLineStatus
import com.mogo.chat.util.trackHangUp
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
+import com.mogo.eagle.core.data.BaseResponse
+import com.mogo.utils.network.request
object ChatServiceHandler : BaseController() {
fun call(
- snReceiver: String,
- onSuccess: (() -> Unit),
- onError: ((Exception) -> Unit)
+ snReceiver: String,
+ onSuccess: (() -> Unit),
+ onError: ((Exception) -> Unit)
) {
queryUserInfo(snReceiver, {
val map = Gson().fromJson