This commit is contained in:
zhongchao
2021-11-05 23:02:54 +08:00
parent 6c094debd8
commit 88170bb515
93 changed files with 1439 additions and 325 deletions

7
.idea/misc.xml generated
View File

@@ -16,6 +16,12 @@
<entry key="OCH/mogo-och-bus/src/main/res/layout/fragment_och_bus.xml" value="0.1010068539349746" />
<entry key="OCH/mogo-och/src/main/res/drawable/module_mogo_och_autopilot_status_bg.xml" value="0.19479166666666667" />
<entry key="OCH/mogo-och/src/main/res/layout/module_mogo_och_base_fragment.xml" value="0.1953125" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml" value="1.0729233277594363" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/notification_v2x_msg_vr.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_autopilot_status.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_check_status.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_traffic_light_vr.xml" value="0.18996305418719212" />
<entry key="core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_vip_identification.xml" value="0.45" />
<entry key="modules/mogo-module-authorize/src/main/res/layout/module_authorize_fragment.xml" value="0.273046875" />
<entry key="modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_calling_bg.xml" value="0.231875" />
<entry key="modules/mogo-module-carchatting/src/main/res/drawable/module_carchatting_vr_incoming_bg.xml" value="0.231875" />
@@ -64,6 +70,7 @@
<entry key="modules/mogo-module-service/src/main/res/layout/module_dialog_adas_dispatch_remind.xml" value="0.35734252929687504" />
<entry key="modules/mogo-module-service/src/main/res/layout/module_services_fragment_online_car_panel.xml" value="0.28919677734374993" />
<entry key="modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml" value="0.3338541666666667" />
<entry key="modules/mogo-module-v2x/src/main/res/layout/item_v2x_fatigue_driving.xml" value="0.11791871921182266" />
<entry key="modules/mogo-module-widgets/src/main/res/layout/module_widgets_app_entrance.xml" value="0.2838541666666667" />
</map>
</option>

View File

@@ -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"));
// 推送模块

View File

@@ -373,4 +373,8 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
override fun onDestroy() {
super.onDestroy()
}
override fun vipIdentification(visible: Boolean) {
flVipIdentificationView.visibility = if (visible) View.VISIBLE else View.GONE
}
}

View File

@@ -133,5 +133,10 @@ interface MoGoWarningContract {
* @param normalData
*/
fun showNoticeNormal(normalData: NoticeNormalData)
/**
* 展示VIP标识
*/
fun vipIdentification(visible: Boolean)
}
}

View File

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

View File

@@ -120,6 +120,10 @@ class MoGoWarningProvider : IMoGoWaringProvider {
}
}
override fun vipIdentification(visible: Boolean) {
mMoGoHmiFragment?.vipIdentification(visible)
}
override fun onDestroy() {
Log.d(TAG, "onDestroy")
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -24,6 +24,14 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.widget.VipIdentificationView
android:id="@+id/flVipIdentificationView"
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:layout_marginLeft="@dimen/module_vip_margin_left"
app:layout_constraintLeft_toRightOf="@+id/flSpeedChartView"
app:layout_constraintTop_toTopOf="@+id/flSpeedChartView" />
<com.mogo.eagle.core.function.hmi.ui.widget.AutoPilotStatusView
android:id="@+id/viewAutopilotStatus"
android:layout_width="@dimen/module_mogo_autopilot_status_bg_width"

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/clVipIdentification"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivVipIdentification"
android:layout_width="@dimen/dp_104"
android:layout_height="@dimen/dp_104"
android:scaleType="fitXY"
android:src="@drawable/v2x_vip_identification_vr"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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<String, String>): BaseResponse<RoadIDResult>
//获取前方红绿灯状态
@FormUrlEncoded
@POST("mec-etl-server/light//bgd/channel/realTime")
suspend fun getTrafficLight(@FieldMap status: Map<String, String>): BaseResponse<TrafficLightResult>
//变灯
@FormUrlEncoded
@POST("mec-etl-server/light/bdg/newTask")
suspend fun changeLight(@FieldMap turnLight: Map<String, String>): BaseResponse<Any>
}

View File

@@ -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<BaseResponse<RoadIDResult>>("requestRoadID") {
val map = hashMapOf<String, String>()
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<BaseResponse<TrafficLightResult>>("requestTrafficLight") {
val map = hashMapOf<String, String>()
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<BaseResponse<Any>> {
val map = hashMapOf<String, String>()
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!!)
}
}
}
}
}

View File

@@ -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<VipMessage>, 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<VipMessage> {
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
}
}
}

View File

@@ -0,0 +1,5 @@
package com.mogo.eagle.core.data
class BaseResponse<out T>(val code: Int, val msg: String, val result: T) {
}

View File

