[charter] 司机端到站
This commit is contained in:
@@ -17,8 +17,8 @@ data class QueryCurrentOrderResponse(var data: Result):BaseData(){ //线路id ,
|
||||
var startSiteName: String,
|
||||
var siteId: Int,
|
||||
var siteName: String,
|
||||
var wgs84Lon: Double,
|
||||
var wgs84Lat: Double,
|
||||
var wgs84Lon: Double = 0.0,
|
||||
var wgs84Lat: Double = 0.0,
|
||||
var startTime: Long,
|
||||
var endTime: Long,
|
||||
var passengerPhone: String
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.net.ConnectivityManager
|
||||
import android.os.Handler
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.alibaba.android.arouter.utils.TextUtils
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.elegant.network.utils.GsonUtil
|
||||
import com.magic.mogo.och.charter.R
|
||||
import com.magic.mogo.och.charter.bean.CheckOrderCountDownResponse
|
||||
@@ -14,6 +15,7 @@ import com.magic.mogo.och.charter.bean.QueryRoutesResponse
|
||||
import com.magic.mogo.och.charter.callback.ChangeDestCallback
|
||||
import com.magic.mogo.och.charter.callback.DriverM1OrderCallback
|
||||
import com.magic.mogo.och.charter.callback.IDriverM1ControllerStatusCallback
|
||||
import com.magic.mogo.och.charter.constant.CharterConst
|
||||
import com.magic.mogo.och.charter.net.DriverM1ServiceManager
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -33,10 +35,7 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManage
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.sendMsgToAllClients
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.och.common.module.bean.dpmsg.*
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.pushAppOperationalMsgBox
|
||||
@@ -67,10 +66,7 @@ class DriverM1Model {
|
||||
var mLatitude = 0.0
|
||||
private var mContext: Context? = null
|
||||
|
||||
/**
|
||||
* 用来表示是否正在开往下一站
|
||||
*/
|
||||
private var isGoingToNextStation = false
|
||||
private var isArrivedStation: Boolean = false
|
||||
|
||||
// 运营类型
|
||||
private val MSG_QUERY_BUS_STATION: Int = 1001
|
||||
@@ -351,34 +347,37 @@ class DriverM1Model {
|
||||
mLongitude = gnssInfo.longitude
|
||||
mLatitude = gnssInfo.latitude
|
||||
|
||||
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
|
||||
// if (isGoingToNextStation && !isArrivedStation) {
|
||||
// judgeArrivedStation(gnssInfo)
|
||||
// }
|
||||
//是否到站的围栏判断 自动驾驶还未触发到站
|
||||
if (!isArrivedStation) {
|
||||
judgeArrivedStation(gnssInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//根据围栏判断,是否到达站点
|
||||
private fun judgeArrivedStation(location: MogoLocation) {
|
||||
// if (backgroundCurrentStationIndex + 1 > stationList!!.size - 1) {
|
||||
// e(SceneConstant.M_CHARTER_D + TAG, "到站数组越界")
|
||||
// return
|
||||
// }
|
||||
// val upcomingStation: BusStationBean = stationList[backgroundCurrentStationIndex + 1]
|
||||
// val startLon: Double = upcomingStation.getGcjLon()
|
||||
// val startLat: Double = upcomingStation.getGcjLat()
|
||||
// val distance = CoordinateUtils.calculateLineDistance(
|
||||
// startLon, startLat,
|
||||
// location.longitude, location.latitude
|
||||
// ).toDouble()
|
||||
// if (distance <= CharterConst.ARRIVE_AT_END_STATION_DISTANCE) {
|
||||
// d(
|
||||
// SceneConstant.M_CHARTER_D + TAG, "行程日志-judgeArrivedStation() distance = " + distance
|
||||
// + " to " + upcomingStation.getName()
|
||||
// )
|
||||
// onArriveAt(null) //无自动驾驶到站信息传null
|
||||
// return
|
||||
// }
|
||||
if (mCurrentOrder == null) {
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "no order")
|
||||
return
|
||||
}
|
||||
val latLng: LatLng = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcj(mContext,mCurrentOrder?.wgs84Lon!!,mCurrentOrder?.wgs84Lat!!)
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
latLng.longitude, latLng.latitude,
|
||||
location.longitude, location.latitude
|
||||
).toDouble()
|
||||
if (distance <= CharterConst.ARRIVE_AT_END_STATION_DISTANCE) {
|
||||
d(
|
||||
SceneConstant.M_CHARTER_D + TAG, "行程日志-judgeArrivedStation() distance = " + distance
|
||||
+ " to " + mCurrentOrder?.siteName
|
||||
)
|
||||
onArriveAt() //无自动驾驶到站信息传null
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
private fun onArriveAt() {
|
||||
// todo 需要告诉前后外屏到站
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,7 +386,7 @@ class DriverM1Model {
|
||||
* @param isRestart
|
||||
*/
|
||||
private fun startAutopilot() {
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) {
|
||||
if (!OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) {
|
||||
ToastUtils.showLong(
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason +
|
||||
", 请稍候重试"
|
||||
@@ -423,13 +422,13 @@ class DriverM1Model {
|
||||
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
|
||||
*/
|
||||
fun restartAutopilot() {
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "司机端-启动自动驾驶===$isGoingToNextStation")
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "司机端-启动自动驾驶===")
|
||||
//只去启动自动驾驶
|
||||
startAutopilot()
|
||||
}
|
||||
|
||||
fun isGoingToNextStation(): Boolean {
|
||||
return isGoingToNextStation
|
||||
fun isHaveOrder(): Boolean {
|
||||
return mCurrentOrder == null
|
||||
}
|
||||
|
||||
// 登出
|
||||
@@ -542,6 +541,7 @@ class DriverM1Model {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (data != null && data.code == 0){
|
||||
mOrderCallback?.updateReturnCarStatus(true)
|
||||
queryCurrentServiceStatus()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +585,10 @@ class DriverM1Model {
|
||||
DriverM1ServiceManager.queryCurrentOrder(mContext
|
||||
,object: OchCommonServiceCallback<QueryCurrentOrderResponse>{
|
||||
override fun onSuccess(data: QueryCurrentOrderResponse?) {
|
||||
if (data == null || data.code != 0 || mCurrentOrder === data.data) return
|
||||
if (data == null || data.code != 0 || mCurrentOrder === data.data){
|
||||
isArrivedStation = false
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "queryCurrentOrder order =" +
|
||||
GsonUtils.toJson(data.data))
|
||||
mCurrentOrder = data.data
|
||||
@@ -676,4 +679,9 @@ class DriverM1Model {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun onAutopilotArriveAtStation() {
|
||||
if (isArrivedStation) return
|
||||
onArriveAt()
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManag
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
|
||||
import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -82,7 +83,7 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
|
||||
fun restartAutopilot() {
|
||||
// todo 启动自驾必须有订单路线
|
||||
if (DriverM1Model.get().isGoingToNextStation()) {
|
||||
if (DriverM1Model.get().isHaveOrder()) {
|
||||
DriverM1Model.get().restartAutopilot()
|
||||
}
|
||||
}
|
||||
@@ -115,6 +116,10 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
DriverM1Model.get().changeDest()
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
DriverM1Model.get().onAutopilotArriveAtStation()
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
|
||||
val status = autoPilotStatusInfo.state
|
||||
if (mCurrentAutopilotStatus == status) return
|
||||
|
||||
Reference in New Issue
Block a user