@@ -1,7 +1,7 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotsProvider
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
@@ -10,9 +10,9 @@ import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
* 域控制器管理
|
||||
*/
|
||||
object CallerAutoPilotManager {
|
||||
private val providerApi: IMoGoAutopilotsProvider
|
||||
private val providerApi: IMoGoAutopilotProvider
|
||||
get() = CallerBase.getApiInstance(
|
||||
IMoGoAutopilotsProvider::class.java,
|
||||
IMoGoAutopilotProvider::class.java,
|
||||
MogoServicePaths.PATH_AUTO_PILOT
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.eagle.core.function.call.autopilot
|
||||
import androidx.annotation.Nullable
|
||||
import com.mogo.eagle.core.data.autopilot.*
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotsStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
@@ -18,24 +18,24 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
private val TAG = "CallerAutoPilotStatusListenerManager"
|
||||
|
||||
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
|
||||
private var mAutopilotStatussInfo: AutopilotStatussInfo = AutopilotStatussInfo()
|
||||
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
|
||||
|
||||
// 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步
|
||||
private val M_AUTOPILOTS_STATUS_LISTENERS: HashMap<String, IMoGoAutopilotsStatusListener> =
|
||||
private val M_AUTOPILOT_STATUS_LISTENERS: HashMap<String, IMoGoAutopilotStatusListener> =
|
||||
HashMap()
|
||||
|
||||
/**
|
||||
* 查询AutoPilot状态
|
||||
*/
|
||||
fun getAutoPilotStatusInfo(): AutopilotStatussInfo {
|
||||
return mAutopilotStatussInfo
|
||||
fun getAutoPilotStatusInfo(): AutopilotStatusInfo {
|
||||
return mAutopilotStatusInfo
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询AutoPilot状态
|
||||
*/
|
||||
fun getAutoPilotStatusInfoJsonString(): String {
|
||||
return GsonUtils.toJson(mAutopilotStatussInfo)
|
||||
return GsonUtils.toJson(mAutopilotStatusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,10 +45,10 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
*/
|
||||
fun addListener(
|
||||
@Nullable tag: String,
|
||||
@Nullable listener: IMoGoAutopilotsStatusListener
|
||||
@Nullable listener: IMoGoAutopilotStatusListener
|
||||
) {
|
||||
M_AUTOPILOTS_STATUS_LISTENERS[tag] = listener
|
||||
listener.onAutopilotStatusResponse(mAutopilotStatussInfo)
|
||||
M_AUTOPILOT_STATUS_LISTENERS[tag] = listener
|
||||
listener.onAutopilotStatusResponse(mAutopilotStatusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
* @param tag 标记,用来注销监听使用
|
||||
*/
|
||||
fun removeListener(@Nullable tag: String) {
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.remove(tag)
|
||||
M_AUTOPILOT_STATUS_LISTENERS.remove(tag)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,9 +64,9 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
* @param listener 要删除的监听对象
|
||||
*/
|
||||
fun removeListener(@Nullable listener: IMoGoObuStatusListener) {
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
if (it.value == listener) {
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.remove(it.key)
|
||||
M_AUTOPILOT_STATUS_LISTENERS.remove(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,38 +76,38 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutoPilotStatus() {
|
||||
LogUtils.dTag(TAG, "$mAutopilotStatussInfo")
|
||||
invokeAutoPilotStatus(mAutopilotStatussInfo)
|
||||
LogUtils.dTag(TAG, "$mAutopilotStatusInfo")
|
||||
invokeAutoPilotStatus(mAutopilotStatusInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息 回调
|
||||
* @param autopilotStatussInfo 自动驾驶状态信息
|
||||
* @param autopilotStatusInfo 自动驾驶状态信息
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutoPilotStatus(autopilotStatussInfo: AutopilotStatussInfo) {
|
||||
LogUtils.dTag(TAG, "$autopilotStatussInfo")
|
||||
mAutopilotStatussInfo = autopilotStatussInfo
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
fun invokeAutoPilotStatus(autopilotStatusInfo: AutopilotStatusInfo) {
|
||||
LogUtils.dTag(TAG, "$autopilotStatusInfo")
|
||||
mAutopilotStatusInfo = autopilotStatusInfo
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
listener.onAutopilotStatusResponse(mAutopilotStatussInfo)
|
||||
listener.onAutopilotStatusResponse(mAutopilotStatusInfo)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶站点信息 回调
|
||||
* @param autopilotStationsInfo 自动驾驶网约车回调数据
|
||||
* @param autopilotStationInfo 自动驾驶网约车回调数据
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeArriveAtStation(autopilotStationsInfo: AutopilotStationsInfo) {
|
||||
LogUtils.dTag(TAG, "$autopilotStationsInfo")
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
fun invokeArriveAtStation(autopilotStationInfo: AutopilotStationInfo) {
|
||||
LogUtils.dTag(TAG, "$autopilotStationInfo")
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
listener.onAutopilotArriveAtStation(autopilotStationsInfo)
|
||||
listener.onAutopilotArriveAtStation(autopilotStationInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
@Synchronized
|
||||
fun invokeAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) {
|
||||
LogUtils.dTag(TAG, "$autoPilotCarStateInfo")
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
@@ -133,7 +133,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
@Synchronized
|
||||
fun invokeAutopilotRoute(routeInfo: AutopilotRouteInfo?) {
|
||||
LogUtils.dTag(TAG, "$routeInfo")
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
@@ -147,7 +147,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
@Synchronized
|
||||
fun invokeAutopilotSNRequest() {
|
||||
LogUtils.dTag(TAG, "")
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
@@ -161,7 +161,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
@Synchronized
|
||||
fun invokeAutopilotGuardian(guardianInfo: AutopilotGuardianStatusInfo?) {
|
||||
LogUtils.dTag(TAG, "$guardianInfo")
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
@@ -175,7 +175,7 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
@Synchronized
|
||||
fun invokeIdentifyDataUpdate(trafficData: List<TrafficData>?) {
|
||||
LogUtils.dTag(TAG, "$trafficData")
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
@@ -187,13 +187,13 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
|
||||
* 报警信息 回调
|
||||
*/
|
||||
@Synchronized
|
||||
fun invokeAutopilotWarnMessage(autopilotWarnMessage: AutopilotWarnMessage?) {
|
||||
LogUtils.dTag(TAG, "$autopilotWarnMessage")
|
||||
M_AUTOPILOTS_STATUS_LISTENERS.forEach {
|
||||
fun invokeAutopilotWarnMessage(autoPilotWarnMessage: AutoPilotWarnMessage?) {
|
||||
LogUtils.dTag(TAG, "$autoPilotWarnMessage")
|
||||
M_AUTOPILOT_STATUS_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
LogUtils.dTag(TAG, "tag:$tag listener:$listener")
|
||||
listener.onAutopilotWarnMessage(autopilotWarnMessage)
|
||||
listener.onAutopilotWarnMessage(autoPilotWarnMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user