@@ -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";
/**
* 前方碰撞预警 未碰撞
*/

View File

@@ -0,0 +1,6 @@
package com.mogo.eagle.core.data.trafficlight
//驶入路口需要经过路段
class BaseLaneInfoList(val tileId: Int, val roadId: String, val laneNo: Int) {
}

View File

@@ -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? = "" //保留字段,暂时没用
) {
}

View File

@@ -0,0 +1,5 @@
package com.mogo.eagle.core.data.trafficlight
//获取路口ID请求数据
class RoadIDRequestData(val tileId: Long, val lat: Double, val lon: Double) {
}

View File

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

View File

@@ -0,0 +1,12 @@
package com.mogo.eagle.core.data.trafficlight
/**
* 具体灯态信息
*/
class TrafficLightDetail(
val left: TrafficLightStatus, //左灯
val mid: TrafficLightStatus, //中间灯
val right: TrafficLightStatus //右灯
) {
}

View File

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

View File

@@ -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 //灯态具体信息
) {
}

View File

@@ -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黄-YB-黑
val remain: Int //倒计时-秒
) {
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -174,4 +174,12 @@ object CallerHmiManager : CallerBase() {
fun showNormalBanner(noticeNormal: NoticeNormalData) {
waringProviderApi.showNoticeNormalData(noticeNormal)
}
/**
* 展示VIP标识
*/
fun vipIdentification(visible: Boolean){
waringProviderApi.vipIdentification(visible)
}
}

View File

@@ -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<String, IMoGoTrafficLightListener> =
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
}
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -4,6 +4,10 @@
<dimen name="module_ext_speed_height">460px</dimen>
<dimen name="module_ext_speed_padding">70px</dimen>
<dimen name="module_vip_width">104px</dimen>
<dimen name="module_vip_height">104px</dimen>
<dimen name="module_vip_margin_left">40px</dimen>
<dimen name="module_ext_speed_width_sm_radius">30px</dimen>
<dimen name="module_ext_speed_width_big_radius">130px</dimen>

View File

@@ -4,6 +4,10 @@
<dimen name="module_ext_speed_height">300px</dimen>
<dimen name="module_ext_speed_padding">60px</dimen>
<dimen name="module_vip_width">104px</dimen>
<dimen name="module_vip_height">104px</dimen>
<dimen name="module_vip_margin_left">40px</dimen>
<dimen name="module_ext_speed_width_sm_radius">20px</dimen>
<dimen name="module_ext_speed_width_big_radius">110px</dimen>

View File

@@ -1,4 +1,4 @@
package com.mogo.utils;
package com.mogo.eagle.core.utilcode.mogo.thread;
import android.os.Handler;
import android.os.HandlerThread;

View File

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

View File

