[6.8.4]
[fix] [有任务 就要设置上自驾信息]
This commit is contained in:
@@ -230,7 +230,6 @@ object ScannerManager : IOchLanPassengerStatusListener {
|
||||
}
|
||||
|
||||
override fun onDriverConnectChangeListener(isConnect: Boolean) {
|
||||
super.onDriverConnectChangeListener(isConnect)
|
||||
if (isConnect) {
|
||||
sendScannerState()
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ import kotlin.math.abs
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object CommonModel {
|
||||
|
||||
private val TAG: String = CommonModel::class.java.simpleName
|
||||
private val TAG: String = SceneConstant.M_BUS_P+CommonModel::class.java.simpleName
|
||||
|
||||
var mContext: Context? = null
|
||||
|
||||
@@ -106,24 +106,22 @@ object CommonModel {
|
||||
}
|
||||
|
||||
|
||||
val connectDriverListener = object : IOchLanPassengerStatusListener {
|
||||
private val connectDriverListener = object : IOchLanPassengerStatusListener {
|
||||
// 和司机屏连接发生变化后
|
||||
override fun onDriverConnectChangeListener(isConnect: Boolean) {
|
||||
super.onDriverConnectChangeListener(isConnect)
|
||||
if(isConnect){
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
}
|
||||
// 司机屏sn 发生变化后
|
||||
override fun onDriverSnChagneListner(sn: String?) {
|
||||
super.onDriverSnChagneListner(sn)
|
||||
sn?.let {
|
||||
querySiteIntroduce()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
@@ -131,11 +129,11 @@ object CommonModel {
|
||||
}
|
||||
}
|
||||
|
||||
val mAutoPilotStatusListener: IOchAutopilotStatusListener =
|
||||
private val mAutoPilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
d(SceneConstant.M_BUS_P, "onAutopilotStatusResponse ===== $state")
|
||||
d(TAG, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state){
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
@@ -152,10 +150,10 @@ object CommonModel {
|
||||
}
|
||||
}
|
||||
|
||||
val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
d(SceneConstant.M_BUS_P, "轨迹排查==lastSumLength = $distance")
|
||||
d(TAG, "轨迹排查==lastSumLength = $distance")
|
||||
if (routesResult != null) {
|
||||
for (site in routesResult!!.sites) {
|
||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
||||
@@ -180,7 +178,7 @@ object CommonModel {
|
||||
}
|
||||
}
|
||||
|
||||
val typeTaskDetails = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
private val typeTaskDetails = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun targetLan(): Class<TaskDetailsMsg> {
|
||||
return TaskDetailsMsg::class.java
|
||||
}
|
||||
@@ -189,11 +187,13 @@ object CommonModel {
|
||||
first?.let {
|
||||
|
||||
if (first.msg?.isEmpty() == true) {
|
||||
clearAutopilotControlParameters()
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
val result = GsonUtils.fromJson(first.msg, BusTransferData::class.java)
|
||||
if (result != null && result.routesResult == null) {
|
||||
clearAutopilotControlParameters()
|
||||
clearLocalRouteResult()
|
||||
}
|
||||
|
||||
@@ -236,11 +236,11 @@ object CommonModel {
|
||||
}
|
||||
|
||||
if (routesResult != null && routesResult!!.lineId != result.lineId) {
|
||||
d(SceneConstant.M_BUS_P + TAG, "lineId change= clearCustomPolyline")
|
||||
d(TAG, "lineId change= clearCustomPolyline")
|
||||
mCommonCallback?.clearCustomPolyline()
|
||||
}
|
||||
|
||||
d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate = update")
|
||||
d(TAG, "queryDriverSiteByCoordinate = update")
|
||||
routesResult = result
|
||||
|
||||
if (result.sites != null) {
|
||||
@@ -253,27 +253,27 @@ object CommonModel {
|
||||
mCommonCallback?.updateLineStations(mStations)
|
||||
for (i in stations.indices) {
|
||||
val station = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED
|
||||
&& station.isLeaving && i + 1 < stations.size
|
||||
) {
|
||||
isGoingToNextStation = true
|
||||
mCommonCallback?.updateStationsInfo(stations, i + 1, false)
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
startStationVideo(endStation)
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
if(station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED){
|
||||
updateAutopilotControlParameters(result, i)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
if (station.isLeaving && i + 1 < stations.size
|
||||
) {
|
||||
isGoingToNextStation = true
|
||||
mCommonCallback?.updateStationsInfo(stations, i + 1, false)
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
startStationVideo(endStation)
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
return
|
||||
} else if (!station.isLeaving) {
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
Logger.d(TAG, "order = station= arrive")
|
||||
mCommonCallback?.updateStationsInfo(stations, i, true)
|
||||
return
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
Logger.d(SceneConstant.M_BUS_P + TAG, "order = station= arrive")
|
||||
mCommonCallback?.updateStationsInfo(stations, i, true)
|
||||
clearAutopilotControlParameters()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,16 +315,16 @@ object CommonModel {
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAutopilotControlParameters(
|
||||
private fun updateAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
) {
|
||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
||||
if (null == parameters) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P, "AutopilotControlParameters is empty.")
|
||||
CallerLogger.e(TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P, "AutopilotControlParameters is update.")
|
||||
d(TAG, "AutopilotControlParameters is update.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ object CommonModel {
|
||||
}
|
||||
val stations = busRoutesResult.sites
|
||||
if (leaveIndex + 1 > stations.size - 1) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P, "行程日志-mismatch condition1.")
|
||||
CallerLogger.e(TAG, "行程日志-mismatch condition1.")
|
||||
return null
|
||||
}
|
||||
val currentStation = stations[leaveIndex]
|
||||
@@ -368,7 +368,7 @@ object CommonModel {
|
||||
}
|
||||
|
||||
fun clearAutopilotControlParameters() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P, "AutopilotControlParameters is clear.")
|
||||
d(TAG, "AutopilotControlParameters is clear.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
@@ -400,8 +400,8 @@ object CommonModel {
|
||||
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
|
||||
}
|
||||
|
||||
fun cleanStation(type: String) {
|
||||
d(SceneConstant.M_BUS_P, "清理站点:$type")
|
||||
private fun cleanStation(type: String) {
|
||||
d(TAG, "清理站点:$type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user