@@ -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<T> {
@@ -24,7 +25,6 @@ class Request<T> {
private var addLifecycle: LifecycleOwner? = null
infix fun loader(loader: suspend () -> T) {
this.loader = loader
}
@@ -49,8 +49,9 @@ class Request<T> {
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<T> {
val deferred = GlobalScope.async(Dispatchers.IO, start = CoroutineStart.LAZY) {
loader()
}
requestKey?.let {
deferredMap[requestKey] = deferred as Deferred<Any>
}
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<T> {
else -> onError?.invoke(java.lang.Exception(e.message))
}
} finally {
requestKey?.let {
if (deferredMap.contains(requestKey)) {
deferredMap.remove(requestKey)
}
}
onComplete?.invoke()
}
}
}
}
inline fun <T> request(buildRequest: Request<T>.() -> Unit) {
Request<T>().apply(buildRequest).request()
inline fun <T> request(requestKey: String? = "", buildRequest: Request<T>.() -> Unit) {
Request<T>().apply(buildRequest).request(requestKey)
}
private val deferredMap = ConcurrentHashMap<String, Deferred<Any>>()
fun cancel(requestKey: String) {
if (deferredMap.contains(requestKey)) {
deferredMap[requestKey]!!.cancel(CancellationException("manual cancel !"))
}
}
suspend fun <T : Any> apiCall(call: suspend () -> BaseResponse<T>): BaseResponse<T> {
return call.invoke()
}

View File

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

View File

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

View File

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

View File

@@ -1,14 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.carchatting" >
<application>
<!--这里是为了测试增加的广播-->
<receiver android:name=".biz.Test">
<intent-filter>
<action android:name="com.callchat" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

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

View File

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

View File

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

View File

@@ -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<T> {
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,13 +0,0 @@
package com.mogo.chat.base
import com.mogo.chat.constant.HttpConstants
class BaseResponse<out T>(val code: Int, val msg: String, val result: T) {
fun isSuccess(baseUrl: String): Boolean {
return when (baseUrl) {
HttpConstants.getBaseUrl() -> true
else -> false
}
}
}

View File

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

View File

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

View File

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

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -1,8 +1,5 @@
package com.mogo.chat.model.bean
fun OnLineStatus.onLine(): Boolean {
return carOnLine == 1 && onLine == 1
}
/**
* carOnLineACC ON状态 1:在线 2:不在线

View File

@@ -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 {

View File

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

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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<Map<String, String>>(it, Map::class.java)
@@ -47,9 +46,9 @@ object ChatServiceHandler : BaseController() {
}
private fun realCall(
snReceiver: String,
onSuccess: (() -> Unit),
onError: ((Exception) -> Unit)
snReceiver: String,
onSuccess: (() -> Unit),
onError: ((Exception) -> Unit)
) {
ChatController.call(snReceiver, 0, {
onSuccess.invoke()
@@ -63,7 +62,12 @@ object ChatServiceHandler : BaseController() {
realHangUp(onSuccess, onError, roomId)
}
fun refuseCall(sn: String?, onSuccess: () -> Unit, onError: (Exception) -> Unit, roomId: Int = -1) {
fun refuseCall(
sn: String?,
onSuccess: () -> Unit,
onError: (Exception) -> Unit,
roomId: Int = -1
) {
var hangUpSn: String? = sn
if (hangUpSn.isNullOrBlank()) {
if (tmpSenderInfo.sn.isBlank()) {
@@ -80,53 +84,92 @@ object ChatServiceHandler : BaseController() {
currentCallType == CALL_TYPE_VEHICLE_TEAM -> {
trackHangUp(CALL_TYPE_VEHICLE_TEAM, "2")
log(TAG, "hangUp VehicleTeam")
VehicleTeamController.requestVehicleTeamConnectStatus(MoGoAiCloudClientConfig.getInstance().sn, PUSH_MSG_HANG_UP, CALL_TYPE_VEHICLE_TEAM, onSuccess, onError)
VehicleTeamController.requestVehicleTeamConnectStatus(
MoGoAiCloudClientConfig.getInstance().sn,
PUSH_MSG_HANG_UP,
CALL_TYPE_VEHICLE_TEAM,
onSuccess,
onError
)
}
GMEApi.isRoomEntered() || callTypeManager.callStatus.isCalling() -> {
trackHangUp(callTypeManager.callStatus.exchangeToCallType(), "2")
log(TAG, "hangUp Call")
ChatController.requestConnectStatus(tmpSenderInfo.sn, PUSH_MSG_HANG_UP, onSuccess, onError, roomId)
ChatController.requestConnectStatus(
tmpSenderInfo.sn,
PUSH_MSG_HANG_UP,
onSuccess,
onError,
roomId
)
}
else -> {
log(TAG, "realHangUp " +
"currentCallStatus : ${callTypeManager.callStatus} + " +
"currentCallType : $currentCallType")
log(
TAG, "realHangUp " +
"currentCallStatus : ${callTypeManager.callStatus} + " +
"currentCallType : $currentCallType"
)
}
}
}
private fun realRefuse(sn: String, onSuccess: () -> Unit, onError: (Exception) -> Unit, roomId: Int = -1) {
private fun realRefuse(
sn: String,
onSuccess: () -> Unit,
onError: (Exception) -> Unit,
roomId: Int = -1
) {
log(TAG, "realRefuse currentCallType : $currentCallType ")
when {
currentCallType == CALL_TYPE_VEHICLE_TEAM -> {
log(TAG, "refuse VehicleTeam")
VehicleTeamController.requestVehicleTeamConnectStatus(sn, PUSH_MSG_DENY_ENTER, CALL_TYPE_VEHICLE_TEAM, onSuccess, onError)
VehicleTeamController.requestVehicleTeamConnectStatus(
sn,
PUSH_MSG_DENY_ENTER,
CALL_TYPE_VEHICLE_TEAM,
onSuccess,
onError
)
}
callTypeManager.callStatus.isReadyCalling() -> {
log(TAG, "refuse call")
ChatController.requestConnectStatus(sn, PUSH_MSG_DENY_ENTER, onSuccess, onError, roomId)
ChatController.requestConnectStatus(
sn,
PUSH_MSG_DENY_ENTER,
onSuccess,
onError,
roomId
)
}
else -> {
log(TAG, "realRefuse " +
"currentCallStatus : ${callTypeManager.callStatus} + " +
"currentCallType : $currentCallType")
log(
TAG, "realRefuse " +
"currentCallStatus : ${callTypeManager.callStatus} + " +
"currentCallType : $currentCallType"
)
}
}
}
fun answer(
sn: String,
roomId: Int,
onSuccess: (() -> Unit)? = null,
onError: ((Exception) -> Unit)? = null
sn: String,
roomId: Int,
onSuccess: (() -> Unit)? = null,
onError: ((Exception) -> Unit)? = null
) {
log(TAG, "answer currentCallType ==== $currentCallType")
getUserInfo({
when (currentCallType) {
CALL_TYPE_VEHICLE_TEAM -> {
VehicleTeamController.requestVehicleTeamConnectStatus(sn, PUSH_MSG_AGREE_ENTER, CALL_TYPE_VEHICLE_TEAM, {
onSuccess?.invoke()
}, onError)
VehicleTeamController.requestVehicleTeamConnectStatus(
sn,
PUSH_MSG_AGREE_ENTER,
CALL_TYPE_VEHICLE_TEAM,
{
onSuccess?.invoke()
},
onError
)
}
else -> {
ChatController.requestConnectStatus(sn, PUSH_MSG_AGREE_ENTER, {
@@ -141,10 +184,10 @@ object ChatServiceHandler : BaseController() {
}
fun startMatch(
flag: String,
onSuccess: () -> Unit,
onError: (Exception) -> Unit,
timeOut: () -> Unit
flag: String,
onSuccess: () -> Unit,
onError: (Exception) -> Unit,
timeOut: () -> Unit
) {
getUserInfo({
MatchController.startMatch(flag, onSuccess, onError, timeOut)
@@ -157,7 +200,11 @@ object ChatServiceHandler : BaseController() {
MatchController.cancelMatch(onSuccess)
}
fun inviteJoinVehicleTeam(invitedSn: String, onSuccess: () -> Unit, onError: (Exception) -> Unit) {
fun inviteJoinVehicleTeam(
invitedSn: String,
onSuccess: () -> Unit,
onError: (Exception) -> Unit
) {
VehicleTeamController.inviteJoinVehicleTeam(invitedSn, onSuccess, onError)
}
@@ -212,7 +259,7 @@ object ChatServiceHandler : BaseController() {
onSuccess {
val onLineStatus = it.result
log(TAG, "onLineStatus : $onLineStatus")
onSuccess.invoke(onLineStatus.onLine())
onSuccess.invoke(onLineStatus.carOnLine == 1 && onLineStatus.onLine == 1)
}
onError {
onError.invoke(it)
@@ -221,9 +268,9 @@ object ChatServiceHandler : BaseController() {
}
fun queryUserInfo(
sn: String,
onSuccess: (userInfo: String) -> Unit,
onError: (Exception) -> Unit
sn: String,
onSuccess: (userInfo: String) -> Unit,
onError: (Exception) -> Unit
) {
request<BaseResponse<UserInfoBySns>> {
loader {

View File

@@ -76,7 +76,8 @@ dependencies {
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.callchatprovider
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
} else {
@@ -87,6 +88,7 @@ dependencies {
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-carchattingprovider')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
}

View File

@@ -14,13 +14,13 @@ import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
import com.mogo.module.common.drawer.bean.SpeedData;
import com.mogo.utils.WorkThreadHandler;
import java.util.Collection;
import java.util.Iterator;

View File

@@ -4,16 +4,15 @@ import android.view.animation.LinearInterpolator;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.marker.RoadConditionInfoWindow3DAdapter;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import java.util.List;

View File

@@ -11,7 +11,7 @@ import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.constants.DataTypes
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.utils.WorkThreadHandler
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
import com.mogo.utils.logger.Logger
import java.util.concurrent.ConcurrentHashMap

View File

@@ -18,12 +18,16 @@ enum class EventTypeEnum(
GAS_STATION("10001", "加油站", content = "加油站附近", tts = "加油站"),
//交通检查
TRAFFIC_CHECK("10002", "交通检查", "前方交通检查",
R.drawable.v2x_icon_jiaotongjiancha_vr, "前方交通检查", "交通检查"),
TRAFFIC_CHECK(
"10002", "交通检查", "前方交通检查",
R.drawable.v2x_icon_jiaotongjiancha_vr, "前方交通检查", "交通检查"
),
//封路
ROAD_CLOSED("10003", "封路", "前方封路", R.drawable.v2x_icon_fenglu_vr,
"前方封路", "道路封路"),
ROAD_CLOSED(
"10003", "封路", "前方封路", R.drawable.v2x_icon_fenglu_vr,
"前方封路", "道路封路"
),
//商场打折
SHOP_DISCOUNT("10004", ""),
@@ -32,23 +36,31 @@ enum class EventTypeEnum(
FOURS_4S("10005", ""),
//施工
FOURS_ROAD_WORK("10006", "道路施工", "前方施工", R.drawable.v2x_icon_daolushigong_vr,
"前方施工", "道路施工"),
FOURS_ROAD_WORK(
"10006", "道路施工", "前方施工", R.drawable.v2x_icon_daolushigong_vr,
"前方施工", "道路施工"
),
//拥堵
FOURS_BLOCK_UP("10007", "道路拥堵", "前方拥堵", R.drawable.v2x_icon_yongdu_vr,
"前方道路拥堵", "道路拥堵"),
FOURS_BLOCK_UP(
"10007", "道路拥堵", "前方拥堵", R.drawable.v2x_icon_yongdu_vr,
"前方道路拥堵", "道路拥堵"
),
//积水
FOURS_PONDING("10008", "道路积水", "前方道路积水", R.drawable.v2x_icon_jishui_vr,
"前方道路积水", "道路积水"),
FOURS_PONDING(
"10008", "道路积水", "前方道路积水", R.drawable.v2x_icon_jishui_vr,
"前方道路积水", "道路积水"
),
//超市打折
FOURS_SHOP_FREE("10009", ""),
//浓雾
FOURS_FOG("10010", "出现浓雾", "浓雾预警", R.drawable.v2x_icon_nongwu_vr,
"前方出现浓雾", "出现浓雾"),
FOURS_FOG(
"10010", "出现浓雾", "浓雾预警", R.drawable.v2x_icon_nongwu_vr,
"前方出现浓雾", "出现浓雾"
),
//结冰
FOURS_ICE("10011", "路面结冰", content = "前方路面结冰", tts = "路面结冰"),
@@ -57,28 +69,40 @@ enum class EventTypeEnum(
FOURS_PARKING("10012", "停车场", content = "停车场附近", tts = "停车场"),
//事故
FOURS_ACCIDENT("10013", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"),
FOURS_ACCIDENT(
"10013", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//重大事故
FOURS_ACCIDENT_01("1001301", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"),
FOURS_ACCIDENT_01(
"1001301", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//特大事故
FOURS_ACCIDENT_02("1001302", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"),
FOURS_ACCIDENT_02(
"1001302", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//较大事故
FOURS_ACCIDENT_03("1001303", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"),
FOURS_ACCIDENT_03(
"1001303", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//一般事故
FOURS_ACCIDENT_04("1001304", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"),
FOURS_ACCIDENT_04(
"1001304", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//轻微事故
FOURS_ACCIDENT_05("1001305", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"),
FOURS_ACCIDENT_05(
"1001305", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//身边
FOURS_NEALY("10014", "身边事件"),
@@ -123,220 +147,222 @@ enum class EventTypeEnum(
TYPE_USECASE_ID_EBW(
ObuConstants.USE_CASE_ID.EBW.toString(),
"紧急制动预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_emergency_brake,
content="前车急刹车",
poiTypeSrcVr = R.drawable.icon_warning_v2x_emergency_brake,
content = "前车急刹车",
tts = "前车急刹车"
),
TYPE_USECASE_ID_FCW(
ObuConstants.USE_CASE_ID.FCW.toString(),
"前向碰撞预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_collision_warning,
content="前车碰撞预警",
tts="小心前车"
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "前车碰撞预警",
tts = "小心前车"
),
TYPE_USECASE_ID_ICW(
ObuConstants.USE_CASE_ID.ICW.toString(),
"交叉路口碰撞预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_collision_warning,
content="交叉路口碰撞预警",
tts="注意交叉路口车辆"
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "交叉路口碰撞预警",
tts = "注意交叉路口车辆"
),
TYPE_USECASE_ID_CLW(
ObuConstants.USE_CASE_ID.CLW.toString(),
"车辆失控预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_vehicle_control,
content="前%s失控预警",
tts="小心%s失控车辆"
poiTypeSrcVr = R.drawable.icon_warning_v2x_vehicle_control,
content = "前%s失控预警",
tts = "小心%s失控车辆"
),
TYPE_USECASE_ID_DNPW(
ObuConstants.USE_CASE_ID.DNPW.toString(),
"逆向超车预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_reverse_overtaking,
content="逆向超车预警",
tts="注意对向来车"
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
content = "逆向超车预警",
tts = "注意对向来车"
),
TYPE_USECASE_ID_AVW(
ObuConstants.USE_CASE_ID.AVW.toString(),
"异常车辆提醒",
poiTypeSrcVr=R.drawable.icon_warning_v2x_abnormal_vehicle,
content="%s车异常",
tts="小心%s异常车辆"
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
content = "%s车异常",
tts = "小心%s异常车辆"
),
TYPE_USECASE_ID_BSW(
ObuConstants.USE_CASE_ID.BSW.toString(),
"盲区预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_blind_area_collision,
content="%s后盲区预警",
tts="注意%s后车辆"
poiTypeSrcVr = R.drawable.icon_warning_v2x_blind_area_collision,
content = "%s后盲区预警",
tts = "注意%s后车辆"
),
TYPE_USECASE_ID_LCW(
ObuConstants.USE_CASE_ID.LCW.toString(),
"变道预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_reverse_overtaking,
content="%s向变道预警",
tts="注意%s后车辆"
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
content = "%s向变道预警",
tts = "注意%s后车辆"
),//注意左后车辆/注意右后车辆
TYPE_USECASE_ID_EVW(
ObuConstants.USE_CASE_ID.EVW.toString(),
"紧急车辆提醒",
poiTypeSrcVr=R.drawable.icon_warning_v2x_special_vehicle_access,
content="注意特种车辆通行",
tts="请避让特种车辆"
poiTypeSrcVr = R.drawable.icon_warning_v2x_special_vehicle_access,
content = "注意特种车辆通行",
tts = "请避让特种车辆"
),
TYPE_USECASE_ID_VRUCW_PERSON(
0X2B0201.toString(),
"弱势交通参与者碰撞预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_pedestrian_crossing,
content="注意行人",
tts="注意行人"
poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing,
content = "注意行人",
tts = "注意行人"
),//行人/摩托车碰撞预警
TYPE_USECASE_ID_VRUCW_MOTORBIKE(
0X2B0202.toString(),
"弱势交通参与者碰撞预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_motorcycle_collision,
content="注意摩托车",
tts="注意摩托车"
poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision,
content = "注意摩托车",
tts = "注意摩托车"
),//摩托车碰撞预警
TYPE_USECASE_ID_SLW(
ObuConstants.USE_CASE_ID.SLW.toString(),
"限速预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_over_speed,
content="已超速",
tts="已超速"
poiTypeSrcVr = R.drawable.icon_warning_v2x_over_speed,
content = "已超速",
tts = "已超速"
),
TYPE_USECASE_ID_LTA(
ObuConstants.USE_CASE_ID.LTA.toString(),
"左转辅助",
poiTypeSrcVr=R.drawable.icon_warning_v2x_collision_warning,
content="左转碰撞预警",
tts="注意路口对向来车"
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "左转碰撞预警",
tts = "注意路口对向来车"
),
TYPE_USECASE_ID_HLW(
ObuConstants.USE_CASE_ID.HLW.toString(),
"道路危险情况预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_road_dangerous,
content="道路危险情况预警",
tts="前方路况危险,小心行驶"
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_dangerous,
content = "道路危险情况预警",
tts = "前方路况危险,小心行驶"
),//(如果能给出具体的类别,则播报具体危险类别)
TYPE_USECASE_ID_IVS(
ObuConstants.USE_CASE_ID.IVS.toString(),
"车内标牌",
poiTypeSrcVr=R.drawable.icon_warning_v2x_road_construction,
content="车内标牌",
tts=""
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_construction,
content = "车内标牌",
tts = ""
),
TYPE_USECASE_ID_TJW(
ObuConstants.USE_CASE_ID.TJW.toString(),
"前方拥堵提醒",
poiTypeSrcVr=R.drawable.icon_warning_v2x_congestion,
content="前方%d米道路拥堵",
tts="前方拥堵,减速慢行"
poiTypeSrcVr = R.drawable.icon_warning_v2x_congestion,
content = "前方%d米道路拥堵",
tts = "前方拥堵,减速慢行"
),
TYPE_USECASE_ID_IVP(
ObuConstants.USE_CASE_ID.IVP.toString(),
"闯红灯预警",
poiTypeSrcVr=R.drawable.icon_warning_v2x_traffic_lights_red,
content="路口红灯,禁止通行",
tts="路口红灯,禁止通行"
poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_red,
content = "路口红灯,禁止通行",
tts = "路口红灯,禁止通行"
),
TYPE_USECASE_ID_IVP_GREEN(
0x2B091.toString(),
"绿波通行",
poiTypeSrcVr=R.drawable.icon_warning_v2x_traffic_lights_green,
content="建议车速 %s KM/H",
tts="建议车速 %s KM/H"
poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_green,
content = "建议车速 %s KM/H",
tts = "建议车速 %s KM/H"
),
TYPE_USECASE_ID_COC(
ObuConstants.USE_CASE_ID.COC.toString(),
"预留",
poiTypeSrcVr=R.drawable.icon_warning_v2x_abnormal_vehicle,
content="路况预警",
tts="路况预警"
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
content = "路况预警",
tts = "路况预警"
),
TYPE_USECASE_ID_ROAD_TRAMCAR(
0x2C01.toString(),
"前方有轨电车提醒",
poiTypeSrcVr=R.drawable.icon_warning_v2x_tramcar,
content="注意前方有轨电车",
tts="注意前方有轨电车驶过"
poiTypeSrcVr = R.drawable.icon_warning_v2x_tramcar,
content = "注意前方有轨电车",
tts = "注意前方有轨电车驶过"
),
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP(
0x2C02.toString(),
"前方左转急弯",
poiTypeSrcVr=R.drawable.icon_warning_v2x_turn_left_sharp,
content="注意前方左转急弯",
tts="前方路口左转急弯,减速慢行",
poiTypeSrcVr = R.drawable.icon_warning_v2x_turn_left_sharp,
content = "注意前方左转急弯",
tts = "前方路口左转急弯,减速慢行",
),
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP(
0x2C03.toString(),
"前方右转急弯",
poiTypeSrcVr=R.drawable.icon_warning_v2x_turn_right_sharp,
content="注意前方右转急弯",
tts="前方路口右转急弯,减速慢行"
poiTypeSrcVr = R.drawable.icon_warning_v2x_turn_right_sharp,
content = "注意前方右转急弯",
tts = "前方路口右转急弯,减速慢行"
),
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING(
0x2C04.toString(),
"人行横道",
poiTypeSrcVr=R.drawable.icon_warning_v2x_pedestrian_crossing,
content="注意前方人行横道",
tts="前方人行横道,减速慢行"
poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing,
content = "注意前方人行横道",
tts = "前方人行横道,减速慢行"
),
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL(
0x2C05.toString(),
"学校",
poiTypeSrcVr=R.drawable.icon_warning_v2x_school,
content="注意前方学校",
tts="前方学校,减速慢行"
poiTypeSrcVr = R.drawable.icon_warning_v2x_school,
content = "注意前方学校",
tts = "前方学校,减速慢行"
),
TYPE_USECASE_ID_ROAD_COLLISION_WARNING(
0x2C06.toString(),
"事故易发路段",
poiTypeSrcVr=R.drawable.icon_warning_v2x_collision_warning,
content="注意当前路段事故多发",
tts="当前路段事故多发,请小心驾驶"
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "注意当前路段事故多发",
tts = "当前路段事故多发,请小心驾驶"
),
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG(
0x2C07.toString(),
"环岛行驶",
poiTypeSrcVr=R.drawable.icon_warning_v2x_roundaboutpng,
content="注意前方驶入环岛",
tts="即将驶入环岛,减速慢行"
poiTypeSrcVr = R.drawable.icon_warning_v2x_roundaboutpng,
content = "注意前方驶入环岛",
tts = "即将驶入环岛,减速慢行"
),
TYPE_USECASE_ID_ROAD_TEST_SECTION(
0x2C08.toString(),
"驾校考试路段",
poiTypeSrcVr=R.drawable.icon_warning_v2x_test_section,
content="注意前方驾校考试路段",
tts="驾校考试路段,请小心驾驶"
poiTypeSrcVr = R.drawable.icon_warning_v2x_test_section,
content = "注意前方驾校考试路段",
tts = "驾校考试路段,请小心驾驶"
),
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE(
0x2C09.toString(),
"驼峰桥",
poiTypeSrcVr=R.drawable.icon_warning_v2x_hump_bridge,
content="注意前方驼峰桥",
tts="注意即将驶入驼峰桥,请小心驾驶"
poiTypeSrcVr = R.drawable.icon_warning_v2x_hump_bridge,
content = "注意前方驼峰桥",
tts = "注意即将驶入驼峰桥,请小心驾驶"
),
TYPE_USECASE_ID_ROAD_NO_PARKING(
0x2C10.toString(),
"禁止停车",
poiTypeSrcVr=R.drawable.icon_warning_v2x_no_parking,
content="注意当前路段禁止停车",
tts="当前路段,禁止停车"
poiTypeSrcVr = R.drawable.icon_warning_v2x_no_parking,
content = "注意当前路段禁止停车",
tts = "当前路段,禁止停车"
),
TYPE_USECASE_ID_ROAD_GIVE_WAY(
0x2C11.toString(),
"减速慢行",
poiTypeSrcVr=R.drawable.icon_warning_v2x_give_way,
content="注意路况复杂,减速慢行",
tts="路况复杂,减速慢行"
poiTypeSrcVr = R.drawable.icon_warning_v2x_give_way,
content = "注意路况复杂,减速慢行",
tts = "路况复杂,减速慢行"
),
TYPE_ERROR(
ObuConstants.USE_CASE_ID.ERROR.toString(),
"未知/错误/异常",
poiTypeSrcVr=R.drawable.icon_warning_v2x_abnormal_vehicle,
content="",
tts=""
);
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
content = "",
tts = ""
),
TYPE_VIP_IDENTIFICATION("10022", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行", "已为您变灯,请优先通行");
companion object {
@JvmStatic
@@ -541,12 +567,12 @@ enum class EventTypeEnum(
FOURS_PONDING.poiType -> FOURS_PONDING.tts
FOURS_FOG.poiType -> FOURS_FOG.tts
FOURS_ICE.poiType -> FOURS_ICE.tts
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.tts
else -> "道路事件"
}
}
@JvmStatic
fun getTtsWithFeedback(poiType: String?): String {
return when (poiType) {
@@ -564,7 +590,7 @@ enum class EventTypeEnum(
else -> "道路事件"
}
}
@JvmStatic
fun getAlarmContent(poiType: String?): String {
return when (poiType) {
@@ -634,7 +660,7 @@ enum class EventTypeEnum(
else -> "实时路况"
}
}
@JvmStatic
fun getMarker3DRes(poiType: String?): Int {
return when (poiType) {
@@ -649,7 +675,7 @@ enum class EventTypeEnum(
else -> 0
}
}
@JvmStatic
fun getTypeNameTTS(type: String?): String {
return when (type) {
@@ -665,7 +691,7 @@ enum class EventTypeEnum(
else -> "实时路况"
}
}
@JvmStatic
fun getUpdateIconRes(poiType: String?): Int {
return when (poiType) {
@@ -768,6 +794,7 @@ enum class EventTypeEnum(
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.poiTypeSrcVr
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.poiTypeSrcVr
TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr
else -> TYPE_ERROR.poiTypeSrcVr
}
@@ -806,6 +833,7 @@ enum class EventTypeEnum(
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.content
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.content
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.content
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content
TYPE_ERROR.poiType -> TYPE_ERROR.content
else -> TYPE_ERROR.content
@@ -845,6 +873,7 @@ enum class EventTypeEnum(
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.tts
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.tts
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.tts
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts
TYPE_ERROR.poiType -> TYPE_ERROR.tts
else -> TYPE_ERROR.tts

View File

@@ -60,6 +60,8 @@ dependencies {
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.mogo_core_utils
} else {
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
@@ -67,6 +69,8 @@ dependencies {
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-utils')
}
implementation 'com.zhidaoauto.voice.controller:api:1.0.2'

View File

@@ -12,7 +12,7 @@ import com.mogo.module.navi.cp.AddressHelper
import com.mogo.module.navi.cp.PersonalInfoManager
import com.mogo.module.navi.dao.SearchPoiDao
import com.mogo.module.navi.database.AppDataBase
import com.mogo.utils.WorkThreadHandler
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
import com.mogo.utils.logger.Logger
import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe

View File

@@ -66,7 +66,7 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.NetworkUtils;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import org.json.JSONObject;

View File

@@ -46,7 +46,7 @@ import com.mogo.module.service.status.EnvStatusManager;
import com.mogo.module.service.timedelay.TimeDelayUploadManager;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.utils.TipToast;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.storage.SharedPrefsMgr;

View File

@@ -4,7 +4,7 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import java.io.File;

View File

@@ -12,7 +12,7 @@ import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.module.common.utils.CarSeries;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.R;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import java.util.ArrayList;

View File

@@ -22,7 +22,7 @@ import com.mogo.realtime.api.MoGoAiCloudRealTime;
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.RequestOptions;
import com.mogo.utils.network.utils.GsonUtil;

View File

@@ -60,13 +60,16 @@ dependencies {
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleservice
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(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-data')
}

View File

@@ -53,7 +53,6 @@ import com.mogo.utils.NetworkUtils;
import com.mogo.utils.TipDrawable;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import org.greenrobot.eventbus.EventBus;

View File

@@ -48,7 +48,7 @@ import com.mogo.module.common.view.NetworkLoadingView;
import com.mogo.module.v2x.view.SurroundingMarginDecoration;
import com.mogo.service.IMogoServiceApis;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import org.greenrobot.eventbus.EventBus;

View File

@@ -5,7 +5,7 @@ import com.mogo.commons.mvp.Presenter;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.v2x.fragment.V2XScenarioHistoryFragment;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import java.util.List;

View File

@@ -2,12 +2,8 @@ package com.mogo.module.v2x.presenter;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.Presenter;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.v2x.fragment.V2XShareEventsFragment;
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.utils.WorkThreadHandler;
import java.util.List;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
public class ShareEventsPresenter extends Presenter <V2XShareEventsFragment>{

View File

@@ -1,6 +1,5 @@
package com.mogo.module.v2x.scenario.scene.park;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Handler;
import android.view.animation.AccelerateInterpolator;
@@ -19,11 +18,10 @@ import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.marker.V2XMarkerAdapter;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.module.v2x.utils.MarkerUtils;
import com.mogo.utils.ViewUtils;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import java.util.ArrayList;
import java.util.List;

View File

@@ -18,7 +18,7 @@ import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.listener.V2XLocationListener;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import java.util.ArrayList;
import java.util.Arrays;